Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] npm version prerelease does not work with numeric --preid #3181

Closed
ntkme opened this issue May 3, 2021 · 2 comments · Fixed by npm/node-semver#380
Closed

[BUG] npm version prerelease does not work with numeric --preid #3181

ntkme opened this issue May 3, 2021 · 2 comments · Fixed by npm/node-semver#380
Assignees
Labels
Bug thing that needs fixing Enhancement new feature or improvement Release 7.x work is associated with a specific npm 7 release

Comments

@ntkme
Copy link

ntkme commented May 3, 2021

Currently --preid only works correctly with non-numeric value. I have actually root caused it down to a bug in npm/node-semver and submitted a PR to fix it: npm/node-semver#380. I'm opening this issue for tracking purpose and hopefully to get some attention from the npm team.

Current Behavior:

Case 1:

$ cat package.json
{
  "name": "test",
  "version": "1.0.0-2021.0"
}

$ npm version prerelease --preid 2021
npm ERR! Version not changed

Case 2:

$ cat package.json
{
  "name": "test",
  "version": "1.0.0-2021.1"
}

$ npm version prerelease --preid 2021
v1.0.0-2021.0

Expected Behavior:

Case 1:

$ cat package.json
{
  "name": "test",
  "version": "1.0.0-2021.0"
}

$ npm version prerelease --preid 2021
v1.0.0-2021.1

Case 2:

$ cat package.json
{
  "name": "test",
  "version": "1.0.0-2021.1"
}

$ npm version prerelease --preid 2021
v1.0.0-2021.2

Environment:

$ node --version
v16.0.0
$ npm --version
7.10.0
@ntkme ntkme added Bug thing that needs fixing Needs Triage needs review for next steps Release 7.x work is associated with a specific npm 7 release labels May 3, 2021
@darcyclarke darcyclarke added Enhancement new feature or improvement Bug thing that needs fixing and removed Bug thing that needs fixing Needs Triage needs review for next steps labels Jun 11, 2021
@darcyclarke
Copy link
Contributor

Actions:

  • should support numeric --preids
  • should error out more appropriately

@ntkme
Copy link
Author

ntkme commented Jun 11, 2021

The semver spec says numeric should be supported:

<pre-release identifier> ::= <alphanumeric identifier>
                           | <numeric identifier>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug thing that needs fixing Enhancement new feature or improvement Release 7.x work is associated with a specific npm 7 release
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants