ci: build before npm publish reads the manifest - #58
Merged
Merged
Conversation
Every release logged this twice:
npm warn package-json solid-objects@0.16.0
No bin file found at dist/executable.js
npm validates `bin` against the working tree, and the publish job left
the build to `prepack`, which npm runs eleven seconds later. The
published package was never wrong: `package/dist/executable.js` is in
the 0.16.0 tarball, `node_modules/.bin/solid-objects` links to it, and
`npx solid-objects --help` prints usage from a clean consumer install.
Only the warning was wrong, and it reads like a broken package.
The job now builds before it invokes npm and publishes with
`--ignore-scripts`, so the build runs once instead of twice. A dry run
produces the same 377 files the published 0.16.0 contains.
`check-package.mjs` asserted `dist/executable.js` by name, so pointing
`bin` at a path the build does not produce still passed. It reads the
manifest now and fails with:
bin solid-objects points at dist/renamed-cli.js,
which the build does not produce
Validation: pnpm run pack:check, pnpm test (528), check, format:check.
Co-Authored-By: Claude Opus 5 (1M context) <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.
Why
Every release logs this twice:
The package was never broken
I checked before changing anything, because the warning reads like a shipped defect:
package/dist/executable.jsin the published 0.16.0 tarballnode_modules/.bin/solid-objectsafternpm install solid-objects@0.16.0../solid-objects/dist/executable.jsnpx solid-objects --helpfrom a clean consumer installSo this is a warning defect, not a packaging defect. It still deserves fixing: a message that says the binary is missing, printed while publishing that binary, will send the next person chasing nothing.
Cause
npm validates
binagainst the working tree when it reads the manifest. The publish job left the build toprepack, which npm runs afterwards:Eleven seconds apart.
dist/did not exist yet at validation time.Reproduced locally:
rm -rf dist && npm publish --dry-runwarns twice; afterpnpm run buildit warns zero times.Fix
The publish job builds before it invokes npm, and publishes with
--ignore-scriptsso the build runs once rather than twice. A dry run produces the same 377 files the published 0.16.0 contains.Regression guard
check-package.mjsasserteddist/executable.jsby name, so pointingbinat a path the build does not produce still passed. Demonstrated by renaming the target: the old check exited 0. It reads the manifest now:Validation
pnpm run pack:check,pnpm test(528 passed),pnpm run check,prettier --check— all clean.🤖 Generated with Claude Code