← Back to Note

Understanding Semantic Versioning

Prakash Pun

Prakash Pun - April 22, 2023

2 min read

Semantic Versioning

Semantic versioning, known as SemVer, is a versioning system for software libraries, frameworks, and applications. It provides a standardized way of defining and communicating changes to software versions in a clear and predictable manner. It uses a three-part version separated by dots i.e. MAJOR.MINOR.PATCH1.4.2. These numbers represent different levels of changes made to the software.

SemVer
SemVer

MAJOR, is incremented when there are major changes to the software that are not backward compatible. This could include changes to the API, major feature additions, or restructuring of the codebase.

npm version major

MINOR, is incremented when there are minor changes to the software that are backward compatible. This could include the addition of new features or functionality, bug fixes, or small improvements.

npm version minor

PATCH, is incremented when there are minor changes to the software that is backward compatible and do not add any new features. This could include bug fixes or minor improvements.

npm version patch

Semantic Versioning also allows for the use of pre-release version numbers and build metadata. Pre-release version numbers are indicated by appending a hyphen and a series of alphanumeric characters to the end of the version number. Build metadata is indicated by appending a plus sign and a series of alphanumeric characters to the end of the version number.

Code StatusStageRuleExample version
First releaseNew productStart with 1.0.01.0.0
Backward compatible bug fixesPatch releaseIncrement the third digit1.0.1
Backward compatible new featuresMinor releaseIncrement the middle digit and reset last digit to zero1.1.0
Changes that break backward compatibilityMajor releaseIncrement the first digit and reset the middle and last digits to zero2.0.0

Sign
Sign

With the help of the Semantic Versioning system, developers and users can more easily grasp the effects of updates and upgrades by communicating changes to software versions in a clear and concise manner. Additionally, it minimizes the chance of compatibility issues by ensuring that various software components can function together seamlessly.