tUrG0n tUrG0n - 1 month ago 10x
Node.js Question

update package.json version automatically

Before I do a small release and tag it, I'd like to update the package.json to reflect the new version of the program.

Is there a way to edit the file


Would using a
git pre-release hook


npm version is probably the correct answer. Just to give an alternative I recommend grunt-bump. It is maintained by one of the guys 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

If you're using grunt anyway it might be the simplest solution.