-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
- I'd be willing to implement this feature (contributing guide)
- This feature is important to have in this repository; a contrib plugin wouldn't do
Describe the user story
I have a modular project using yarn workspaces with a lot of packages.
To be modular, each packages are small modules that can depend on other packages in the worspace. The final user of the library will have to use multiple packages from our library.
For example, a user will have to use both @cuillere/core and @cuiller/postgres. since @cuillere/postrgres depends on @cuillere/core but the user also have to use this dependency, @cuillere/core is defined as a peer dependency.
Starting from yarn v2, it is no longer required to add peer-dependency as dev-dependency to be able to develop it. So most of our dependencies between our worspaces are defined using only peer-dependency.
Now, I would like to use workspace foreach run build to build each packages following the dependency tree defined by peer-dependencies.
Describe the solution you'd like
The solution is to add a --topological-peer which would behave the same as --topological-dev but with peer-dependencies instead of dev-dependencies.
Describe the drawbacks of your solution
I'm not sure there is clear drawbacks. The only one I see is that it could potentially be dificult to resolve peer-dependencies depending on how it is implemented in Yarn's code.
Describe alternatives you've considered
My alternative for now is to include all my worspaces both in peer-dependecies and dev-dependencies. Whoch is not that anoying, but a little odd since I do it only for yarn worspaces foreach to work properly, not to make my package work.