Repository navigation
fix(publish): report the version from the re-read manifest - #10202
Open
ShryukGrandhi wants to merge 1 commit into
Open
ShryukGrandhi wants to merge 1 commit into
ShryukGrandhi wants to merge 1 commit into
Conversation
Signed-off-by: ShryukGrandhi <85529990+ShryukGrandhi@users.noreply.github.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.
Summary
When a
prepublishOnlyscript bumps the version (e.g.npm version patch),npm publishuploads the new version but prints the old one in the tarball details and the final+ pkg@versionline.The publish command reads the manifest, runs
prepublishOnly, packs, and then re-reads the manifest so the latestpackage.jsonis sent to the registry. The tarball summary (pkgContents) was computed from the first read, so its name/version/filename were stale.Changes
lib/commands/publish.js: computepkgContentsafter the manifest is re-read instead of before.test/lib/commands/publish.js: add a test whereprepublishOnlybumps the version from 1.0.0 to 1.0.1 and assert the output shows1.0.1.Testing
@npmcli/test-package@1.0.0) and passes after.node node_modules/.bin/tap --no-coverage test/lib/commands/publish.js test/lib/commands/stage/index.jspasses.npx eslint lib/commands/publish.js test/lib/commands/publish.jsis clean.Fixes #2756