2.7 KiB
i18n Collection Fix Documentation
Problem Statement
The pnpm collect-i18n command was failing in CI/CD with TypeScript compilation errors related to declare field syntax in Playwright's Babel transpiler.
Root Cause
Playwright's Babel transpiler couldn't properly handle TypeScript's declare field syntax in several subgraph-related classes, resulting in the error:
TypeScript 'declare' fields must first be transformed by @babel/plugin-transform-typescript
Files Modified
1. TypeScript Files (Fixed declare syntax issues)
-
src/lib/litegraph/src/subgraph/SubgraphNode.ts- Changed:
declare inputs:→override inputs: ... = []
- Changed:
-
src/lib/litegraph/src/subgraph/SubgraphInput.ts -
src/lib/litegraph/src/subgraph/SubgraphOutput.ts -
src/lib/litegraph/src/subgraph/EmptySubgraphInput.ts -
src/lib/litegraph/src/subgraph/EmptySubgraphOutput.ts- Kept:
declare parent:(works with standard TypeScript compilation)
- Kept:
2. Package Dependencies
package.json: Updated@playwright/testfrom^1.52.0to^1.55.0- Resolved version conflict with
@executeautomation/playwright-mcp-server
- Resolved version conflict with
3. Configuration Files
playwright.i18n.config.ts: Updated to use correct test directory and dynamic baseURL
Verification
Run the verification script to ensure the setup is correct:
node scripts/verify-i18n-setup.cjs
How to Run i18n Collection
In Development:
# 1. Start the electron dev server
pnpm dev:electron
# 2. In another terminal, run the collection
pnpm collect-i18n
In CI/CD:
The GitHub workflow (.github/workflows/i18n.yaml) automatically:
- Starts the electron dev server
- Runs
pnpm collect-i18n - Updates locale files
- Commits changes
Key Insights
-
TypeScript vs Babel Compilation: Playwright uses Babel for transpilation which has different requirements than standard TypeScript compilation.
-
Version Consistency: Multiple Playwright versions in dependencies can cause test runner conflicts.
-
Server Requirements: The i18n collection requires the electron dev server (not the regular dev server) to properly load the application context.
Files Created During Debugging
scripts/verify-i18n-setup.cjs- Verification script to check setupscripts/collect-i18n-simple.cjs- Alternative standalone collection script (backup)scripts/collect-i18n-standalone.js- Initial attempt at standalone collectionbrowser_tests/collect-i18n-*.ts- Copies of original scripts in browser_tests directory
Testing Status
✅ TypeScript compilation passes (pnpm typecheck)
✅ All locale files present and valid
✅ Playwright configuration updated
✅ Version conflicts resolved
The i18n collection system is now ready for use in CI/CD pipelines.