Compare commits

...

41 Commits

Author SHA1 Message Date
snomiao
6ef3650427 chore(i18n.yaml): update job condition to include sno-fix-playwright-babel branch for temporary Playwright issue fix 2025-09-18 07:13:36 +00:00
snomiao
f4d21852eb Merge branch 'main' into sno-fix-playwright-babel 2025-09-12 12:28:39 +09:00
snomiao
9ac1a0a4b5 style(globalTeardownWithI18n.ts): change import statement to use type import for FullConfig to improve clarity and maintainability 2025-09-12 01:46:30 +00:00
snomiao
85b51b1c2c fix(i18nSetup.ts): improve error message for better clarity on preprocessing failure 2025-09-12 01:39:05 +00:00
snomiao
9d7eac2642 perf(i18nSetup): optimize file reading to reduce I/O operations
Refactored preprocessLitegraph() to read each file only once instead of twice.
Previously files were read once to check for 'declare' keywords and again to
process them. Now files are read once and processed inline if they contain
'declare' keywords, improving performance.
2025-09-12 01:30:00 +00:00
snomiao
08d4c07ad5 feat(knip.config.ts): add tailwindcss and tailwindcss-primeui to the plugins list to support Tailwind CSS integration in the project 2025-09-12 01:04:22 +00:00
snomiao
4984e96016 feat(knip.config.ts): add tailwind configuration to support Tailwind CSS integration in the project 2025-09-12 01:02:12 +00:00
snomiao
a79d87d25a refactor(knip.config.ts): simplify and reorganize configuration for better clarity and maintainability
feat(knip.config.ts): add support for vite and vitest configurations to enhance project structure and testing capabilities
2025-09-12 00:58:35 +00:00
snomiao
98318c849e chore(knip.config.ts): add i18n related test files to the configuration to ensure they are included in the build process 2025-09-12 00:55:07 +00:00
snomiao
ad111f007a refactor(tests): update global setup and teardown functions to accept FullConfig parameter for better integration with Playwright's testing framework 2025-09-12 00:49:12 +00:00
snomiao
450f156d53 fix(knip.config.ts): revert changes
revert changes
2025-09-12 00:44:39 +00:00
snomiao
18694842e5 fix(knip.config.ts): revert changes
revert changes
2025-09-12 00:41:53 +00:00
snomiao
b1c6622825 fix(revert): test-browser-exp changes
test-browser-exp changes
2025-09-12 00:39:34 +00:00
snomiao
c393c480fe Merge branches 'sno-fix-playwright-babel' and 'main' of github.com:Comfy-Org/ComfyUI_frontend into sno-fix-playwright-babel 2025-09-12 00:39:00 +00:00
snomiao
595b5f0248 Merge remote-tracking branch 'origin/main' into sno-fix-playwright-babel 2025-09-11 06:35:19 +00:00
snomiao
be87bd02a1 Merge branch 'main' into sno-fix-playwright-babel - Resolved conflict in knip.config.ts 2025-09-11 06:12:06 +00:00
snomiao
4aec5fe179 Merge branch 'main' into sno-fix-playwright-babel 2025-09-05 09:38:01 +09:00
snomiao
bbb6396ddd [bugfix] Revert i18n files and fix git checkout in browser test workflow 2025-09-04 04:54:50 +00:00
snomiao
33dd25120f [chore] Update pnpm lockfile to match package.json dependencies 2025-09-03 21:41:24 +00:00
snomiao
8afd0071d8 [bugfix] Fix i18n workflow condition, simplify setup/teardown, and resolve merge conflict
- Fix logical error in i18n workflow condition (should use OR, not AND)
- Simplify globalSetupWithI18n and globalTeardownWithI18n by removing duplicate calls
- Add performance note about file reading in i18nSetup
- Resolve merge conflict in settings.json keeping both changes

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-03 21:10:29 +00:00
snomiao
09ec3ade24 chore(package.json): remove unused Babel dependencies to clean up the project and reduce bloat 2025-09-03 20:50:10 +00:00
snomiao
728828e724 Merge branch 'sno-fix-playwright-babel' of github.com:Comfy-Org/ComfyUI_frontend into sno-fix-playwright-babel 2025-09-03 20:47:49 +00:00
github-actions
c7e9f832d6 Update locales [skip ci] 2025-09-03 20:32:13 +00:00
snomiao
e4bc294681 [bugfix] Remove sno-fix branch condition from i18n workflow
This condition was added for testing but should not be included in the final PR as it would trigger unneeded locale updates.
2025-09-03 20:20:36 +00:00
snomiao
4bd68c8f2f Merge branch 'main' into sno-fix-playwright-babel 2025-09-04 02:08:02 +09:00
snomiao
457cbbd532 [bugfix] Add i18n setup files to knip ignore list
These files are only used by playwright.i18n.config.ts for the collect-i18n script.
Knip doesn't recognize them as used since they're only referenced as string paths
in the Playwright config.
2025-09-03 16:06:29 +00:00
github-actions
32b8a1eb01 Update locales [skip ci] 2025-09-03 15:25:36 +00:00
snomiao
adbfd59f08 Merge branch 'main' into sno-fix-playwright-babel 2025-09-03 15:12:14 +00:00
github-actions
2a611cb65d Update locales [skip ci] 2025-09-02 21:30:45 +00:00
snomiao
f037567fc5 style: Apply Prettier formatting
- Fix trailing whitespace
- Add missing newlines at end of files
2025-09-02 21:17:27 +00:00
snomiao
3700457462 Merge branch 'main' into sno-fix-playwright-babel 2025-09-03 01:45:07 +09:00
snomiao
0a3f878b35 refactor: Use async fs/promises for better performance
- Replace synchronous fs operations with async fs.promises
- Use Promise.all for parallel file processing
- Improves performance when processing multiple files
2025-09-02 15:37:14 +00:00
snomiao
2403b47b5c refactor: Use glob pattern to find litegraph files with declare keywords
Instead of hardcoding the list of files, dynamically find all TypeScript files in litegraph that contain 'declare' keywords using glob pattern matching.
2025-09-02 14:24:31 +00:00
github-actions
4e56bae7f1 Update locales [skip ci] 2025-09-02 05:14:03 +00:00
snomiao
ea917ba720 fix: Remove ComfyPageNoUser fixture and revert to standard fixture
The NoUser fixture doesn't work properly in CI. Tests will handle user creation properly with the standard fixture.
2025-09-02 05:03:21 +00:00
snomiao
29add8f090 Merge branch 'main' into sno-fix-playwright-babel 2025-09-02 13:54:59 +09:00
snomiao
4c2715e480 refactor: Replace script-based litegraph preprocessing with integrated Playwright setup
- Remove prebuild-litegraph.js and restore-litegraph.js scripts
- Add i18nSetup.ts module for litegraph TypeScript 'declare' keyword preprocessing
- Create ComfyPageNoUser fixture to avoid user creation conflicts in i18n tests
- Update playwright.i18n.config.ts to use integrated setup/teardown
- Simplify collect-i18n command to just run Playwright tests
- Ensure pnpm collect-i18n works correctly

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-02 03:33:16 +00:00
github-actions
83de398b21 Update locales [skip ci] 2025-09-02 02:00:34 +00:00
snomiao
61f96283ee chore(i18n.yaml): format YAML file for consistency and readability by adjusting spacing and line breaks 2025-09-02 01:49:13 +00:00
snomiao
c183026fd4 fix(i18n.yaml): update job condition to include 'sno-fix' branches for locale updates 2025-09-02 01:30:15 +00:00
snomiao
5bc50500fd fix: Fix Playwright i18n collection by handling TypeScript declare fields in litegraph
- Add prebuild script that temporarily removes 'declare' keyword from litegraph TypeScript files
- Add restore script to revert files to original state after i18n collection
- Update collect-i18n script to use prebuild/restore workflow
- Add babel dependencies for TypeScript transformation
- Update playwright.i18n.config.ts with global setup/teardown

This fix addresses an issue where Playwright's Babel transformation couldn't handle TypeScript 'declare' fields in litegraph classes, causing the i18n collection to fail.

Fixes the issue where 'pnpm collect-i18n' would fail with:
"TypeScript 'declare' fields must first be transformed by @babel/plugin-transform-typescript"
2025-09-01 23:21:01 +00:00
8 changed files with 421 additions and 297 deletions

View File

@@ -11,7 +11,13 @@ on:
jobs:
update-locales:
# Branch detection: Only run for manual dispatch or version-bump-* branches from main repo
if: github.event_name == 'workflow_dispatch' || (github.event.pull_request.head.repo.full_name == github.repository && startsWith(github.head_ref, 'version-bump-'))
# add sno-fix-playwright-babel temporarily to fix playwright issue with babel
if: >
github.event_name == 'workflow_dispatch' ||
(github.event.pull_request.head.repo.full_name == github.repository &&
startsWith(github.head_ref, 'version-bump-')) ||
startsWith(github.head_ref, 'sno-fix-playwright-babel')
runs-on: ubuntu-latest
steps:
- uses: Comfy-Org/ComfyUI_frontend_setup_action@v3

View File

@@ -0,0 +1,7 @@
import type { FullConfig } from '@playwright/test'
import { preprocessLitegraph } from './i18nSetup'
export default async function globalSetup(config: FullConfig) {
await preprocessLitegraph()
}

View File

@@ -0,0 +1,7 @@
import type { FullConfig } from '@playwright/test'
import { restoreLitegraph } from './i18nSetup'
export default async function globalTeardown(config: FullConfig) {
await restoreLitegraph()
}

View File

@@ -0,0 +1,81 @@
/**
* Setup for i18n collection tests
* Handles preprocessing of litegraph files that contain TypeScript 'declare' keywords
*/
import { promises as fs } from 'fs'
import { glob } from 'glob'
import * as path from 'path'
import { fileURLToPath } from 'url'
const __dirname = path.dirname(fileURLToPath(import.meta.url))
const rootDir = path.resolve(__dirname, '..')
const litegraphSrcDir = path.join(rootDir, 'src/lib/litegraph/src')
const backupMap = new Map<string, string>()
export async function preprocessLitegraph() {
console.log('Preprocessing litegraph files for i18n collection...')
// Search for all .ts files in litegraph src directory
const pattern = path.join(litegraphSrcDir, '**/*.ts')
const files = await glob(pattern, {
ignore: ['**/*.test.ts', '**/*.spec.ts', '**/node_modules/**']
})
let processedCount = 0
// Process files in parallel - read once and process if needed
await Promise.all(
files.map(async (filePath) => {
try {
const originalContent = await fs.readFile(filePath, 'utf-8')
// Check for class property declarations with 'declare' keyword
if (!/^\s*declare\s+/m.test(originalContent)) {
return // Skip files without declare keywords
}
// Store original content in memory
backupMap.set(filePath, originalContent)
// Remove 'declare' keyword from class properties
const modifiedContent = originalContent.replace(
/^(\s*)declare\s+/gm,
'$1// @ts-ignore - removed declare for Playwright\n$1'
)
// Write modified content
await fs.writeFile(filePath, modifiedContent)
console.log(` ✓ Processed ${path.relative(litegraphSrcDir, filePath)}`)
processedCount++
} catch (error: unknown) {
console.warn(
` ⚠ Could not preprocess file for litegraph ${filePath}: ${String((error as Error)?.message || error)}`
)
}
})
)
if (processedCount === 0) {
console.log(' No files with declare keywords found')
} else {
console.log(` Processed ${processedCount} files with declare keywords`)
}
}
export async function restoreLitegraph() {
if (backupMap.size === 0) {
return
}
console.log('Restoring original litegraph files...')
await Promise.all(
Array.from(backupMap.entries()).map(async ([filePath, originalContent]) => {
await fs.writeFile(filePath, originalContent)
console.log(` ✓ Restored ${path.relative(litegraphSrcDir, filePath)}`)
})
)
backupMap.clear()
}

View File

@@ -18,7 +18,9 @@ const config: KnipConfig = {
'@primeuix/utils',
'@primevue/icons',
// Dev
'@trivago/prettier-plugin-sort-imports'
'@trivago/prettier-plugin-sort-imports',
'tailwindcss',
'tailwindcss-primeui'
],
ignore: [
// Auto generated manager types

View File

@@ -8,5 +8,11 @@ export default defineConfig({
},
reporter: 'list',
timeout: 60000,
testMatch: /collect-i18n-.*\.ts/
testMatch: /collect-i18n-.*\.ts/,
// Run tests sequentially to avoid conflicts
workers: 1,
fullyParallel: false,
// Use combined setup that includes litegraph preprocessing
globalSetup: './browser_tests/globalSetupWithI18n.ts',
globalTeardown: './browser_tests/globalTeardownWithI18n.ts'
})

601
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@@ -11,7 +11,7 @@ const nodeDefsPath = './src/locales/en/nodeDefs.json'
test('collect-i18n-node-defs', async ({ comfyPage }) => {
// Mock view route
comfyPage.page.route('**/view**', async (route) => {
await comfyPage.page.route('**/view**', async (route) => {
await route.fulfill({
body: JSON.stringify({})
})