Skip to content

ci: build before npm publish reads the manifest - #58

Merged
cardmagic merged 1 commit into
mainfrom
fix/publish-bin-warning
Sep 23, 2026
Merged

cardmagic merged 1 commit into
mainfrom
fix/publish-bin-warning

Conversation

@cardmagic

Copy link
Copy Markdown
Owner

Why

Every release logs this twice:

npm warn package-json solid-objects@0.16.0 No bin file found at dist/executable.js

The package was never broken

I checked before changing anything, because the warning reads like a shipped defect:

Check Result
package/dist/executable.js in the published 0.16.0 tarball present
node_modules/.bin/solid-objects after npm install solid-objects@0.16.0 links to ../solid-objects/dist/executable.js
npx solid-objects --help from a clean consumer install prints usage

So 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 bin against the working tree when it reads the manifest. The publish job left the build to prepack, which npm runs afterwards:

22:38:11  npm warn ... No bin file found at dist/executable.js
22:38:22  npm notice 📦  solid-objects@0.16.0

Eleven seconds apart. dist/ did not exist yet at validation time.

Reproduced locally: rm -rf dist && npm publish --dry-run warns twice; after pnpm run build it warns zero times.

Fix

The publish job builds before it invokes npm, and publishes with --ignore-scripts so 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.mjs asserted dist/executable.js by name, so pointing bin at a path the build does not produce still passed. Demonstrated by renaming the target: the old check exited 0. It reads the manifest now:

Error: bin solid-objects points at dist/renamed-cli.js, which the build does not produce

Validation

pnpm run pack:check, pnpm test (528 passed), pnpm run check, prettier --check — all clean.

🤖 Generated with Claude Code

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>
@greptile-apps

greptile-apps Bot commented Sep 23, 2026

Copy link
Copy Markdown

RetriggerConfidence Score: 5/5

The PR appears safe to merge, with the explicit build fully replacing the only lifecycle action skipped during publishing.

Summary

This PR prevents npm’s misleading missing-bin warning by building before manifest validation and avoiding the redundant prepack build. It also makes package validation follow the manifest-declared binary targets.

  • Builds distribution artifacts before invoking npm publish.
  • Uses --ignore-scripts after explicitly performing the sole prepack action.
  • Validates every manifest-declared binary for existence and executable permissions.
  • Documents the release-process correction in the changelog.

Reviews (1) · Last reviewed commit: "ci: build before npm publish reads the m..."

@cardmagic
cardmagic merged commit db12476 into main Sep 23, 2026
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant