fix(ruvector): verify-dist guards package.json entrypoints (#376)#433
Open
fix(ruvector): verify-dist guards package.json entrypoints (#376)#433
Conversation
`verify-dist.js` was added after #399 to fail the publish when files required by `bin/cli.js` weren't built. It would NOT have caught #376 because that regression hit `package.json#main` (`dist/index.js`) — a path the previous guard never inspected. The published 0.2.23 declared `main: dist/index.js` but shipped without it, so every consumer doing `require('ruvector')` or `await import('ruvector')` crashed. Strengthen the guard to also check: - package.json `main`, `types`, `module`, and every `bin.*` entry resolves to a real file under the package root. - The `main` entry actually loads — `node -e "require(<main>)"` runs as a final smoke (skippable via VERIFY_DIST_SKIP_SMOKE=1 for emergencies). Verified end-to-end against ruvector@0.2.25 on Node 22.22.2: $ node scripts/verify-dist.js verify-dist: 13 dist path(s) referenced by bin/cli.js present. verify-dist: 3 package.json entrypoint(s) present. verify-dist: require('dist/index.js') smoke OK. $ mv dist/index.js dist/index.js.bak # simulate the #376 regression $ node scripts/verify-dist.js verify-dist: package would publish broken: - 1 dist file(s) referenced by bin/cli.js are missing: - dist/index.js - 1 package.json entrypoint(s) point at missing files: - main → dist/index.js exit code: 1 The current 0.2.25 tarball already includes `dist/index.js`, so end users on the latest release are not affected; this PR is the regression guard that would have prevented the publish in the first place. Closes #376 Co-Authored-By: claude-flow <ruv@ruv.net>
6 tasks
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.
Summary
ruvector@0.2.23was published withmain: dist/index.jsdeclared but the file absent from the tarball, so any consumer doingrequire('ruvector')orawait import('ruvector')crashed on a fresh install.dist/index.js(so end users on the latest release are not affected). This PR adds the regression guard that would have stopped the broken 0.2.23 publish in the first place.Why this PR is still needed
scripts/verify-dist.jswas added after #399 but only audits therequire('../dist/...')calls insidebin/cli.js. It never looked atpackage.json#main, so a regression on the package's library entrypoint would slip through again.Fix
package.json#main,types,module, and everybin.*entry againstfs.existsSyncunder the package root.require('<main>')smoke check as a final step. Skippable withVERIFY_DIST_SKIP_SMOKE=1for emergency publishes.Proof
Passing run on the current 0.2.25 working tree:
Simulating the original #376 regression (rename
dist/index.jsaway):End-to-end pack of the current 0.2.25 tarball into a clean
/tmpdir:Test plan
dist/index.jsis removed (simulated npm package fails to import in 0.2.23 because published tarball is missing dist/index.js #376).npm packactually containsdist/index.js.import()and CJSrequire()work against the packed tarball.VERIFY_DIST_SKIP_SMOKE=1honored as an emergency escape hatch.🤖 Generated with claude-flow