Rizwan Liaqat
Rizwan Liaqat

Reputation: 85

How to update the value of version key in package.json

I use git flow to manage my work flow on git. I use yarn but I can't seem to find any answer on how to update the version in my package.json

I guess there must be some way to bump up the version when I merge/create a release branch. I name my release branches as release/v3.23.3 but since that's not a rule so apparently git doesn't care. Please tell me a good way to bump up the release version.

Upvotes: 1

Views: 2326

Answers (1)

VonC
VonC

Reputation: 1326766

Dafna Rosenblum recommends:

npm-version

After creating the release branch, you should running ./bump-version.sh.
This is a fictional script that updates the version number of the project.

As I mentioned, the Git Flow article is from January 2010. This is also the month NPM was first released (coincidence??), and I prefer using npm-version like below:

npm version patch

The output will be the new version number.
A commit will be added to the branch with the new version updated in the package.json and package-lock.json files.

An alternative to npm-version is the popular tool release-it, that can bump version, create tags and releases, and more.

Upvotes: 1

Related Questions