mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-09 17:40:09 +00:00
reset branch
This commit is contained in:
@@ -4,9 +4,10 @@ import { comfyPageFixture as test } from '../browser_tests/fixtures/ComfyPage'
|
||||
import { CORE_MENU_COMMANDS } from '../src/constants/coreMenuCommands'
|
||||
import { DESKTOP_DIALOGS } from '../src/constants/desktopDialogs'
|
||||
import { SERVER_CONFIG_ITEMS } from '../src/constants/serverConfig'
|
||||
import type { FormItem, SettingParams } from '../src/platform/settings/types'
|
||||
import type { ComfyCommandImpl } from '../src/stores/commandStore'
|
||||
import type { FormItem, SettingParams } from '../src/types/settingTypes'
|
||||
import { formatCamelCase, normalizeI18nKey } from '../src/utils/formatUtil'
|
||||
import './setup-browser-globals.js'
|
||||
|
||||
const localePath = './src/locales/en/main.json'
|
||||
const commandsPath = './src/locales/en/commands.json'
|
||||
@@ -48,15 +49,28 @@ test('collect-i18n-general', async ({ comfyPage }) => {
|
||||
Array.from(allLabels).map((label) => [normalizeI18nKey(label), label])
|
||||
)
|
||||
|
||||
const allCommandsLocale = Object.fromEntries(
|
||||
commands.map((command) => [
|
||||
// Load existing commands to preserve Desktop commands
|
||||
const existingCommands = JSON.parse(fs.readFileSync(commandsPath, 'utf-8'))
|
||||
|
||||
// Filter out Desktop commands from existing commands
|
||||
const desktopCommands = Object.fromEntries(
|
||||
Object.entries(existingCommands).filter(([key]) =>
|
||||
key.startsWith('Comfy-Desktop')
|
||||
)
|
||||
)
|
||||
|
||||
const allCommandsLocale = Object.fromEntries([
|
||||
// Keep Desktop commands that aren't in the current collection
|
||||
...Object.entries(desktopCommands),
|
||||
// Add/update commands from current collection
|
||||
...commands.map((command) => [
|
||||
normalizeI18nKey(command.id),
|
||||
{
|
||||
label: command.label,
|
||||
tooltip: command.tooltip
|
||||
}
|
||||
])
|
||||
)
|
||||
])
|
||||
|
||||
// Settings
|
||||
const settings = await comfyPage.page.evaluate(() => {
|
||||
@@ -79,8 +93,21 @@ test('collect-i18n-general', async ({ comfyPage }) => {
|
||||
}))
|
||||
})
|
||||
|
||||
const allSettingsLocale = Object.fromEntries(
|
||||
settings.map((setting) => [
|
||||
// Load existing settings to preserve Desktop settings
|
||||
const existingSettings = JSON.parse(fs.readFileSync(settingsPath, 'utf-8'))
|
||||
|
||||
// Filter out Desktop settings from existing settings
|
||||
const desktopSettings = Object.fromEntries(
|
||||
Object.entries(existingSettings).filter(([key]) =>
|
||||
key.startsWith('Comfy-Desktop')
|
||||
)
|
||||
)
|
||||
|
||||
const allSettingsLocale = Object.fromEntries([
|
||||
// Keep Desktop settings that aren't in the current collection
|
||||
...Object.entries(desktopSettings),
|
||||
// Add/update settings from current collection
|
||||
...settings.map((setting) => [
|
||||
normalizeI18nKey(setting.id),
|
||||
{
|
||||
name: setting.name,
|
||||
@@ -99,7 +126,7 @@ test('collect-i18n-general', async ({ comfyPage }) => {
|
||||
: undefined
|
||||
}
|
||||
])
|
||||
)
|
||||
])
|
||||
|
||||
const allSettingCategoriesLocale = Object.fromEntries(
|
||||
settings
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// Setup browser globals before any other imports that might use them
|
||||
import * as fs from 'fs'
|
||||
|
||||
import { comfyPageFixture as test } from '../browser_tests/fixtures/ComfyPage'
|
||||
@@ -5,6 +6,7 @@ import type { ComfyNodeDef } from '../src/schemas/nodeDefSchema'
|
||||
import type { ComfyApi } from '../src/scripts/api'
|
||||
import { ComfyNodeDefImpl } from '../src/stores/nodeDefStore'
|
||||
import { normalizeI18nKey } from '../src/utils/formatUtil'
|
||||
import './setup-browser-globals.js'
|
||||
|
||||
const localePath = './src/locales/en/main.json'
|
||||
const nodeDefsPath = './src/locales/en/nodeDefs.json'
|
||||
@@ -26,6 +28,8 @@ test('collect-i18n-node-defs', async ({ comfyPage }) => {
|
||||
})
|
||||
})
|
||||
|
||||
// Note: Don't mock the object_info API endpoint - let it hit the actual backend
|
||||
|
||||
const nodeDefs: ComfyNodeDefImpl[] = (
|
||||
Object.values(
|
||||
await comfyPage.page.evaluate(async () => {
|
||||
@@ -41,6 +45,27 @@ test('collect-i18n-node-defs', async ({ comfyPage }) => {
|
||||
|
||||
console.log(`Collected ${nodeDefs.length} node definitions`)
|
||||
|
||||
// If no node definitions were collected (e.g., running without backend),
|
||||
// create empty locale files to avoid build failures
|
||||
if (nodeDefs.length === 0) {
|
||||
console.warn('No node definitions found - creating empty locale files')
|
||||
const locale = JSON.parse(fs.readFileSync(localePath, 'utf-8'))
|
||||
fs.writeFileSync(
|
||||
localePath,
|
||||
JSON.stringify(
|
||||
{
|
||||
...locale,
|
||||
dataTypes: {},
|
||||
nodeCategories: {}
|
||||
},
|
||||
null,
|
||||
2
|
||||
)
|
||||
)
|
||||
fs.writeFileSync(nodeDefsPath, JSON.stringify({}, null, 2))
|
||||
return
|
||||
}
|
||||
|
||||
const allDataTypesLocale = Object.fromEntries(
|
||||
nodeDefs
|
||||
.flatMap((nodeDef) => {
|
||||
|
||||
Reference in New Issue
Block a user