All cheatsheets

Cheatsheets

Semver

Semantic-versioning format and npm range operators.

22 entries

Version format7

MAJOR.MINOR.PATCH

e.g. 2.4.1 — semantic version structure

MAJOR

Breaking changes (incompatible API)

MINOR

New features, backwards-compatible

PATCH

Backwards-compatible bug fixes

1.0.0-alpha.1

Pre-release version (lower precedence)

1.0.0+build.5

Build metadata (ignored in precedence)

0.x.y

Pre-1.0 — anything may change at any time

Ranges (npm)9

^1.2.3

Compatible: >=1.2.3 <2.0.0 (minor/patch)

~1.2.3

Approximately: >=1.2.3 <1.3.0 (patch)

1.2.x / 1.2.*

Any patch of 1.2

1.x

Any minor/patch of 1 (>=1.0.0 <2.0.0)

* / latest

Any version / newest dist-tag

>=1.2.3 <2.0.0

Explicit comparator range

1.2.3 - 1.5.0

Hyphen range (inclusive)

1.2.3 || >=2.0.0

OR — match either range

^0.2.3

Special: >=0.2.3 <0.3.0 (0.x pins minor)

npm tooling6

npm version patch|minor|major

Bump version + git tag

npm version prerelease --preid=beta

Cut a beta pre-release

npm outdated

Show packages with newer versions

npm update

Update within the allowed ranges

npm dist-tag add pkg@1.2.3 latest

Point a dist-tag at a version

npx semver 1.2.3 -r "^1.0.0"

Test if a version satisfies a range