TypeScript

How Version Control Numbering Works?

Every project needs version numbers eventually. You can invent your own system, but then every developer on your team has to learn it. Semantic Versioning...

13 Oct 2023

How Version Control Numbering Works?

Every project needs version numbers eventually. You can invent your own system, but then every developer on your team has to learn it. Semantic Versioning (SemVer) solves this by giving everyone a shared language.

The format: MAJOR.MINOR.PATCH

  • MAJOR — breaking changes. Your existing code might not work with this update.
  • MINOR — new features. Everything that worked before still works.
  • PATCH — bug fixes. No new features, no breaking changes.

Example: 3.1.4 means major version 3, minor version 1, patch 4.

Why this matters

Without a versioning standard, dependency management is guesswork. With SemVer, package managers can make safe decisions automatically.

Say your project depends on a library called "Ladder" at version 3.1.0. You use features introduced in 3.1.0. With SemVer, you can safely declare your dependency as >=3.1.0 <4.0.0. Any 3.x.x release should be backward compatible. A 4.0.0 release might break things, so you stop there.

When Ladder publishes 3.1.1 (a bug fix) or 3.2.0 (a new feature), your package manager knows it's safe to upgrade. When 4.0.0 drops, it waits for you to manually review the breaking changes.

The trade-off

SemVer only works if maintainers follow the rules honestly. A bug fix that accidentally breaks something should have been a major bump. A "minor" release that changes behavior isn't really minor.

In practice, even well-maintained libraries occasionally get this wrong. That's why you should still test your dependencies after upgrading, even within the same major version.

SemVer doesn't eliminate the problem. It reduces it to a manageable size.