编写bower.json时,您可以在依赖项中指定版本号。 有时我看到有人写作
When writing bower.json you can specify version numbers in your dependencies. Sometimes I see people writing
{ ... "devDependencies" : { "grunt" : "~0.3.13", } }究竟是什么意思?为什么不写> = 0.3.13?
What exactly does the ~ mean? Why not write >=0.3.13?
这是某种最佳做法吗?
Is this some sort of best practice?
推荐答案这是 semver 和符号与> = 0.3.13< 0.4.0 相同,它将匹配所有补丁在 0.3.13 之后发布,但不包括 0.4.0 。这意味着您将获得错误修复(补丁),但不是新功能(次要)。不建议使用> = 0.3.13 ,因为它会匹配任何超出某些时间点的内容。
It's semver and 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.
更多推荐
在Bower中指定版本号
发布评论