How to bump versions in NPM

How to bump versions in NPM

Deciding on a versioning strategies for your JavaScript acts can be a daunting task. Not only can you do it a few different ways, trying to stay consistent, especially when working with a large team, can be difficult.

Recently, I need to start an NPM package for our companies shared component library and style guide. I stumbled upon a feature that NPM added fairly recently:

npm version

This is a robust version bumping tool that is built in to NPM. No other dependencies needed. By running

npm version patch

NPM will increment the patch version in the package.json file for you. In addition, it will commit that change to your git repository, and tag the version appropriately.

NPM supports a variety of other keywords to help bump the correct version, including major , minor, or even a custom version like 1.2.3

To learn more about the version command in NPM, look here

Show Comments