Amade
Amade

Reputation: 3968

npm semantic versioning in package.json - does it work only from version 1.0.0 and up?

I noticed that even though I have specified version ^0.5.5 of v-calendar library, and as of today version 0.6.3 is available, when I run npm update, the package is not updated.

When I test the version ^0.5.5 in npmsemver calculator, only version 0.5.5 is in green, meaning that npm ignores versions 0.6.x and up.

Am I correct in assuming that semantic versioning with npm works only if the package is on version 1.0.0 and up?

npm docs specify that:

If a project is going to be shared with others, it should start at 1.0.0, (though some projects on npm don't follow this rule).

but I couldn't find anything there saying that semantic versioning won't work if you release a package starting at version 0.x.x.

Upvotes: 3

Views: 659

Answers (1)

jwdonahue
jwdonahue

Reputation: 6659

See https://docs.npmjs.com/misc/semver#caret-ranges-123-025-004

The caret range is keyed on the left most non-zero value. This conforms with the common practice of shifting the SemVer rules one field to the right for experimental versions (0.y.z) such that the Y field is incremented for known breaking changes and the Z field is used for new features and bug fixes. It is an historical artifact that should be eliminated from the standard in my opinion.

Upvotes: 2

Related Questions