semver
Validate and manipulate semantic version strings
TLDR
SYNOPSIS
semver [options] version [version ...]
DESCRIPTION
semver validates, compares, and manipulates semantic version strings following the semver.org specification. It provides version incrementing (bumping major, minor, patch, or prerelease components), range matching using NPM-style range syntax, and version sorting.Range matching tests whether versions satisfy constraints like >=1.0.0 <2.0.0, ^1.2.3, or ~1.2.3, using the same range syntax as npm's package.json version specifiers. Coercion converts non-standard version strings like "v1.2" into valid semver format (1.2.0). Multiple versions passed as arguments are printed in sorted order.
PARAMETERS
-i, --increment TYPE
Increment version by specified level. Default level is patch.-r, --range RANGE
Print versions that match the specified range.-c, --coerce
Coerce a string into a valid semver if possible.-l, --loose
Interpret versions and ranges loosely.-p, --include-prerelease
Always include prerelease versions in range matching.--preid IDENTIFIER
Identifier for prerelease version increments.-n BASE
Base number (0 or 1) for the prerelease identifier.--rtl
Coerce version strings right to left.--ltr
Coerce version strings left to right (default).
INCREMENT TYPES
major - 1.2.3 -> 2.0.0minor - 1.2.3 -> 1.3.0patch - 1.2.3 -> 1.2.4premajor - 1.2.3 -> 2.0.0-0preminor - 1.2.3 -> 1.3.0-0prepatch - 1.2.3 -> 1.2.4-0prerelease - 1.2.3 -> 1.2.4-0
CAVEATS
Node.js package. Strict mode may reject valid-looking versions. Range syntax can be complex.
HISTORY
semver is the Node.js implementation of semantic versioning. It's used by npm for package version resolution.
