Reputation: 3207
I need to update the version number in my package.json file when I release it from github. Is there any method for that also can I set the newly created tag version as version number in package.json
Upvotes: 5
Views: 3868
Reputation: 23778
There are some libraries that automate this process. One of them is release-it.
https://github.com/release-it/release-it
This package automatically bumps up the version number in the package.json and create a new brnach/tag. It also automates pushing to NPM, creating change log, cd/ci etc.
"name": "my-package",
"version": "1.0.0",
"scripts": {
"release": "release-it"
},
"devDependencies": {
"release-it": "*"
}
}
then
npm run release
or
npm run release -- minor --ci
Upvotes: 3