ci(vscode-ide-companion): add platform-specific builds to fix node-pty binary mismatch

Build separate VSIXes for each platform to ensure native node-pty
binaries match the user's OS, preventing "posix_spawnp failed" errors.
This commit is contained in:
tanzhenxin 2026-01-24 06:25:43 +08:00
parent c2fbccc002
commit 4770324df2
2 changed files with 207 additions and 57 deletions

View file

@ -78,21 +78,31 @@ function main() {
},
);
const isUniversalBuild = process.env.UNIVERSAL_BUILD === 'true';
console.log(
'[prepackage] Installing production deps into extension dist/qwen-cli...',
);
run(
npm,
[
'--prefix',
bundledCliDir,
'install',
'--omit=dev',
'--no-audit',
'--no-fund',
],
{ cwd: bundledCliDir },
);
const installArgs = [
'--prefix',
bundledCliDir,
'install',
'--omit=dev',
'--no-audit',
'--no-fund',
];
// For universal build, exclude optional dependencies (node-pty native binaries)
// This ensures the universal VSIX works on all platforms using child_process fallback
if (isUniversalBuild) {
installArgs.push('--omit=optional');
console.log(
'[prepackage] Universal build: excluding optional dependencies (node-pty)',
);
}
run(npm, installArgs, { cwd: bundledCliDir });
}
main();