What is semantic versioning?
Semantic versioning (sometimes shortened to semver) is a specification that dictates how software packages (those found on NPM, RubyGems, Composer, Nuget, etc.) should use version numbers to convey meaning about the underlying code (e.g., is it beta, alpha, stable?) and what sort of changes are introduced from one version to another (e.g., bug fixes, new functionality, breaking changes, etc.).
In short, it requires packages to use a version in the form
MAJOR.MINOR.PATCH and to increment the:
MAJORversion when backwards incompatible API changes are released.
MINORversion when new functionality / changes that are backwards compatible are released.
PATCHversion when release backwards compatible bug fixes are released.
Semantic versioning in action
7.0.0(Major): much bigger set of changes, including many API changes and deprecations.
6.1.0(Minor): mostly functionality changes that are backwards-compatible.
6.1.5(Patch): mostly bug fixes.
Many package managers (e.g., NPM, Composer, RubyGems, etc) let you specify version constraints on package using a standardized syntax.
|Exact version||Only allow the |
|Wildcard||Equivalent to |
|Hyphenated range||Equivalent to |
|Tilde version range||Equivalent to |
|Caret version range||Equivalent to |
Notable points in the spec
Here‘s the link to the full spec. Notable points are:
- Once a versioned package has been released, the contents of that version MUST NOT be modified. Any modifications MUST be released as a new version.
- Major version zero (0.y.z) is for initial development. Anything MAY change at any time. The public API SHOULD NOT be considered stable.