fix: stabilize windows ci portability

This commit is contained in:
Affaan Mustafa
2026-04-12 22:06:04 -07:00
parent 2d5762fea6
commit f230ee428f
2 changed files with 62 additions and 40 deletions

View File

@@ -26,11 +26,12 @@ function main() {
let failed = 0
const repoRoot = path.join(__dirname, "..", "..")
const packageJson = JSON.parse(
fs.readFileSync(path.join(repoRoot, "package.json"), "utf8")
)
const buildScript = path.join(repoRoot, "scripts", "build-opencode.js")
const distEntry = path.join(repoRoot, ".opencode", "dist", "index.js")
const packageJson = JSON.parse(
fs.readFileSync(path.join(repoRoot, "package.json"), "utf8")
)
const buildScript = path.join(repoRoot, "scripts", "build-opencode.js")
const distEntry = path.join(repoRoot, ".opencode", "dist", "index.js")
const npmExecutable = process.platform === "win32" ? "npm.cmd" : "npm"
const tests = [
["package.json exposes the OpenCode build and prepack hooks", () => {
assert.strictEqual(packageJson.scripts["build:opencode"], "node scripts/build-opencode.js")
@@ -46,7 +47,7 @@ function main() {
assert.ok(fs.existsSync(distEntry), ".opencode/dist/index.js should exist after build")
}],
["npm pack includes the compiled OpenCode dist payload", () => {
const result = spawnSync("npm", ["pack", "--dry-run", "--json"], {
const result = spawnSync(npmExecutable, ["pack", "--dry-run", "--json"], {
cwd: repoRoot,
encoding: "utf8",
})