27

When writing bower.json you can specify version numbers in your dependencies. Sometimes I see people writing

{
...
    "devDependencies" : {
        "grunt" : "~0.3.13",
    }
}

What exactly does the ~ mean? Why not write >=0.3.13?

Is this some sort of best practice?

Charles
  • 50,943
  • 13
  • 104
  • 142
Presidenten
  • 6,327
  • 11
  • 45
  • 55
  • 1
    Possible duplicate of [What is the bower (and npm) version syntax?](http://stackoverflow.com/questions/19030170/what-is-the-bower-and-npm-version-syntax) – AncientSwordRage Mar 06 '17 at 11:22

1 Answers1

22

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.

Sindre Sorhus
  • 62,972
  • 39
  • 168
  • 232