Semantic Versioning

Semver is used in popular package managers like npm/yarn to help manage changes and breakage. However, it does not necessarily succeed in doing so[5].

Semantic versioning uses the following formula:

1.2.3 -> MAJOR.MINOR.PATCH

Given a version number MAJOR.MINOR.PATCH, increment the:

MAJOR version when you make incompatible API changes MINOR version when you add functionality in a backwards compatible manner PATCH version when you make backwards compatible bug fixes[1]

Or put another way:

Ranges

Greater than/less than is the way to most clearly specify ranges.

The following are sugar for the above so you don't have to write so much.

Alternatives

One complaint raised by Rich Hickey[5] is that semantic version doesn't actually have very strong semantic properties, especially as it relates to other packages. How does package foo@1.2.3 relate to bar@100.200.300? Is one newer than the other? Is it up to date?

What Rich proposes is a shift in how we think about creating our software and libraries, and this necessitates a change in versioning, which I'm calling FAR versioning.

References

  1. https://semver.org/
  2. https://github.com/npm/node-semver
  3. Semver cheatsheet
  4. Semver: Tilde and Caret - NodeSource
  5. Spec-ulation Keynote - Rich Hickey
Incoming Links

Last modified: 202401040446