修复生成绑定校验在 Windows 上启动不了 npx

- check-generated-bindings.mjs:prettier 归一化改用平台命令名 npx.cmd / npx,spawnSync 无 shell 时 Windows 解析不到裸 npx
This commit is contained in:
2026-10-02 22:26:56 +08:00
parent e9ad1f3ddb
commit 09f007d519
+8 -1
View File
@@ -24,6 +24,9 @@ const repoRoot = path.resolve(
'..',
);
// Windows 上 `npx` 以 `npx.cmd` 落地,`spawnSync` 不带 shell 时解析不到(ENOENT)。
const npxCommand = process.platform === 'win32' ? 'npx.cmd' : 'npx';
const SHARED_CONTRACTS_DIR = 'packages/shared/src/contracts/generated';
const AGC_CHAT_DIR =
'apps/ai-game-creator-shell/src/view/project-development/chat/generated';
@@ -115,7 +118,11 @@ for (const target of targets) {
process.exit(result.status ?? 1);
}
if (target.formatDirs.length > 0) {
const formatted = run('npx', ['prettier', '--write', ...target.formatDirs]);
const formatted = run(npxCommand, [
'prettier',
'--write',
...target.formatDirs,
]);
if (formatted.status !== 0) {
console.error(
`生成绑定校验无法运行:${target.label} 的 prettier 格式化失败`,