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

时间:2016-03-04 14:07:38

标签: javascript bower

我有这个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"
  }
}

对于某些依赖项,我在"angular-material": "^1.0.6"中看到^。对于其他人,我看到〜"html5-boilerplate": "~5.2.0"。 ^和〜之间有什么区别?

1 个答案:

答案 0 :(得分:4)

全部是关于semver,它实际上来自npm's package.json

  • ~version是“大致相当于版本”
  • ^ version是“与版本兼容”