Skip to content
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

Closed
wants to merge 37 commits into from
Closed
Show file tree
Hide file tree
Changes from 25 commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
715e4cd
Yarn v3
RDIL Nov 29, 2021
b465d64
Merge branch 'main' into RDIL/main
Josh-Cena Nov 30, 2021
dcfdac0
Alright, this is a bit of a fixer upper.
RDIL Dec 1, 2021
52e806a
merge
RDIL Dec 1, 2021
e6cedb5
Fix (an) issue
RDIL Dec 1, 2021
7abc673
I'm going to go nuts
RDIL Dec 1, 2021
9daa205
Oops
RDIL Dec 1, 2021
140fc53
Fix everything
Josh-Cena Dec 1, 2021
2da3498
Merge branch 'main' into RDIL/main
Josh-Cena Dec 1, 2021
9afa8bd
Cleanups
Josh-Cena Dec 1, 2021
00a79fc
Does this work?
Josh-Cena Dec 1, 2021
8365966
Fix peerDep
Josh-Cena Dec 1, 2021
5997e7d
Fix peer deps
Josh-Cena Dec 1, 2021
826418a
Fix lock
Josh-Cena Dec 1, 2021
8475533
Enable inline builds
RDIL Dec 1, 2021
6b6cff4
Other things
RDIL Dec 2, 2021
b9c59c4
Remove yarn.build's `bundle` and `test` commands
RDIL Dec 5, 2021
bebb88f
Revert a few changes
Josh-Cena Dec 5, 2021
390eabb
Merge branch 'main' into RDIL/main
Josh-Cena Dec 5, 2021
560bf61
Set canary Yarn
Josh-Cena Dec 5, 2021
0e288cd
Fix build
Josh-Cena Dec 5, 2021
11a7bef
FIx a few workflows
Josh-Cena Dec 6, 2021
60cb526
No, not needed
Josh-Cena Dec 6, 2021
c124b1d
Fix build?
Josh-Cena Dec 6, 2021
76ed135
Fix again?
Josh-Cena Dec 6, 2021
74409f4
Go back to lerna?
Josh-Cena Dec 6, 2021
9404a33
Fix lock
Josh-Cena Dec 6, 2021
cece96b
Merge branch 'main' into RDIL/main
Josh-Cena Dec 9, 2021
f4cc64c
Update lock
Josh-Cena Dec 9, 2021
eecb47c
Merge branch 'main' into RDIL/main
Josh-Cena Jan 26, 2022
f6a4bf2
oops
Josh-Cena Jan 26, 2022
177d622
Merge branch 'main' into RDIL/main
Josh-Cena Jan 26, 2022
ecc4af6
use latest canary
Josh-Cena Jan 26, 2022
3f08cde
revert CSS changes
Josh-Cena Jan 26, 2022
e89a27a
downgrade
Josh-Cena Jan 26, 2022
a0fb1da
use iv
Josh-Cena Jan 26, 2022
6ff7234
Merge branch 'main' into RDIL/main
Josh-Cena Jan 28, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/build-perf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ jobs:

# Ensure build with a cold cache does not increase too much
- name: Build (cold cache)
run: yarn workspace website build --locale en
run: yarn workspace website run build --locale en
timeout-minutes: 8

# Ensure build with a warm cache does not increase too much
- name: Build (warm cache)
run: yarn workspace website build --locale en
run: yarn workspace website run build --locale en
timeout-minutes: 2
# TODO post a Github comment with build with perf warnings?
5 changes: 1 addition & 4 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,7 @@ jobs:
with:
cache: yarn
- name: Installation
run: yarn
# run: yarn install --immutable # Fails if yarn.lock is modified (unfortunately only works for Yarn 2, and --frozen-lockfile is not the same!)
- name: Check immutable yarn.lock
run: git diff --exit-code
run: yarn install --immutable
- name: Lint
run: yarn lint:ci
- name: Prettier Code
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
- name: Test
run: yarn test
- name: TypeCheck website
run: yarn workspace website tsc
run: yarn workspace website typecheck
windows-test:
name: Windows Tests
timeout-minutes: 30
Expand Down
8 changes: 7 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,13 @@
.changelog

node_modules
.yarn
.pnp.*
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions

.eslintcache

Expand Down
111 changes: 111 additions & 0 deletions .yarn/plugins/@ojkelly/plugin-build.cjs

Large diffs are not rendered by default.

28 changes: 28 additions & 0 deletions .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs

Large diffs are not rendered by default.

778 changes: 778 additions & 0 deletions .yarn/releases/yarn-3.2.0-rc.7.cjs

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
enableInlineBuilds: true

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/build"

yarnPath: .yarn/releases/yarn-3.2.0-rc.7.cjs
2 changes: 1 addition & 1 deletion admin/scripts/test-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ docker run -d --rm --name "$CONTAINER_NAME" -p 4873:4873 -v "$PWD/admin/verdacci
yarn build:packages

# Publish the monorepo
npx --no-install lerna publish --exact --yes --no-verify-access --no-git-reset --no-git-tag-version --no-push --registry "$CUSTOM_REGISTRY_URL" "$NEW_VERSION"
npx --no-install monodeploy --exact --yes --no-verify-access --no-git-reset --no-git-tag-version --no-push --registry "$CUSTOM_REGISTRY_URL" "$NEW_VERSION"

# Revert version changes
git diff --name-only -- '*.json' | sed 's, ,\\&,g' | xargs git checkout --
Expand Down
8 changes: 8 additions & 0 deletions monodeploy.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

module.exports = {};
21 changes: 11 additions & 10 deletions package.json
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/*",
Expand All @@ -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 -t --no-private run build",
"build:website": "yarn workspace website build",
"build:website:baseUrl": "yarn workspace website build:baseUrl",
"build:website:blogOnly": "yarn workspace website build:blogOnly",
Expand All @@ -38,8 +39,8 @@
"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:\"**\"",
Copy link
Contributor

@armano2 armano2 Dec 1, 2021

Choose a reason for hiding this comment

The 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",

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm still investigating this. It seems the postinstall hooks aren't even executed

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems the postinstall hooks aren't even executed

They are, but only when the dependency tree changes.

postinstall is called after a package's dependency tree changes are written to the disk -- e.g. after a dependency or transitive dependency is added, removed, or changed
https://yarnpkg.com/advanced/lifecycle-scripts

"postinstall:main": "yarn build:packages",
"postinstall:dev": "is-ci || husky install",
"format": "prettier --config .prettierrc --write \"**/*.{js,jsx,ts,tsx,json}\"",
"format:diff": "prettier --config .prettierrc --list-different \"**/*.{js,jsx,ts,tsx,json}\"",
Expand All @@ -49,13 +50,12 @@
"lint:ci": "yarn lint:js --quiet --report-unused-disable-directives && yarn lint:style",
"lint:js": "eslint --cache \"**/*.{js,jsx,ts,tsx}\"",
"lint:style": "stylelint \"**/*.css\"",
"lerna": "lerna",
"test": "cross-env TZ=UTC jest",
"test:build:website": "./admin/scripts/test-release.sh",
"watch": "yarn lerna run --parallel watch",
"clear": "(yarn workspace website clear || echo 'Failure while running docusaurus clear') && yarn lerna exec --ignore docusaurus yarn rimraf lib lib-next",
"watch": "yarn workspaces foreach --parallel run watch",
"clear": "(yarn workspace website clear || echo 'Failure while running docusaurus clear') && yarn workspaces foreach run yarn rimraf lib lib-next",
"test:baseUrl": "yarn build:website:baseUrl && yarn serve:website:baseUrl",
"lock:update": "npx yarn-deduplicate"
"monodeploy": "monodeploy"
},
"devDependencies": {
"@babel/cli": "^7.16.0",
Expand Down Expand Up @@ -103,9 +103,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",
Expand All @@ -130,5 +130,6 @@
},
"engines": {
"node": ">=14"
}
},
"packageManager": "yarn@3.2.0-rc.7"
}
4 changes: 1 addition & 3 deletions packages/create-docusaurus/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@
"build": "tsc",
"watch": "tsc --watch"
},
"bin": {
"create-docusaurus": "bin/index.js"
},
"bin": "bin/index.js",
"publishConfig": {
"access": "public"
},
Expand Down
6 changes: 3 additions & 3 deletions packages/docusaurus-mdx-loader/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
"dependencies": {
"@babel/parser": "^7.16.4",
"@babel/traverse": "^7.16.3",
"@docusaurus/core": "2.0.0-beta.9",
"@docusaurus/utils": "2.0.0-beta.9",
"@docusaurus/core": "workspace:*",
"@docusaurus/utils": "workspace:*",
"@mdx-js/mdx": "^1.6.21",
"@mdx-js/react": "^1.6.21",
"chalk": "^4.1.2",
Expand All @@ -37,7 +37,7 @@
"webpack": "^5.61.0"
},
"devDependencies": {
"@docusaurus/types": "2.0.0-beta.9",
"@docusaurus/types": "workspace:*",
"@types/escape-html": "^1.0.1",
"@types/mdast": "^3.0.7",
"@types/stringify-object": "^3.3.1",
Expand Down
10 changes: 5 additions & 5 deletions packages/docusaurus-plugin-client-redirects/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,18 @@
},
"license": "MIT",
"dependencies": {
"@docusaurus/core": "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:*",
Copy link
Collaborator

@Josh-Cena Josh-Cena Nov 30, 2021

Choose a reason for hiding this comment

The 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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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.

Copy link
Collaborator

Choose a reason for hiding this comment

The 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

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Putting an actual version would make it fetch from the npm registry

NIT: Only if the range doesn't match the version of the workspace

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wait, @merceyz Does that mean we can keep using the actual version (2.0.0-beta.9) in the workspace and publish with lerna?

Copy link
Collaborator

Choose a reason for hiding this comment

The 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": "2.0.0-beta.9"
"@docusaurus/types": "workspace:*"
},
"peerDependencies": {
"react": "^16.8.4 || ^17.0.0",
Expand Down
10 changes: 5 additions & 5 deletions packages/docusaurus-plugin-content-blog/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
},
"license": "MIT",
"dependencies": {
"@docusaurus/core": "2.0.0-beta.9",
"@docusaurus/mdx-loader": "2.0.0-beta.9",
"@docusaurus/utils": "2.0.0-beta.9",
"@docusaurus/utils-validation": "2.0.0-beta.9",
"@docusaurus/core": "workspace:*",
"@docusaurus/mdx-loader": "workspace:*",
"@docusaurus/utils": "workspace:*",
"@docusaurus/utils-validation": "workspace:*",
"chalk": "^4.1.2",
"escape-string-regexp": "^4.0.0",
"feed": "^4.2.2",
Expand All @@ -37,7 +37,7 @@
"webpack": "^5.61.0"
},
"devDependencies": {
"@docusaurus/types": "2.0.0-beta.9"
"@docusaurus/types": "workspace:*"
},
"peerDependencies": {
"react": "^16.8.4 || ^17.0.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/docusaurus-plugin-content-docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@
"webpack": "^5.61.0"
},
"devDependencies": {
"@docusaurus/module-type-aliases": "2.0.0-beta.9",
"@docusaurus/types": "2.0.0-beta.9",
"@docusaurus/module-type-aliases": "workspace:*",
"@docusaurus/types": "workspace:*",
"@types/js-yaml": "^4.0.0",
"@types/picomatch": "^2.2.1",
"commander": "^5.1.0",
Expand Down
10 changes: 5 additions & 5 deletions packages/docusaurus-plugin-content-pages/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,17 @@
},
"license": "MIT",
"dependencies": {
"@docusaurus/core": "2.0.0-beta.9",
"@docusaurus/mdx-loader": "2.0.0-beta.9",
"@docusaurus/utils": "2.0.0-beta.9",
"@docusaurus/utils-validation": "2.0.0-beta.9",
"@docusaurus/core": "workspace:*",
"@docusaurus/mdx-loader": "workspace:*",
"@docusaurus/utils": "workspace:*",
"@docusaurus/utils-validation": "workspace:*",
"globby": "^11.0.2",
"remark-admonitions": "^1.2.1",
"tslib": "^2.3.1",
"webpack": "^5.61.0"
},
"devDependencies": {
"@docusaurus/types": "2.0.0-beta.9"
"@docusaurus/types": "workspace:*"
},
"peerDependencies": {
"react": "^16.8.4 || ^17.0.0",
Expand Down
6 changes: 3 additions & 3 deletions packages/docusaurus-plugin-debug/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@
},
"license": "MIT",
"dependencies": {
"@docusaurus/core": "2.0.0-beta.9",
"@docusaurus/utils": "2.0.0-beta.9",
"@docusaurus/core": "workspace:*",
"@docusaurus/utils": "workspace:*",
"fs-extra": "^10.0.0",
"react-json-view": "^1.21.3",
"tslib": "^2.3.1"
},
"devDependencies": {
"@docusaurus/types": "2.0.0-beta.9"
"@docusaurus/types": "workspace:*"
},
"peerDependencies": {
"react": "^16.8.4 || ^17.0.0",
Expand Down
6 changes: 3 additions & 3 deletions packages/docusaurus-plugin-google-analytics/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@
},
"license": "MIT",
"dependencies": {
"@docusaurus/core": "2.0.0-beta.9",
"@docusaurus/utils-validation": "2.0.0-beta.9"
"@docusaurus/core": "workspace:*",
"@docusaurus/utils-validation": "workspace:*"
},
"devDependencies": {
"@docusaurus/types": "2.0.0-beta.9"
"@docusaurus/types": "workspace:*"
},
"peerDependencies": {
"react": "^16.8.4 || ^17.0.0",
Expand Down
6 changes: 3 additions & 3 deletions packages/docusaurus-plugin-google-gtag/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@
},
"license": "MIT",
"dependencies": {
"@docusaurus/core": "2.0.0-beta.9",
"@docusaurus/utils-validation": "2.0.0-beta.9"
"@docusaurus/core": "workspace:*",
"@docusaurus/utils-validation": "workspace:*"
},
"devDependencies": {
"@docusaurus/types": "2.0.0-beta.9"
"@docusaurus/types": "workspace:*"
},
"peerDependencies": {
"react": "^16.8.4 || ^17.0.0",
Expand Down
12 changes: 9 additions & 3 deletions packages/docusaurus-plugin-ideal-image/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
},
"license": "MIT",
"dependencies": {
"@docusaurus/core": "2.0.0-beta.9",
"@docusaurus/lqip-loader": "2.0.0-beta.9",
"@docusaurus/core": "workspace:*",
"@docusaurus/lqip-loader": "workspace:*",
"@docusaurus/responsive-loader": "1.5.0",
"@endiliey/react-ideal-image": "^0.0.11",
"react-waypoint": "^10.1.0",
Expand All @@ -31,13 +31,19 @@
"webpack": "^5.61.0"
},
"devDependencies": {
"@docusaurus/types": "2.0.0-beta.9",
"@docusaurus/types": "workspace:*",
"fs-extra": "^10.0.0"
},
"peerDependencies": {
"jimp": "*",
"react": "^16.8.4 || ^17.0.0",
"react-dom": "^16.8.4 || ^17.0.0"
},
"peerDependenciesMeta": {
"jimp": {
"optional": true
}
},
"engines": {
"node": ">=14"
}
Expand Down
12 changes: 6 additions & 6 deletions packages/docusaurus-plugin-pwa/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.16.0",
"@babel/plugin-proposal-optional-chaining": "^7.16.0",
"@babel/preset-env": "^7.16.4",
"@docusaurus/core": "2.0.0-beta.9",
"@docusaurus/theme-common": "2.0.0-beta.9",
"@docusaurus/theme-translations": "2.0.0-beta.9",
"@docusaurus/utils": "2.0.0-beta.9",
"@docusaurus/utils-validation": "2.0.0-beta.9",
"@docusaurus/core": "workspace:*",
"@docusaurus/theme-common": "workspace:*",
"@docusaurus/theme-translations": "workspace:*",
"@docusaurus/utils": "workspace:*",
"@docusaurus/utils-validation": "workspace:*",
"babel-loader": "^8.2.2",
"clsx": "^1.1.1",
"core-js": "^3.18.0",
Expand All @@ -39,7 +39,7 @@
"workbox-window": "^6.1.1"
},
"devDependencies": {
"@docusaurus/module-type-aliases": "2.0.0-beta.9",
"@docusaurus/module-type-aliases": "workspace:*",
"fs-extra": "^10.0.0"
},
"peerDependencies": {
Expand Down
10 changes: 5 additions & 5 deletions packages/docusaurus-plugin-sitemap/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,16 @@
},
"license": "MIT",
"dependencies": {
"@docusaurus/core": "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:*",
"@docusaurus/utils": "workspace:*",
"@docusaurus/utils-common": "workspace:*",
"@docusaurus/utils-validation": "workspace:*",
"fs-extra": "^10.0.0",
"sitemap": "^7.0.0",
"tslib": "^2.3.1"
},
"devDependencies": {
"@docusaurus/types": "2.0.0-beta.9"
"@docusaurus/types": "workspace:*"
},
"peerDependencies": {
"react": "^16.8.4 || ^17.0.0",
Expand Down
Loading