Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

How can versioning in the package.json file of npm packages be understood?

How can versioning in the package.json file of npm packages be understood?

Problem

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",
    ...
}
Problem courtesy of: Filipe

Solution

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

Solution courtesy of: alex

Discussion

View additional discussion.



This post first appeared on Node.js Recipes, please read the originial post: here

Share the post

How can versioning in the package.json file of npm packages be understood?

×

Subscribe to Node.js Recipes

Get updates delivered right to your inbox!

Thank you for your subscription

×