[Feature] Bulk upgrade dependencies across a single workspace or workset
See original GitHub issue- I’d be willing to implement this feature
- This feature can already be implemented through a plugin
Describe the user story
- We would like the ability to upgrade all dependencies within a workspace.
- We would like the ability to upgrade all dependencies within a workset.
Describe the solution you’d like
Much like yarn@1
where we could use yarn upgrade
or yarn upgrade --latest
to upgrade packages in bulk; a similar feature would be appreciated for Berry.
For worksets this could be simply yarn upgrade
or yarn up all
.
For individual workspaces:
yarn workspace <workspace> upgrade
or yarn workspace <workspace> up all
Describe the drawbacks of your solution The primary risk is that blindly upgrading all your packages could break project tests and these would need to be fixed to accommodate new dependency versions. Arguably, not updating dependencies frequently only adds more debt to the project.
Describe alternatives you’ve considered
I have already successfully used @yarnpkg/plugin-interactive-tools
to manually select every single package for upgrade, however this already feels tedious to use on a large workset.
Additional context
Given the nature of the awesome PnP system and the strict package boundaries; package.json
dependencies lists are going to be bigger than ever so this further increases the desire for this feature.
Issue Analytics
- State:
- Created 4 years ago
- Comments:13 (6 by maintainers)
Top GitHub Comments
@arcanis Forgive my persistence. I just want a better understanding of this.
I see what you’re saying, but I’m still having a hard time reconciling that Yarn 1 is capable of upgrading all dependencies, which seems contrary to the position you stated for Yarn v2.
I fear that there might be an underlying sentiment that I’m failing to recognize that can help me, and perhaps others, understand what is expected of the users of Yarn v2.
Is the removal of
yarn upgrade
due to a philosophical shift with Yarn 2 that I need to better understand? Is the Yarn organization implicitly advising against updating all packages at once or perhaps just fails to see the need to do so?Thanks for your time.
You’d write a plugin. As for “what would the code look like”, check up.ts - if you remove the interactive part, it’s only about a hundred lines of significant code.
Basically, the idea is that you instantiate a
Project
, iterate over the workspaces’ dependencies, callsuggestUtils.getSuggestedDescriptors
for each one, update the descriptors in the workspaces instances, then callproject.install
which will persist everything on disk.