May 10, 2024 /
1 min /
#npm
#package-management
#versioning
Update NPM package version automatically
If you don’t like to manually increase the version from package.json when dealing with NPM packages, you can use the npm version command.
> npm version patch> npm version minor> npm version major> npm version preminor> npm version prerelease> npm version 1.1.4
v0.0.1v0.1.0v1.0.0v1.1.0-0v1.1.0-1v1.1.4 Sets a new commit containing the version change. You can use the -m flag to customize the message.
> npm version patch> npm version patch -m "Upgrade to %s for reasons"> git log --oneline -2
v0.0.1v0.0.2
606095c (HEAD -> main, tag: v0.0.2) Upgrade to 0.0.2 for reasonsac7c881 (tag: v0.0.1) 0.0.1