Skip to content

fix: resolve node bins via package.json instead of spawning npx .cmd shims so verify/smoke scripts run on Windows - #1997

Draft
olaservo wants to merge 1 commit into
v2/mainfrom
v2/fix/1939-typecheck-coverage-windows
Draft

fix: resolve node bins via package.json instead of spawning npx .cmd shims so verify/smoke scripts run on Windows#1997
olaservo wants to merge 1 commit into
v2/mainfrom
v2/fix/1939-typecheck-coverage-windows

Conversation

@olaservo

Copy link
Copy Markdown
Member

Closes #1939

npx/npm are .cmd shims on Windows and Node refuses shell-less .cmd spawns, so validate/ci died at verify:typecheck-coverage — silently, as a bogus "918 files get no tsc pass" report. This adds a shared scripts/lib/resolve-node-bin.mjs (resolves a package's bin via its package.json, spawned with process.execPath) and patches all seven affected call sites across the verify/smoke/pack scripts; a resolution failure is now a hard "cannot resolve — run npm install" error instead of an empty file set. Verified on Windows: test:scripts 94/94 (+7 new tests incl. a regression pin), verify:typecheck-coverage and verify:build-gate green. Full root-cause in the issue comment.

🤖 Generated with Claude Code

…shims so the verify/smoke scripts run on Windows

On Windows npx/npm are .cmd shims a shell-free execFileSync/spawnSync
cannot start (ENOENT since the CVE-2024-27980 hardening), so
verify:typecheck-coverage died at validate's second step — doubly
silently, echoing "(no diagnostic captured)" per project and then
reporting all 918 tracked files as getting no tsc pass — and
verify:build-gate, the smoke test-server bootstraps, and pack:verify's
npm pack failed the same way.

Add scripts/lib/resolve-node-bin.mjs: resolves the JS entry behind a
package's bin from <pkg>/package.json (deep resolution is blocked by
Vite 8's exports map) and spawns it via process.execPath — the same
walk npx --no-install did, cross-platform and shell-free. Switch the
six npx call sites to it; the npm pack call gets the existing
shell-on-win32 idiom instead (npm has no in-tree package to resolve).
An unresolvable tsc is now a hard "cannot measure" error with
actionable stderr, pinned by a new main() regression test.

Closes #1939

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@olaservo olaservo added the v2 Issues and PRs for v2 label Aug 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

v2 Issues and PRs for v2

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant