Question

I want to know how the versioning works in package.json in a development cycle.

What is the meaning of each number in one package.json version property, such as the one below?

{
    "name": "A NodeJS Project",
    "version": "0.0.0",
    ...
}
Was it helpful?

Solution 2

It's not semver. It's semver-looking version number. Package version is not required to follow semantics of semver, it's just sorted like semver.

Usually these three digits have this meaning:

  • First number called major is incremented when there are big changes that will very likely require substantial changes to your application on an update.

  • Second number called minor is incremented when there are small changes that mostly backward compatible. It might break some applications, but it's an exception.

  • Third number called micro is incremented almost every time a new version is pushed to npm. It is considered a bad practice to include breaking changes in micro updates, but even npm itself do it sometimes.

But it is not set in stone, and basically you can pick every version number you want. For example, esprima-fb package uses versioning like this: 1001.1001.2000-dev-harmony-fb. These numbers have meaning too, but it's obviously not semver.


edit: I would like to include balupton's definition of version numbers from twitter, since it does reflect current status quo more precisely.

  • revisions = no b/c breaks
  • minors = b/c breaks for some
  • majors = b/c breaks for everyone

... where b/c means backward compatibility

OTHER TIPS

The package.json files used by npm follow the semantic versioning model. It follows the major.minor.patch pattern. There is a whole site dedicated to explaining the semantic versioing process at http://semver.org/. You should also have a look at the npm version man page, which gives a few more details: https://npmjs.org/doc/cli/npm-version.html.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top