Your understanding is mostly correct
When you execute the npm version
command the following is done:
- bump package version as directed in
package.json
- create a commit containing only the update to
package.json
with the message specified when invoking npm version
.
- create a git tag
You can then execute npm publish
to publish to the npm registry, and git push your tag to your remote repository when you see fit
The long answer
As for the exact commands that our executed as you expressed interest in this via comments:
adding the files to staging:
git add /path/to/package.json
See source.
If lock and shrinkwrap package files are also present they are also added as above!
creation of the commit:
git commit -m {version message}
See source.
as for creation of the tag:
git tag {version no.} -am {version message}
or if signing is turned on:
git tag {version no.} -sm {version message}
See source.
For reference the version message
is optional, if it is excluded from the CLI input then it will default to have the value of version no.
.