總結
- npm 采用語義版本管理軟件包。所謂語義版本,就是指版本號為a.b.c的形式宰缤,其中a是大版本號告丢,b是小版本號,c是補丁號垒玲。
- 會匹配最近的小版本依賴包陆馁,比如1.2.3會匹配所有1.2.x版本,但是不包括1.3.0
- 會匹配最新的大版本依賴包合愈,比如1.2.3會匹配所有1.x.x的包叮贩,包括1.3.0,但是不包括2.0.0
參考資料原文
Semantic versioning is a standard that a lot of projects use to communicate what kinds of changes are in this release. It's important to communicate what kinds of changes are in a release because sometimes those changes will break the code that depends on the package.
Semver for publishers
If a project is going to be shared with others, it should start at 1.0.0, though some projects on npm don't follow this rule.
After this, changes should be handled as follows:
- Bug fixes and other minor changes: Patch release, increment the last number, e.g. 1.0.1
- New features which don't break existing features: Minor release, increment the middle number, e.g. 1.1.0
- Changes which break backwards compatibility: Major release, increment the first number, e.g. 2.0.0
Semver for consumers
As a consumer, you can specify which kinds of updates your app can accept in the package.json file.
If you were starting with a package 1.0.4, this is how you would specify the ranges:
- Patch releases: 1.0 or 1.0.x or ~1.0.4
- Minor releases: 1 or 1.x or ^1.0.4
- Major releases: * or x
參考資料鏈接
https://docs.npmjs.com/getting-started/semantic-versioning
https://docs.npmjs.com/misc/semver
http://blog.csdn.net/u014291497/article/details/70148468