package.json version

本文介绍了 Semantic Versioning (SemVer) 的各种范围样式及其含义,包括特定版本、大于、小于、等于、兼容版本等规则,并解释了如何使用波浪号 (~) 和脱帽符 (^) 来指定版本范围。

https://www.npmjs.org/doc/misc/semver.html

The following range styles are supported:

  • 1.2.3 A specific version. When nothing else will do. Must be a full version number, with major, minor, and patch versions specified. Note that build metadata is still ignored, so 1.2.3+build2012 will satisfy this range.
  • >1.2.3 Greater than a specific version.
  • <1.2.3 Less than a specific version. If there is no prerelease tag on the version range, then no prerelease version will be allowed either, even though these are technically "less than".
  • >=1.2.3 Greater than or equal to. Note that prerelease versions are NOT equal to their "normal" equivalents, so 1.2.3-beta will not satisfy this range, but2.3.0-beta will.
  • <=1.2.3 Less than or equal to. In this case, prerelease versions ARE allowed, so1.2.3-beta would satisfy.
  • 1.2.3 - 2.3.4 := >=1.2.3 <=2.3.4
  • ~1.2.3 := >=1.2.3-0 <1.3.0-0 "Reasonably close to 1.2.3". When using tilde operators, prerelease versions are supported as well, but a prerelease of the next significant digit will NOT be satisfactory, so 1.3.0-beta will not satisfy~1.2.3.
  • ^1.2.3 := >=1.2.3-0 <2.0.0-0 "Compatible with 1.2.3". When using caret operators, anything from the specified version (including prerelease) will be supported up to, but not including, the next major version (or its prereleases).1.5.1 will satisfy ^1.2.3, while 1.2.2 and 2.0.0-beta will not.
  • ^0.1.3 := >=0.1.3-0 <0.2.0-0 "Compatible with 0.1.3". 0.x.x versions are special: the first non-zero component indicates potentially breaking changes, meaning the caret operator matches any version with the same first non-zero component starting at the specified version.
  • ^0.0.2 := =0.0.2 "Only the version 0.0.2 is considered compatible"
  • ~1.2 := >=1.2.0-0 <1.3.0-0 "Any version starting with 1.2"
  • ^1.2 := >=1.2.0-0 <2.0.0-0 "Any version compatible with 1.2"
  • 1.2.x := >=1.2.0-0 <1.3.0-0 "Any version starting with 1.2"
  • 1.2.* Same as 1.2.x.
  • 1.2 Same as 1.2.x.
  • ~1 := >=1.0.0-0 <2.0.0-0 "Any version starting with 1"
  • ^1 := >=1.0.0-0 <2.0.0-0 "Any version compatible with 1"
  • 1.x := >=1.0.0-0 <2.0.0-0 "Any version starting with 1"
  • 1.* Same as 1.x.
  • 1 Same as 1.x.
  • * Any version whatsoever.
  • x Same as *.
  • "" (just an empty string) Same as *.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值