Cheatsheets
Semver
Semantic-versioning format and npm range operators.
22 entries
Version format7
MAJOR.MINOR.PATCHe.g. 2.4.1 — semantic version structure
MAJORBreaking changes (incompatible API)
MINORNew features, backwards-compatible
PATCHBackwards-compatible bug fixes
1.0.0-alpha.1Pre-release version (lower precedence)
1.0.0+build.5Build metadata (ignored in precedence)
0.x.yPre-1.0 — anything may change at any time
Ranges (npm)9
^1.2.3Compatible: >=1.2.3 <2.0.0 (minor/patch)
~1.2.3Approximately: >=1.2.3 <1.3.0 (patch)
1.2.x / 1.2.*Any patch of 1.2
1.xAny minor/patch of 1 (>=1.0.0 <2.0.0)
* / latestAny version / newest dist-tag
>=1.2.3 <2.0.0Explicit comparator range
1.2.3 - 1.5.0Hyphen range (inclusive)
1.2.3 || >=2.0.0OR — match either range
^0.2.3Special: >=0.2.3 <0.3.0 (0.x pins minor)
npm tooling6
npm version patch|minor|majorBump version + git tag
npm version prerelease --preid=betaCut a beta pre-release
npm outdatedShow packages with newer versions
npm updateUpdate within the allowed ranges
npm dist-tag add pkg@1.2.3 latestPoint a dist-tag at a version
npx semver 1.2.3 -r "^1.0.0"Test if a version satisfies a range