-
-
Notifications
You must be signed in to change notification settings - Fork 8.8k
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
chore: migrate to Yarn Modern #6028
Changes from 10 commits
715e4cd
b465d64
dcfdac0
52e806a
e6cedb5
7abc673
9daa205
140fc53
2da3498
9afa8bd
00a79fc
8365966
5997e7d
826418a
8475533
6b6cff4
b9c59c4
bebb88f
390eabb
560bf61
0e288cd
11a7bef
60cb526
c124b1d
76ed135
74409f4
9404a33
cece96b
f4cc64c
eecb47c
f6a4bf2
177d622
ecc4af6
3f08cde
e89a27a
a0fb1da
6ff7234
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
nodeLinker: node-modules | ||
|
||
plugins: | ||
- path: .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs | ||
spec: "@yarnpkg/plugin-workspace-tools" | ||
- path: .yarn/plugins/@ojkelly/plugin-build.cjs | ||
spec: "https://yarn.build/latest" | ||
|
||
yarnPath: .yarn/releases/yarn-3.1.1.cjs |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
{ | ||
"name": "root", | ||
"version": "0.0.0", | ||
"license": "MIT", | ||
"private": true, | ||
"workspaces": [ | ||
"packages/*", | ||
|
@@ -16,8 +18,7 @@ | |
"start:website:blogOnly": "yarn workspace website start:blogOnly", | ||
"start:website:deployPreview": "cross-env NETLIFY=true CONTEXT='deploy-preview' yarn workspace website start", | ||
"examples:generate": "node generateExamples", | ||
"build": "yarn build:packages && yarn build:website", | ||
"build:packages": "lerna run build --no-private", | ||
"build:packages": "yarn workspaces foreach --no-private run build", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. are you sure about this change? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i think you are missing now "build": "yarn workspaces foreach run build", There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is implied. Edit. NVM, |
||
"build:website": "yarn workspace website build", | ||
"build:website:baseUrl": "yarn workspace website build:baseUrl", | ||
"build:website:blogOnly": "yarn workspace website build:blogOnly", | ||
|
@@ -38,8 +39,7 @@ | |
"canary:bumpVersion": "yarn lerna version `yarn --silent canary:version` --exact --no-push --yes", | ||
"canary:publish": "yarn lerna publish from-package --dist-tag canary --yes --no-verify-access", | ||
"changelog": "lerna-changelog", | ||
"postinstall": "run-p postinstall:**", | ||
"postinstall:main": "yarn lock:update && yarn build:packages", | ||
"postinstall": "run-p postinstall:\"**\"", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. are you sure about this? i think you are missing "postinstall:main": "yarn build:packages", There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm still investigating this. It seems the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
They are, but only when the dependency tree changes.
|
||
"postinstall:dev": "is-ci || husky install", | ||
"prettier": "prettier --config .prettierrc --write \"**/*.{js,jsx,ts,tsx,json}\"", | ||
"prettier:diff": "prettier --config .prettierrc --list-different \"**/*.{js,jsx,ts,tsx,json}\"", | ||
|
@@ -52,10 +52,9 @@ | |
"lerna": "lerna", | ||
"test": "cross-env TZ=UTC jest", | ||
"test:build:website": "./admin/scripts/test-release.sh", | ||
"watch": "yarn lerna run --parallel watch", | ||
"watch": "yarn workspaces foreach --parallel run watch", | ||
"clear": "(yarn workspace website clear || echo 'Failure while running docusaurus clear') && yarn lerna exec --ignore docusaurus yarn rimraf lib lib-next", | ||
"test:baseUrl": "yarn build:website:baseUrl && yarn serve:website:baseUrl", | ||
"lock:update": "npx yarn-deduplicate" | ||
"test:baseUrl": "yarn build:website:baseUrl && yarn serve:website:baseUrl" | ||
}, | ||
"devDependencies": { | ||
"@babel/cli": "^7.16.0", | ||
|
@@ -103,9 +102,9 @@ | |
"husky": "^5.0.9", | ||
"is-ci": "^3.0.0", | ||
"jest": "^26.6.3", | ||
"lerna": "^3.22.1", | ||
"lerna-changelog": "^1.0.1", | ||
"lint-staged": "^10.5.4", | ||
"monodeploy": "^2.8.16", | ||
"netlify-cli": "^8.0.5", | ||
"nodemon": "^2.0.13", | ||
"npm-run-all": "^4.1.5", | ||
|
@@ -130,5 +129,6 @@ | |
}, | ||
"engines": { | ||
"node": ">=14" | ||
} | ||
}, | ||
"packageManager": "yarn@3.1.1" | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,17 +18,19 @@ | |
}, | ||
"license": "MIT", | ||
"dependencies": { | ||
"@docusaurus/core": "2.0.0-beta.9", | ||
"@docusaurus/types": "2.0.0-beta.9", | ||
"@docusaurus/utils": "2.0.0-beta.9", | ||
"@docusaurus/utils-common": "2.0.0-beta.9", | ||
"@docusaurus/utils-validation": "2.0.0-beta.9", | ||
"@docusaurus/core": "workspace:*", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess this is only for testing purposes? I have no idea if it works well with NPM or Lerna. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, this is how things are done in Yarn 3. Putting an actual version would make it fetch from the npm registry. Plus, this way, the release diff is smaller. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We use lerna to automate the release (yes, a weird mix of yarn workspaces and lerna). In the perfect world we ditch lerna altogether in this PR, but otherwise we have to make sure they interop There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
NIT: Only if the range doesn't match the version of the workspace There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wait, @merceyz Does that mean we can keep using the actual version ( There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Actually—no, let's not get stuck on the good old lerna forever. @slorber What's your call? Should we migrate to using Yarn workspaces throughout or should we continue using lerna, provided they would have similar DX and no user-side differences? |
||
"@docusaurus/utils": "workspace:*", | ||
"@docusaurus/utils-common": "workspace:*", | ||
"@docusaurus/utils-validation": "workspace:*", | ||
"chalk": "^4.1.2", | ||
"eta": "^1.12.3", | ||
"fs-extra": "^10.0.0", | ||
"lodash": "^4.17.20", | ||
"tslib": "^2.3.1" | ||
}, | ||
"devDependencies": { | ||
"@docusaurus/types": "workspace:*" | ||
}, | ||
"peerDependencies": { | ||
"react": "^16.8.4 || ^17.0.0", | ||
"react-dom": "^16.8.4 || ^17.0.0" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you explain why do we need this plugin?
i don't see any use case for yarn.build -> https://github.com/ojkelly/yarn.build
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, RDIL and I had been talking with Owen on Discord and he recommended tophat/monodeploy instead
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@armano2 right now I'm using it to actually get the packages to build with an output, plus it has a nice UI.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👋 yeah for sending the packages to npm, tophat/monodeploy is probably a good choice.
yarn.build is more like a bazel/buck, so can build local workspaces in the correct topological order with as much concurrency as possible, and it keeps a record of what's been built so it only rebuild what's changed.
It's also great for doing the same with tests
yarn test
and you'll find it most powerful when each workspace is treated as a self contained unit.If you pair it with yarn's vendoring, then you get the speed and soundness from the big tools like bazel/buck.