Skip to content
BENIBIX Learn

Semantic Versioning (SemVer)

Development🚀 Product & ReleasesReleases

Also known as SemVer, MAJOR.MINOR.PATCH, Version Number

Version numbers in three parts. They say how big a change is.

Think of it like

Think of it like a traffic light for updates. The number tells you if it is safe to go.

Example

Jack's library is at 1.2.3. He adds a new option, so it becomes 1.3.0. Later he removes an old function, so it becomes 2.0.0.

Why it matters

Tools read these numbers to decide which updates are safe to install by themselves.

Definition

Semantic versioning is a rule for version numbers in three parts, like 2.4.1. The parts are MAJOR.MINOR.PATCH. You raise PATCH for a bug fix that changes nothing else. You raise MINOR for a new feature that old code can ignore. You raise MAJOR when something old stops working. So 2.4.1 to 2.5.0 should be safe, but 2.x to 3.0 may break your code.

Example code

console
$ npm version minor
v1.3.0
$ npm version patch
v1.3.1
$ npm version major
v2.0.0
Each command raises one part and resets the parts after it.

Common mistake

Putting a breaking change in a minor or patch release. Everyone who trusted the number gets a broken app.

Key takeaways

  1. 1
    Patch. A fix, nothing else.
  2. 2
    Minor. New, but old code still works.
  3. 3
    Major. Something old breaks.

Compare

Learn it properly