mirror of
https://github.com/affaan-m/everything-claude-code.git
synced 2026-04-13 13:23:31 +08:00
fix: make npm pack test shell-safe on windows
This commit is contained in:
@@ -31,7 +31,6 @@ const packageJson = JSON.parse(
|
|||||||
)
|
)
|
||||||
const buildScript = path.join(repoRoot, "scripts", "build-opencode.js")
|
const buildScript = path.join(repoRoot, "scripts", "build-opencode.js")
|
||||||
const distEntry = path.join(repoRoot, ".opencode", "dist", "index.js")
|
const distEntry = path.join(repoRoot, ".opencode", "dist", "index.js")
|
||||||
const npmExecutable = process.platform === "win32" ? "npm.cmd" : "npm"
|
|
||||||
const tests = [
|
const tests = [
|
||||||
["package.json exposes the OpenCode build and prepack hooks", () => {
|
["package.json exposes the OpenCode build and prepack hooks", () => {
|
||||||
assert.strictEqual(packageJson.scripts["build:opencode"], "node scripts/build-opencode.js")
|
assert.strictEqual(packageJson.scripts["build:opencode"], "node scripts/build-opencode.js")
|
||||||
@@ -47,11 +46,12 @@ const npmExecutable = process.platform === "win32" ? "npm.cmd" : "npm"
|
|||||||
assert.ok(fs.existsSync(distEntry), ".opencode/dist/index.js should exist after build")
|
assert.ok(fs.existsSync(distEntry), ".opencode/dist/index.js should exist after build")
|
||||||
}],
|
}],
|
||||||
["npm pack includes the compiled OpenCode dist payload", () => {
|
["npm pack includes the compiled OpenCode dist payload", () => {
|
||||||
const result = spawnSync(npmExecutable, ["pack", "--dry-run", "--json"], {
|
const result = spawnSync("npm", ["pack", "--dry-run", "--json"], {
|
||||||
cwd: repoRoot,
|
cwd: repoRoot,
|
||||||
encoding: "utf8",
|
encoding: "utf8",
|
||||||
|
shell: process.platform === "win32",
|
||||||
})
|
})
|
||||||
assert.strictEqual(result.status, 0, result.stderr)
|
assert.strictEqual(result.status, 0, result.error?.message || result.stderr)
|
||||||
|
|
||||||
const packOutput = JSON.parse(result.stdout)
|
const packOutput = JSON.parse(result.stdout)
|
||||||
const packagedPaths = new Set(packOutput[0]?.files?.map((file) => file.path) ?? [])
|
const packagedPaths = new Set(packOutput[0]?.files?.map((file) => file.path) ?? [])
|
||||||
|
|||||||
Reference in New Issue
Block a user