Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Updating the 'version' field within package.json

Tags:

npm

The package.json file usually starts with name, version, scripts, dependencies. My questions is should I update the version manually , say, every time I make a release on GitHub?

While doing npm init, the version within package.json is defaulted to 0.0.0. As my app grows, should I update it evey now and then viz. 1.0.0, 2.0.1 etc.

NOTE: This is not regarding the version of different packages/dependencies but for the app itself.

like image 494
Hyperbola Avatar asked Mar 10 '26 00:03

Hyperbola


1 Answers

The package version is mostly relevant when you actually publish your module on a public (or private) repository. You might also want to use it for yourself or within your company to communicate code changes in a standard way, called semantic versioning: https://semver.org/. But that's up to you.

There is even a command for that: npm version

# From 1.0.0 -> 1.0.1
npm version patch 

# From 1.0.1 -> 1.1.0
npm version minor

# From 1.1.0 -> 2.0.0
npm version major

Details: https://docs.npmjs.com/cli/version

like image 97
pintxo Avatar answered Mar 12 '26 22:03

pintxo



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!