Tag logo

Update npm version automatically

May 9, 2024/
#npm
/-1 min

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.

1npm version patch
2npm version minor
3npm version major
4npm version preminor
5npm version prerelease
6npm version 1.1.4
v0.0.1
v0.1.0
v1.0.0
v1.1.0-0
v1.1.0-1
v1.1.4

Sets a new commit containing the version change. You can use the

-m
flag to customize the message.

1npm version patch
2npm version patch -m “Upgrade to %s for reasons”
3git log --oneline -2
v0.0.1
v0.0.2

606095c (HEAD -> main, tag: v0.0.2) Upgrade to 0.0.2 for reasons
ac7c881 (tag: v0.0.1) 0.0.1