


By doing so, you'll face less breaking changes at the same time and keep a better control of the changes you'll introduce. I suggest you to update them once every month or at least once every 2 months. Add a preversion or postversion script to package.json with the commands you’d like to run before or after bumping the version.įor example, you could run the safety checks mentioned above in a preversion script so npm will only bump the version if the tests pass.If you want to keep your project secure, fast and enjoy the latest features of all your dependencies, it's important to keep them regularly up-to-date. However, an advantage of using npm version is you can configure it to run additional commands. Commit the changes you just made: git commit -am 'Bump version to 2.1.0'.Update the version number to 2.1.0 in package.json & package-lock.json.

For example, here’s what you would do for a minor release from version 2.0.0: You could do this all by hand, if you prefer. Then npm will update the appropriate part of your version number: npm version minor You’ll need to tell npm what type of release this is by specifying a valid semantic versioning type, such as major, minor, or patch. It will also create a version commit and a new Git tag. This will automatically update the version number in package.json and package-lock.json. The easiest way to update your version number is to use the handy npm version command.
