How to update package.json version automatically ?
The perfect answer is npm version.
In this grunt-bump is an alternative.
It is maintained from angular.js.
grunt bump >> Version bumped to 0.0.2 grunt bump:patch >> Version bumped to 0.0.3 grunt bump:minor >> Version bumped to 0.1.0 grunt bump >> Version bumped to 0.1.1 grunt bump:major >> Version bumped to 1.0.0
This wil be useful:
npm version patch git add *; git commit -m "Commit message" git push npm publish
- The first line, npm version patch, will increase the patch version by 1 (x.x.1 to x.x.2) in package.json.
- Then we can add all files — including package.json which at that point has been modified.
- Then, the usual git commit and git push, and finally npm publish to publish the module.