LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

semver

Validate and manipulate semantic version strings

TLDR

Check if version is valid
$ semver [1.2.3]
copy
Increment major version
$ semver -i major [1.2.3]
copy
Increment minor version
$ semver -i minor [1.2.3]
copy
Increment patch version
$ semver -i patch [1.2.3]
copy
Compare versions
$ semver -r "[>=1.0.0 <2.0.0]" [1.5.0]
copy
Coerce loose version string
$ semver -c [v1.2]
copy
Increment prerelease with identifier
$ semver -i prerelease --preid [beta] [1.2.3]
copy
Sort versions
$ semver [1.2.3] [1.0.0] [2.0.0]
copy

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

INSTALL

sudo pacman -S semver
copy
brew install semver
copy
nix profile install nixpkgs#semver
copy

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.

SEE ALSO

npm(1), node(1)

Braincup
Open source brain training for math, memory and focus
Braincup mini-games
41 mini-games · Apache-2.0
No ads · No tracking
Play in browser
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid
276 stars
From the maker of Linux Command Library
Copied to clipboard
Braincup
Open source brain training for math, memory and focus. 41 mini-games, from mental arithmetic to Sudoku, N-Back and Solo Chess.
Apache-2.0 licensed · No ads · No tracking · No account
From the maker of Linux Command Library
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid