Open EmrysMyrddin opened 3 years ago
@arcanis If I want to POC around this, do you have any clue of where to begin with ?
I'm lost since it would be my very first contribution to yarn.
Just ran into this issue when trying to migrate from yarn classic to berry, I would very much like to see this feature as well.
Same here, just ran into this and would love to see it as a flag! thx for a nice tool :)
My workaround was also to use --topological-dev
and make sure the dependencies are also devDependencies
.
Wouldn't a better solution be to consider all of dependencies
, devDependencies
and peerDependencies
when using the --topological
flag?
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.