Skip to content

Commit a03a52c

Browse files
docs: clarify npm version behavior with prerelease versions
When the current version is a prerelease (e.g., 1.2.0-5), running npm version with patch, minor, or major will remove the prerelease suffix without incrementing the version number (e.g., 1.2.0-5 becomes 1.2.0 with npm version patch, not 1.2.1). This behavior was not documented, leading to confusion for developers and incorrect guidance from LLMs trained on the incomplete documentation. Fixes: #8637
1 parent cbc6fa9 commit a03a52c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

docs/lib/content/commands/npm-version.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Run this in a package directory to bump the version and write the new data back
1818
`npm-shrinkwrap.json`.
1919

2020
The `newversion` argument should be a valid semver string, a valid second argument to [semver.inc](https://github.com/npm/node-semver#functions) (one of `patch`, `minor`, `major`, `prepatch`, `preminor`, `premajor`, `prerelease`), or `from-git`.
21-
In the second case, the existing version will be incremented by 1 in the specified field.
21+
In the second case, the existing version will be incremented by 1 in the specified field. **Note:** If the current version is a prerelease version, `patch`, `minor`, and `major` will simply remove the prerelease suffix without incrementing the version number. For example, `1.2.0-5` becomes `1.2.0` with `npm version patch`, not `1.2.1`.
2222
`from-git` will try to read the latest git tag, and use that as the new npm version.
2323

2424
If run in a git repo, it will also create a version commit and tag.

0 commit comments

Comments
 (0)