Tuesday, January 17, 2017

Semantic Versioning

Nodejs, bower etc all use Semantic Versioning for release version management.

Semantic Versioning, its main idea is to define the versioning rules for product release. It has 3 parts:

Major.Minor.Patch (x.y.z)

MAJOR version when you make incompatible API changes,
MINOR version when you add functionality in a backwards-compatible manner, and
PATCH version when you make backwards-compatible bug fixes.

When we give the versioning, we need follow the rules. Initial development is suggested to use 0.y.z till it is ready for production (1.y.z)

When we declare package dependencies, we have different kinds of formats.
  • latest -> Takes the latest version possible. Not the safest thing to use.
  • ~1.2.3 -> Any version “reasonably close to 1.2.3”. This will call use all versions up to, but less than 1.3.0
  • ^1.2.3 -> Any version “compatible with 1.2.3”. This will call versions up to the next major version like 2.0.0. Could break your application if there are major differences in the next major version.
  • 1.2.3 - 1.2.5 -> Anything within a range of versions. The equivalent of >=1.2.3 and <=1.2.5
  • * -> Wildcards. Can be any version at all. 
It is highly recommended to use ~1.2.3 format when declare package dependencies.
It is highly recommended to follow semantic versioning rules to define your owner package version.

No comments:

Post a Comment