>=1.2.3 <2.0.0-0

Most common version numbers (clickable)

^1.2.3
^0.2.3
~1.2.3
~0.2.3
1.2.x
1.x
1.x.x
1.*
1.2.3 - 2.3.4
1.2 - 2.3
1.2.3 - 2
0.14.x || 15.x.x
1.2.4-alpha.3
1.2.4-beta.3

semver

Semantic Version, consisting of three parts, MAJOR.MINOR.PATCH.

MAJORWhen releasing API with Breaking Changes
MINORWhen releasing new feature APIs
PATCHWhen fixing bugs
^1.2.3>=1.2.3 <2.0.0
~1.2.3>=1.2.3 <1.3.0

Semver

semverSemantic Versioning 语义化版本的缩写,文档可见 semver,它由 [major, minor, patch] 三部分组成,其中

对于 ~1.2.3 而言,它的版本号范围是 >=1.2.3 <1.3.0

对于 ^1.2.3 而言,它的版本号范围是 >=1.2.3 <2.0.0

npm package 通过 semver 进行版本管理。当我们下载 lodash 时,如果此时最新版本号为 lodash@4.17.4,则默认在 package.json 中维护的版本号为 lodash@^4.17.4

API

Javascript

$ npm install semver
import { Range } from 'semver'

// >=1.2.3 <2.0.0-0
new Range('^1.2.3').range