Semantic Versioning (SemVer)
Versioning
Semantic Versioning uses the format MAJOR.MINOR.PATCH
to indicate different types of changes in a software package.
MAJOR
version is updated when we make incompatible API changes.MINOR
version is updated when we add functionality in a backwards compatible manner.PATCH
version is updated when we make backwards compatible bug fixes and updates.
NPM Dependency Version
In Node Package Manager (NPM), there are several ways to specify dependencies in a package.json file.
version
: This must match the exact version specified.>version
,>=version
,<version
,<=version
: This specifies a range of versions.~version
: This matches the specified version and any patches above it, but not the next major version.^version
: This matches the specified version and any minor or patch releases above it, but not the next major version.1.2.x
: This matches any patch release within the specified major and minor versions.*
: This matches any version.
Ranges
The following examples show how ranges can be specified:
~1.2.3
: This matches any patch release within the1.2.x
range.^1.2.3
,^1.2
,1.x
,1.*
,^1
,1
: These all match any release within the1.x
range, including minor and patch releases, but not the next major version.