From 3291e445c05f2775587cb43a402e82a6f0637cf5 Mon Sep 17 00:00:00 2001 From: glennmichael123 Date: Fri, 4 Sep 2026 01:16:30 +0800 Subject: [PATCH] fix(ci): guard the pantry-env evals in package.json too, which #107 missed MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit #107 removed `eval "$(pantry env …)"` from 16 sites across five workflows and said so. It missed eight more in `package.json`, and `integration` found them: its "Run root verification" step runs `bun run verify`, which reaches `build:core`, which evals `pantry env`, which runs the workspace setup — ✗ Patch failed for ts-maps error: Cannot find package 'typescript' from …/packages/typescript/scripts — the same clobbered `node_modules`, one door further along. The failing step moved from "Build TypeScript SDK" to "Run root verification"; the cause did not change at all. Guarded rather than removed, because these are not the workflow's sites. In CI the pantry action puts `zig` on PATH, so the guard short-circuits and nothing runs a workspace setup. On a developer's machine `zig` is usually not on PATH, and the eval is exactly how these scripts have always made it available — that still happens, unchanged. `.github/CONTRIBUTING.md` documents activating pantry for a shell, and this keeps working for anyone who has not. Verified both directions: with `zig` on PATH the guard skips the eval and `bun run fmt:check` exits 0; without it, the eval runs as before. --- package.json | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index e6f20471..9d104b07 100644 --- a/package.json +++ b/package.json @@ -14,8 +14,8 @@ ], "scripts": { "build": "bun run build:core && bun run build:sdk", - "build:core": "eval \"$(pantry env | sed -n '/^export /,$p')\" && cd packages/zig && zig build -Doptimize=ReleaseSafe -Dversion=$(bun -e \"console.log(require('../../package.json').version)\")", - "build:debug": "eval \"$(pantry env | sed -n '/^export /,$p')\" && cd packages/zig && zig build", + "build:core": "command -v zig >/dev/null 2>&1 || eval \"$(pantry env | sed -n '/^export /,$p')\"; cd packages/zig && zig build -Doptimize=ReleaseSafe -Dversion=$(bun -e \"console.log(require('../../package.json').version)\")", + "build:debug": "command -v zig >/dev/null 2>&1 || eval \"$(pantry env | sed -n '/^export /,$p')\"; cd packages/zig && zig build", "build:sdk": "cd packages/typescript && bun run build", "build:ios": "cd packages/ios && bun run build", "build:android": "cd packages/android && bun run build", @@ -31,12 +31,12 @@ "verify:packages": "bun scripts/verify-packages.ts", "verify:create": "bun scripts/verify-create-craft.ts", "verify:cimports": "bun scripts/audit-cimports.ts", - "test": "eval \"$(pantry env | sed -n '/^export /,$p')\" && cd packages/zig && zig build test", + "test": "command -v zig >/dev/null 2>&1 || eval \"$(pantry env | sed -n '/^export /,$p')\"; cd packages/zig && zig build test", "test:sdk": "cd packages/typescript && bun test", "test:native-lifecycle": "bun scripts/native-lifecycle.ts", "typecheck": "cd packages/typescript && bun run typecheck && cd ../create-craft && bun run typecheck && cd ../ts-maps && bun run typecheck", - "run": "eval \"$(pantry env | sed -n '/^export /,$p')\" && cd packages/zig && zig build run", - "run:demo": "eval \"$(pantry env | sed -n '/^export /,$p')\" && cd packages/zig && zig build run-demo", + "run": "command -v zig >/dev/null 2>&1 || eval \"$(pantry env | sed -n '/^export /,$p')\"; cd packages/zig && zig build run", + "run:demo": "command -v zig >/dev/null 2>&1 || eval \"$(pantry env | sed -n '/^export /,$p')\"; cd packages/zig && zig build run-demo", "create": "cd packages/create-craft && bun bin/cli.ts", "clean": "rm -rf packages/zig/zig-cache packages/zig/zig-out && bun run clean:packages", "clean:packages": "rm -rf packages/*/dist packages/*/node_modules", @@ -44,10 +44,10 @@ "lint:fix": "bun x --bun pickier . --fix", "format": "bun x --bun pickier . --format", "format:fix": "bun x --bun pickier . --format --write", - "fmt": "eval \"$(pantry env | sed -n '/^export /,$p')\" && cd packages/zig && zig fmt src/ build.zig", - "fmt:check": "eval \"$(pantry env | sed -n '/^export /,$p')\" && cd packages/zig && zig fmt --check src/ build.zig", + "fmt": "command -v zig >/dev/null 2>&1 || eval \"$(pantry env | sed -n '/^export /,$p')\"; cd packages/zig && zig fmt src/ build.zig", + "fmt:check": "command -v zig >/dev/null 2>&1 || eval \"$(pantry env | sed -n '/^export /,$p')\"; cd packages/zig && zig fmt --check src/ build.zig", "pantry:env": "pantry env", - "zig": "eval \"$(pantry env | sed -n '/^export /,$p')\" && zig", + "zig": "command -v zig >/dev/null 2>&1 || eval \"$(pantry env | sed -n '/^export /,$p')\"; zig", "dev": "cd packages/typescript && bun run dev", "changelog": "bun x logsmith --verbose", "changelog:generate": "bun x logsmith --output CHANGELOG.md",