javascript 在 Bower 中指定版本号
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/19019944/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Specifying version numbers in Bower
提问by Presidenten
When writing bower.json you can specify version numbers in your dependencies. Sometimes I see people writing
编写 bower.json 时,您可以在依赖项中指定版本号。有时我看到人们在写
{
...
"devDependencies" : {
"grunt" : "~0.3.13",
}
}
What exactly does the ~ mean? Why not write >=0.3.13?
~究竟是什么意思?为什么不写>=0.3.13?
Is this some sort of best practice?
这是某种最佳实践吗?
采纳答案by Sindre Sorhus
It's semverand the notation is the same as >=0.3.13 <0.4.0
, which will match all patch
releases after and including 0.3.13
, but not 0.4.0
. This means you'll get bug fixes (patch
), but not new features (minor
). >=0.3.13
is not recommended as it will match anything above which will at some point break.
它是semver并且表示法与 相同>=0.3.13 <0.4.0
,它将匹配patch
包括 之后的所有版本0.3.13
,但不匹配0.4.0
。这意味着您将获得错误修复 ( patch
),但不会获得新功能 ( minor
)。>=0.3.13
不推荐,因为它会匹配上面的任何东西,这会在某些时候打破。