Replies: 1 comment 1 reply
-
For running something on changed workspaces only there is a feature request for that #2374, if that were to be implemented you could do this with yarn workspaces foreach --since="<deployed branch>" version <new version> --deferred
yarn version apply --all Until that is implemented #2374 (comment) links to a third party plugin https://github.com/Dcard/yarn-plugins/tree/31803e17fe1c128d86928961bb3007dc2d25a859/packages/changed that you can try using
The published package will use the version instead of |
Beta Was this translation helpful? Give feedback.
-
I'm currently migrating a monorepo from
yarn
classic tov3
and trying to droplerna
along the way.The latter is a bit awkward, because there seems to be no easy way to bump changed workspaces and their dependencies to a common version (like
lerna
does in the fixed versioning mode). I've worked around that with a script that...semver
to bump the version defined in my rootpackage.json
yarn version check
to find changed packages,yarn workspace <ws> version <new-version> --deferred
yarn version apply --all
(for some reason--immediate
"forgets" what I selected for the other packages)I guess the script could be simplified by making it a yarn plugin and using the API, but that works for now. Maybe a simple command to bump all changed workspaces and their dependencies to a shared version, e.g.
yarn version <strategy> --changed --shared
or something along these lines.However, I'm not sure what's the recommended way to set up the workspace versions and their inter-dependencies. I'm currently using
workspace:
links, but that means the packages cannot be linked into projects that don't useyarn v2
. I should probably be using the actual versions, but then I'm not sure if I need to define the local workspace links usingresolutions
in the root package.json and what happens when those are linked (not necessarily with yarn 2) into an external project.I think the workspaces docs could use some best practices/examples for this.
Beta Was this translation helpful? Give feedback.
All reactions