Repository navigation
fix(pkg): declare bin without a "./" prefix - #55
Merged
Merged
Conversation
npm normalises every bin value through secureAndUnixifyPath. The leading "./" made the normalised path differ from the declared one, so every publish printed a warning whose wording matches the ones that really do drop a bin. Nothing was ever removed. Closes #46. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Verified by restoring the prefix and watching the suite fail. 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.
Closes #46.
Nothing was ever removed
@npmcli/package-json/lib/normalize.js, the code that emits the warning:The line after the message assigns the corrected value. The three branches that genuinely drop a bin are all above it and all say
removed invalid "bin[...]"— none of them fired here.So the message is inaccurate twice over: it says removed for what is a rewrite, and it prints the corrected path as the thing that "was invalid". That is why it never matched the declared value and read as unexplained.
The registry confirms it —
0.3.2and0.4.0both published with"bin": {"rainfall": "bin/rainfall.js"}intact.Why fix it anyway
The wording is shape-identical to the warnings that do drop a bin. Leaving it printing on every release is exactly the noise that hides a real one later — and this package has shipped three versions that could not be imported while the suite was green.
Change
package.json:"rainfall": "bin/rainfall.js"(was"./bin/rainfall.js")__tests__/package.test.js: fails if anybintarget regains the prefixexportsis deliberately untouched — Node's spec requires./there. The guard targetsbinonly.Verification
npm publish --dry-runbefore"bin[rainfall]" script name ... invalid and removednpm publish --dry-runafternpm pkg fixon the old manifest./vs plain)npm pack→ install into clean project.bin/rainfall -> ../@morf_engineering/rainfalljs/bin/rainfall.js,rainfall componentsrunsNo version bump: the published metadata is already the normalised form, so this changes nothing for consumers. It rides the next release.
🤖 Generated with Claude Code