fix(codex): harden windows light install

This commit is contained in:
YeonGyu-Kim
2026-05-31 13:23:24 +09:00
parent 4e31d7df5d
commit 92bad87d84
42 changed files with 1675 additions and 23 deletions
@@ -18,6 +18,11 @@ const runtimes = [
packageRoot: join(repoPackagesRoot, "ast-grep-mcp"),
requiredOutputs: ["dist/cli.js"],
},
{
label: "git-bash-mcp",
packageRoot: join(repoPackagesRoot, "git-bash-mcp"),
requiredOutputs: ["dist/cli.js"],
},
];
for (const runtime of runtimes) {
@@ -25,13 +30,18 @@ for (const runtime of runtimes) {
}
function buildRuntime(runtime) {
if (hasBundledDist(runtime)) {
console.log(`Using bundled ${runtime.label} dist`);
return;
}
if (!existsSync(join(runtime.packageRoot, "package.json"))) {
assertBundledDist(runtime);
console.log(`Using bundled ${runtime.label} dist`);
return;
}
const result = spawnSync("bun", ["run", "build"], {
const result = spawnSync("npm", ["run", "build"], {
cwd: runtime.packageRoot,
stdio: "inherit",
});
@@ -39,6 +49,10 @@ function buildRuntime(runtime) {
if (result.status !== 0) process.exit(result.status ?? 1);
}
function hasBundledDist(runtime) {
return runtime.requiredOutputs.every((output) => existsSync(join(runtime.packageRoot, output)));
}
function assertBundledDist(runtime) {
const missingOutputs = runtime.requiredOutputs.filter((output) => !existsSync(join(runtime.packageRoot, output)));
if (missingOutputs.length === 0) return;
@@ -14,7 +14,7 @@ for (const workspace of workspaces) {
if (typeof workspacePackageJson.scripts?.build !== "string") continue;
console.log(`Building ${workspace}`);
const result = spawnSync("bun", ["run", "--cwd", workspace, "build"], {
const result = spawnSync("npm", ["run", "--workspace", workspace, "build"], {
cwd: root,
stdio: "inherit",
});