[Feature] upgrade-interactive feature to show workspaces
- [ ] I'd be willing to implement this feature (contributing guide)
- [x] This feature is important to have in this repository; a contrib plugin wouldn't do
Describe the user story
Yarn upgrade-interactive is a great time-saver!
I have workspaces that use different versions of the same package. For example, one workspace is using a version ^4.11.3 and another workspace is using version next.
The problem is that when I run yarn upgrade-interactive, there is no information about which workspaces are being upgraded, and the information that is displayed is not accurate:
? Pick the packages you want to upgrade. Current Range Latest
> @material-ui/core ◉ next ◯ ^5.0.0-alpha.… ◯ ^4.11.3
@material-ui/icons ◉ next ◯ ^5.0.0-alpha.… ◯ ^4.11.2
This is not accurate because the menu only shows the Current version as next, despite the fact that there's multiple workspaces, some using next and some using ^4.11.3.
Which workspaces is it going to upgrade if I change the version?
How can the user understand what will be upgraded?
Describe the solution you'd like
A few possible solutions for this:
- A workspace column
- The workspace column would only appear when the package has workspaces.
- The workspace column would only appear when multiple workspaces use different versions of a package.
- Optionally
yarn upgrade-interactive --workspace-versionswould always show the workspace column and always show separate entries for each workspace, not just when there's multiple versions.
? Pick the packages to upgrade. Workspace Current Range Latest
> @material-ui/core foo ◉ next ◯ ^5.0.0-alpha.… ◯ ^4.11.3
@material-ui/core bar ◉ ^4.11.2 ◯ ^4.11.3
- A separate section for each workspace (more rows)
- This would display a separate group for each workspace
- By default, the workspace section would only appear when multiple workspaces use different versions of a package.
- Optionally
yarn upgrade-interactive --workspace-versionswould always show a separate section for each workspace.
? Pick the packages you want to upgrade. Current Range Latest
Workspace: foo
> @material-ui/core ◉ next ◯ ^5.0.0-alpha.… ◯ ^4.11.3
Workspace: bar
@material-ui/core ◉ ^4.11.2 ◯ ^4.11.3
Describe the drawbacks of your solution
If someone was upgrading a messy package with a bunch of workspaces that had different versions of things, they may have to press enter more times.
Describe alternatives you've considered
Since it's ambiguous about which workspaces will be upgraded (Current does not reflect the version used by some workspaces), this could be considered a bug.
Was just about to open an issue suggesting the same feature. Glad to see someone has already requested this. I especially like this part:
Hoping to see this as well in Yarn v2. Came across a feature for Yarn ~v1.2 that implemented something similar: https://github.com/yarnpkg/yarn/pull/4654#issue-145265374
Ideally this feature could also filter the results to just one workspace, too. For example, cd to a workspace directory or run yarn workspace myworkspace upgrade-interactive and the list of possible upgrades would be limited to that workspace.
I would love to see:
yarn workspace my-workspace upgrade-interactive
or
cd my-workspace && yarn upgrade-interactive # only shows upgrades for current workspace
and/or show which workspaces have dependencies when selecting versions.
Currently, we have to refer to package.json files to see which versions are in which workspaces. Quite the chore in a large monorepo!
agree! and it gets especially confusing when multiple packages have the same dependency version, but you only want to update one...
it worked perfectly fine with yarn1, i dont get how a regression like this could be left unresolved for years
There's a PR open for this here https://github.com/yarnpkg/berry/pull/3260
I have created a plugin for yarn : https://github.com/eyolas/yarn-plugin-interractive-filter It's a fork of upgrade-interactive that take a list of workspace to filter
Is there any advancement on this feature ? the plugin-interractive-filter no longer works with Yarn 4 and I can find no alternative to filter upgrades by workspace
Sorry guys, but what is the "de-duplicate chalk dependency" doing here exactly ? It doesn't fix this issue at all !