New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Experiment: Replace lerna with yarn2 workspaces #4804
Closed
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This reverts commit 861f7d2.
This was referenced Oct 18, 2022
This was referenced Oct 19, 2022
This was referenced Oct 19, 2022
This was referenced Oct 19, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Note: closely related to PR #4593.
This draft PR is an experiment of replacing our custom fluid-build tool and lerna with yarn2
workspaces and lage.
Note: using lage here is incidental. Fluid-build already paralellizes things efficiently, but I didn't have time to
make code changes to fluid-build.
We can decide on package manager vs "task runner" independently, including updating fluid-build as needed.
I do not intend to merge this in; I am sharing it in case anyone else is investigating speeding up the repo init
experience.
Goals of the experiment:
How to try it
npm i -g yarn
.yarn install
.yarn lage l-build
to run a build using lage.Note that the build will fail. Likely with an error like this:
That's the current state.
I got much further in the compilation progress, but things regressed somehow over the past few days. One thing to try is using yarn to build just the server packages first:
Then go back to the root and try
yarn lage l-build
again. It might get further. You can also try building using yarn itself from the root of the repo:Workspace structure
Yarn supports nested workspaces to some extent, so it actually supports our repo structure pretty well already. Here's
the root workspace config:
The last three entries are also worktrees (more at
https://yarnpkg.com/features/workspaces#how-to-declare-a-worktree), and define subpaths that they encompass.
You can list all the workspaces using
yarn workspaces list
.Features
Yarn v2 seems particularly well suited to monorepo management. It will determine, based on the version numbers in
package dependencies, whether to install a package from npm or use the one in the repo. You can also explicitly
define these relationships and say I always want the workspace version.
It also has some very nice interactive package management features. Try going to a non-React package in the repo and
typing
yarn add react-dom
. You can select from versions influenced by what is already used in the repo. You can alsotry
yarn upgrade-interactive
.It can help deduplicate packages within the repo:
yarn dedupe --check
There are also things I haven't fully explored, like the release workflows and constraints, but they look very
useful from a monorepo management perspective.
Known issues and caveats
Caching doesn't work. See microsoft/lage#129 and microsoft/workspace-tools#36.