0

I want to allow yarn to update to all newer minor + patch versions, so I am using the caret.

If the latest version of "my-package" is "3.3.3", what are the behavioral differences between "my-package": "^3" and "my-package": "^3.2.1"?

If there is none, then is there a reasonable argument in favor of one or the other?

jonrsharpe
  • 115,751
  • 26
  • 228
  • 437
Shanimal
  • 11,517
  • 7
  • 63
  • 76
  • 2
    `^3` means any version equal or newer than 3, it could be 3.0.0, or 3.5.12 or anything in the 3.X.X range. `^3.2.1` is the same, but also at least 3.2.1, so it won't download 3.0.0 or 3.1.6, for example. – Alejandro Aug 18 '21 at 18:53
  • 1
    I'd suggest having a play with https://semver.npmjs.com/ so you can see what gets matched. Note that it will get more complicated with overlapping transitive dependencies - if something else requires e.g. `my-package@~3.1` then your two options would end up in different trees. – jonrsharpe Aug 18 '21 at 18:55

0 Answers0