jsejcksn
jsejcksn

Reputation: 33730

Set npm package to save version with caret (^)

When I $ npm install eslint --savedev, it produces this entry in my package.json file:

"devDependencies": {
  "eslint": "^3.9.1"
}

Notice the caret before the version number. When I install a package I've published in the same way $ npm install @jsejcksn/eslint-config --savedev, it does not add the caret:

"devDependencies": {
  "@jsejcksn/eslint-config": "0.0.5",
  "eslint": "^3.9.1"
}

What do I need to do in order to get npm to save my package with the caret so it will allow major version updates of my package?

Upvotes: 1

Views: 760

Answers (1)

jsejcksn
jsejcksn

Reputation: 33730

From https://docs.npmjs.com/misc/semver#caret-ranges-123-025-004:

Allows changes that do not modify the left-most non-zero digit in the [major, minor, patch] tuple. In other words, this allows patch and minor updates for versions 1.0.0 and above, patch updates for versions 0.X >=0.1.0, and no updates for versions 0.0.X.

I incremented the version to 1.0.0 and it worked as expected.

Upvotes: 2

Related Questions