zl程序教程

您现在的位置是:首页 >  后端

当前栏目

[Node.js]23. Level 4: Semantic versioning

JSNode 23 level Semantic
2023-09-14 08:59:22 时间

Update the versions on your dependencies to be a little more flexible, adding the ~ in front of your versions.

package.json

{
  "name": "My Awesome Node App",
  "version": "1",
  "dependencies": {
    "connect": "2.2.1",
    "underscore": "1.3.3"
  }
}

 

Answer:

{
  "name": "My Awesome Node App",
  "version": "1",
  "dependencies": {
    "connect": "~2.2.1",
    "underscore": "~1.3.3"
  }
}

//~2.2.1 --> >=2.2.1 > 2.3.0
//~2.2 --> >=2.2 < 3.0.0
//~2 --> >=2 < 3.0.0