95 lines
2.3 KiB
JavaScript
95 lines
2.3 KiB
JavaScript
import {readFileSync} from 'node:fs';
|
|
import {fileURLToPath} from 'node:url';
|
|
import {resolve} from 'node:path';
|
|
|
|
const root = resolve(fileURLToPath(new URL('../..', import.meta.url)));
|
|
const appSource = readFileSync(resolve(root, 'frontend/src/App.tsx'), 'utf8');
|
|
const mainSource = readFileSync(resolve(root, 'main.go'), 'utf8');
|
|
const appOptionsSource = readFileSync(resolve(root, 'app_options.go'), 'utf8');
|
|
const backendEntrySource = `${mainSource}\n${appOptionsSource}`;
|
|
|
|
const forbiddenUiText = [
|
|
/<h1>Skill Manager<\/h1>/,
|
|
/>\s*Config\s*</,
|
|
/>\s*Remote\s*</,
|
|
/>\s*Local\s*</,
|
|
/>\s*Check Updates\s*</,
|
|
/<span>Gitea Base URL<\/span>/,
|
|
/<span>Organization<\/span>/,
|
|
/<span>Auth Type<\/span>/,
|
|
/>\s*Password\s*</,
|
|
/<span>Username<\/span>/,
|
|
/<span>Credential Key<\/span>/,
|
|
/<span>Auto update<\/span>/,
|
|
/<span>Check on startup<\/span>/,
|
|
/<span>Interval Minutes<\/span>/,
|
|
/>\s*Save\s*</,
|
|
/>\s*Test\s*</,
|
|
/placeholder="Search repositories"/,
|
|
/>\s*Refresh\s*</,
|
|
/<th>Description<\/th>/,
|
|
/<th>Branch<\/th>/,
|
|
/<th>Status<\/th>/,
|
|
/<th>Action<\/th>/,
|
|
/<th>Actions<\/th>/,
|
|
/>\s*Update\s*</,
|
|
/>\s*Download\s*</,
|
|
/title="Open folder"/,
|
|
/>No remote skills</,
|
|
/>No local skills</,
|
|
/return 'Remote Market';/,
|
|
/return 'Local Skills';/,
|
|
/return 'Configuration';/,
|
|
/Delete local skill/,
|
|
/title="Delete local"/,
|
|
/Remote list refreshed/,
|
|
/Config saved/,
|
|
/Connected as/,
|
|
/installed to/,
|
|
/uninstalled from/,
|
|
/>not installed</,
|
|
];
|
|
|
|
const requiredChineseText = [
|
|
'技能管理器',
|
|
'配置',
|
|
'远程市场',
|
|
'本地技能',
|
|
'检查更新',
|
|
'保存',
|
|
'测试连接',
|
|
'搜索仓库',
|
|
'刷新',
|
|
'下载',
|
|
'更新',
|
|
'操作',
|
|
'暂无远程技能',
|
|
'暂无本地技能',
|
|
'已下载',
|
|
'已安装',
|
|
'未安装',
|
|
];
|
|
|
|
const failures = [];
|
|
|
|
for (const pattern of forbiddenUiText) {
|
|
if (pattern.test(appSource)) {
|
|
failures.push(`App.tsx still matches English UI pattern: ${pattern}`);
|
|
}
|
|
}
|
|
|
|
for (const text of requiredChineseText) {
|
|
if (!appSource.includes(text)) {
|
|
failures.push(`App.tsx is missing Chinese UI text: ${text}`);
|
|
}
|
|
}
|
|
|
|
if (!backendEntrySource.includes('SGG AI 技能管理器')) {
|
|
failures.push('window title is not Chinese');
|
|
}
|
|
|
|
if (failures.length > 0) {
|
|
console.error(failures.join('\n'));
|
|
process.exit(1);
|
|
}
|