mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-13 19:20:37 +00:00
Compare commits
41 Commits
refactor/n
...
sno-fix-pl
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6ef3650427 | ||
|
|
f4d21852eb | ||
|
|
9ac1a0a4b5 | ||
|
|
85b51b1c2c | ||
|
|
9d7eac2642 | ||
|
|
08d4c07ad5 | ||
|
|
4984e96016 | ||
|
|
a79d87d25a | ||
|
|
98318c849e | ||
|
|
ad111f007a | ||
|
|
450f156d53 | ||
|
|
18694842e5 | ||
|
|
b1c6622825 | ||
|
|
c393c480fe | ||
|
|
595b5f0248 | ||
|
|
be87bd02a1 | ||
|
|
4aec5fe179 | ||
|
|
bbb6396ddd | ||
|
|
33dd25120f | ||
|
|
8afd0071d8 | ||
|
|
09ec3ade24 | ||
|
|
728828e724 | ||
|
|
c7e9f832d6 | ||
|
|
e4bc294681 | ||
|
|
4bd68c8f2f | ||
|
|
457cbbd532 | ||
|
|
32b8a1eb01 | ||
|
|
adbfd59f08 | ||
|
|
2a611cb65d | ||
|
|
f037567fc5 | ||
|
|
3700457462 | ||
|
|
0a3f878b35 | ||
|
|
2403b47b5c | ||
|
|
4e56bae7f1 | ||
|
|
ea917ba720 | ||
|
|
29add8f090 | ||
|
|
4c2715e480 | ||
|
|
83de398b21 | ||
|
|
61f96283ee | ||
|
|
c183026fd4 | ||
|
|
5bc50500fd |
8
.github/workflows/i18n.yaml
vendored
8
.github/workflows/i18n.yaml
vendored
@@ -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
|
||||
|
||||
7
browser_tests/globalSetupWithI18n.ts
Normal file
7
browser_tests/globalSetupWithI18n.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import type { FullConfig } from '@playwright/test'
|
||||
|
||||
import { preprocessLitegraph } from './i18nSetup'
|
||||
|
||||
export default async function globalSetup(config: FullConfig) {
|
||||
await preprocessLitegraph()
|
||||
}
|
||||
7
browser_tests/globalTeardownWithI18n.ts
Normal file
7
browser_tests/globalTeardownWithI18n.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import type { FullConfig } from '@playwright/test'
|
||||
|
||||
import { restoreLitegraph } from './i18nSetup'
|
||||
|
||||
export default async function globalTeardown(config: FullConfig) {
|
||||
await restoreLitegraph()
|
||||
}
|
||||
81
browser_tests/i18nSetup.ts
Normal file
81
browser_tests/i18nSetup.ts
Normal 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()
|
||||
}
|
||||
@@ -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
|
||||
|
||||
@@ -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
601
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@@ -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({})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user