Ignoring major version upgrades with "yarn up"?

159 Views Asked by At

I'm using Yarn 4. There are a few packages I'm keeping at older versions because the new versions are incompatible.

With Yarn 1's yarn upgrade, it ignored the major upgrades. With Yarn 2+, I think we're supposed to upgrade all packages with yarn up '**' or yarn up -R '**'. However, these also upgrade all the major versions.

With yarn up, seems like my options are:

  1. yarn up '**', then individually install the older versions
  2. yarn upgrade-interactive, then press right + down a few dozen times

Is there another way to upgrade only the minor versions?

1

There are 1 best solutions below

0
On

I guess yarn up --caret --interactive does what you want

However, both yarn up an yarn upgrade-interactive don't seem to be handy and easy to use, so I prefer using https://github.com/antfu/taze

$ taze minor --recursive --interactive

┃ ↑↓ to select, space to toggle, → to change version
┃ enter to confirm, esc to cancel

@me/project - 1 minor, 2 patch

❯ ◉ @types/node         dev          ~12d  ^20.10.6  →  ^20.11.0  ⩽1d
  ◉ @vitejs/plugin-vue  resolutions  ~12d    ^5.0.2  →    ^5.0.3  ~1d
  ◉ vite                resolutions  ~27d   ^5.0.10  →   ^5.0.11  ~6d

It will show what's it going to upgrade, then two presses of Enter, and it's installed.

By default, taze will only bump versions in the ranges you specified in package.json (which is safe and the default behavior of npm install)
In the above example I use minor that would break over ~ ranges and ignore majors