简体   繁体   English

bower.json中的〜和^有什么区别?

[英]What is the difference between ~ and ^ in bower.json?

I have this bower.json file. 我有这个bower.json文件。

{
  "name": "angular-seed",
  "description": "A starter project for AngularJS",
  "version": "0.0.0",
  "homepage": "https://github.com/angular/angular-seed",
  "license": "MIT",
  "private": true,
  "dependencies": {
    "angular": "~1.4.0",
    "angular-route": "~1.4.0",
    "angular-loader": "~1.4.0",
    "angular-mocks": "~1.4.0",
    "html5-boilerplate": "~5.2.0",
    "angular-google-chart": "^0.1.0",
    "angular-material": "^1.0.6"
  }
}

For some dependencies, I see ^ as in "angular-material": "^1.0.6" . 对于某些依赖项,我看到^就像"angular-material": "^1.0.6" For others, I see ~ as in "html5-boilerplate": "~5.2.0" . 对于其他人,我看到〜如"html5-boilerplate": "~5.2.0" What is the difference between ^ and ~? ^和〜和有什么不一样?

It's all about semver and it actually comes from npm's package.json : 一切都与semver有关,它实际上来自npm的package.json

  • ~version is "Approximately equivalent to version" 〜version是“大约等于版本”
  • ^version is "Compatible with version" ^ version是“与版本兼容”

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM