Repository navigation
fix(scripts): make publish:check run on Windows - #382
Merged
Merged
Conversation
- Spawn pnpm via npm_execpath (node + pnpm's JS entry) when run under `pnpm run`; otherwise fall back to `pnpm` on PATH, through the shell on win32 where it is pnpm.cmd. - Report result.error / signal when a spawn fails instead of dereferencing an undefined stdout. - Read the packed tarballs in-process (zlib + a minimal ustar reader) instead of shelling out to tar, whose GNU flavour under Git Bash treats C:/... paths as remote hosts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Use npm_execpath only when its file name is pnpm.(c|m)js, so npm under a pnpm-managed Node is not mistaken for pnpm. - Refuse a %-containing argument on the win32 cmd.exe path instead of letting cmd expand it into a different pack directory. - Check every tar entry name (links, directories) against the forbidden patterns, as tar -tf did; skip GNU K headers. - Fail on a missing end-of-archive marker; require POSIX ustar magic before using the prefix field. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
release.yml runs it before publishing; running it on every PR exercises the script's Linux path so a change to it can't first fail at release time. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #367
pnpm run publish:checkcrashed on Windows before checking anything. This makesscripts/assert-packages-publishable.mjsportable:pnpm run,npm_execpathpoints at pnpm's JS entry, so the script runs it withprocess.execPath(no shell on any platform). Run directly (node scripts/...), it falls back topnpmon PATH, through the shell on win32 (pnpm.cmd) with a pre-quoted command line (avoids Node's DEP0190 warning for args+shell). Linux/macOS withoutnpm_execpathuse plainpnpmas before.result.errorand termination signals are reported;stdout/stderrare no longer dereferenced when undefined.tar. Tarballs are gunzipped withnode:zliband read with a small ustar reader (handlesprefix, paxpath=and GNULlong names; skips directories). No new dependencies.No CHANGELOG entry: maintainer-only tooling, nothing ships to users.
Verification (Windows 11, Git Bash, Node 24, pnpm 9.15.9)
pnpm run publish:check: passes for all 13 packages.node scripts/assert-packages-publishable.mjswithnpm_execpathunset (shell fallback): passes, no deprecation warning.packages/cli/dist/__tests__/fake.test.jsis reported (@stackbilt/cli: packed test/build-only artifacts: package/dist/__tests__/fake.test.js), exit 1.tar --force-local -tf(203 = 203).The release workflow (ubuntu) runs
pnpm run publish:check; on Linux the code path is either thenpm_execpathpath or the unchanged plainpnpmspawn.Review follow-up (second commit)
npm_execpathis used only when its file name ispnpm.cjs/pnpm.js/pnpm.mjs; npm'snpm-cli.jsunder a pnpm-managed Node (.../pnpm/nodejs/...) previously matched and would have runnpm pack.%is refused with a clear error (cmd.exe expands%VAR%inside double quotes, which sent tarballs to a different directory that cleanup missed).tar -tfdid; GNUKheaders are skipped.prefixfield is used only with POSIXustar\0+00magic.pnpm run publish:checkand the shell fallback pass; crafted archives (pax/GNU long names, ustar prefix, symlink/hardlink test files, truncated header/body/gzip, base-256 size) are listed or fail closed.Not addressed (nits): no header checksum validation; the pax parser takes the first
path=match rather than walking records; no automated tests for the reader.🤖 Generated with Claude Code