npm / npm/cli

[BUG] Changing version in prepublishOnly-Script has incorrect output

Open
#2,756 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Bug Priority 2 Release 7.x
Dominant language
JavaScript
Stars
10.1k
Forks
4.7k
Avg merge
2d 2h
Merged PRs (30d)
19

Description

Current Behavior:

I have a prepublishOnly script like "npm version patch". However, npm tries to publish with previous version.

Expected Behavior:

Version of published package should be incremented (like it was for npm@6)

Steps To Reproduce:

Yeah, put a "prepublishOnly" script into package.json:

scripts: {
...
"prepublishOnly": "npm version patch",
...
}
Environment:
  • npm: 7.5.5

Two notes:

  • as mentioned above, with npm@6 this worked fine
  • although the package would be published with the old version number, a git tag of the new one is commit'ed - which is a mess, of course

Edit: hmmm, when I tested with verdaccio, it seems the upload is right - it's only the output (version and tgz name) - nevertheless, that's still a mess ;-)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the behavior with a package.json prepublishOnly script containing "npm version patch" under npm 7.5.5, then compare the displayed version and tgz name with npm@6. Check the result against the reported Verdaccio behavior: publishing appears to use the new version, while the output may still show the old one; done means the output is consistent with the published package and git tag.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, nodejs
Domain
cli, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.