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

Use Yarn 2 #11962

Merged
merged 17 commits into from Aug 25, 2020
Merged

Use Yarn 2 #11962

merged 17 commits into from Aug 25, 2020

Conversation

JLHwung
Copy link
Contributor

@JLHwung JLHwung commented Aug 14, 2020

Q                       A
License MIT

This PR backports yarn 2 related PRs (#11167, #11779, #11782 and #11822) to main.

  • Added yarn-plugin-deduplicate (yarn deduplicate)
  • Moved some devDependencies to leaf packages.

@JLHwung JLHwung added the PR: Internal 🏠 A type of pull request used for our changelog categories label Aug 14, 2020
@babel-bot
Copy link
Collaborator

babel-bot commented Aug 14, 2020

Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/27838/

@codesandbox-ci
Copy link

codesandbox-ci bot commented Aug 14, 2020

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit ac13666:

Sandbox Source
babel-repl-custom-plugin Configuration
babel-plugin-multi-config Configuration

package.json Outdated Show resolved Hide resolved
@JLHwung JLHwung marked this pull request as ready for review August 15, 2020 18:43
.yarnrc.yml Show resolved Hide resolved
.travis.yml Outdated Show resolved Hide resolved
.circleci/config.yml Outdated Show resolved Hide resolved
.travis.yml Outdated Show resolved Hide resolved
@merceyz
Copy link
Contributor

merceyz commented Aug 17, 2020

The latest Yarn from sources has some nice performance improvements compared to 2.1.1, might be worth updating to that yarnpkg/berry@2020-07-09a...master

yarn set version from sources

@JLHwung
Copy link
Contributor Author

JLHwung commented Aug 18, 2020

@merceyz Thanks to let us know! I prefer the tagged version as current performance is already greatly improved over lerna bootstrap. We will update when 2.2.0 is published.

@@ -30,11 +30,8 @@
"@rollup/plugin-json": "4.0.1",
"babel-jest": "^24.9.0",
"babel-plugin-transform-charcodes": "^0.2.0",
"browserify": "^16.2.3",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

They are moved to @babel/polyfill because it is only used when building dist of @babel/polyfill.

@@ -1,17 +1,14 @@
#!/bin/sh
set -ex

BROWSERIFY_CMD="../../node_modules/browserify/bin/cmd.js"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do not have any assumption on node_modules structures and invoke via yarn instead.

@@ -21,5 +21,11 @@
"dependencies": {
"core-js": "^2.6.5",
"regenerator-runtime": "^0.13.4"
},
"devDependencies": {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

They are pinned as the version that previously locked in yarn.lock. We can update them in subsequent PRs but given that @babel/polyfill is deprecated, this is of very low priority.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

browserify has been updated to 16.5.2 which bumps browser-resolve to 2.0.0 that supports Yarn PnP: https://github.com/browserify/browser-resolve/blob/master/CHANGELOG.md#browser-resolve-change-log

@JLHwung JLHwung force-pushed the yarn-2 branch 2 times, most recently from 28a5dce to 3de755e Compare August 19, 2020 00:41
Copy link
Contributor

@merceyz merceyz left a comment

Choose a reason for hiding this comment

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

The version of @yarnpkg/plugin-constraints isn't the latest tagged release (2.1.0), unsure which version it is but it should be updated

@JLHwung
Copy link
Contributor Author

JLHwung commented Aug 19, 2020

@merceyz Good catch! It seems that this plugin is not used at all. I removed it.

@arcanis
Copy link
Contributor

arcanis commented Aug 19, 2020

@JLHwung
Copy link
Contributor Author

JLHwung commented Aug 19, 2020

For context, it used to be used here: https://github.com/babel/babel/pull/11214/files#diff-8ca351b0cde465d2c1b11fe6dd12b1a5R25-R35

Thanks for the comment. Yes it was used to bump the babel dependencies of a given repository. Later we come up with a custom script for this purpose. So currently the plugin is not used.

@@ -1,4 +1,4 @@
process.env.BABEL_DISABLE_CACHE = "true";
require("@babel/register").default({
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This test did not test packages/babel-register but instead it is tested against some random @babel/register in node_modules.

JLHwung and others added 14 commits August 20, 2020 16:04
Co-authored-by: Kristoffer K. <merceyz@users.noreply.github.com>
Co-Authored-By: merceyz <merceyz@users.noreply.github.com>
Testcases in packages/babel-preset-env/test/fixtures/debug/browserslists-defaults-not-ie
depends on specific caniuse-lite versions. We pinned the version here
so we don't have to deal with fixture different in e2e-tests
where all deps will be updated and tested.
Copy link
Member

@nicolo-ribaudo nicolo-ribaudo left a comment

Choose a reason for hiding this comment

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

Approving again since there have been many changes

@nicolo-ribaudo
Copy link
Member

To make it easier to review this PR, I suggest using this link: https://github.com/babel/babel/pull/11962/files/dc3b917a52614e5107c1b7a8ca16b23b3eaa8fc9..ac1366665d34621bcf669be29c789647149cf265?file-filters%5B%5D=.cjs&file-filters%5B%5D=.js&file-filters%5B%5D=.json&file-filters%5B%5D=.lock&file-filters%5B%5D=.sh&file-filters%5B%5D=.yml&hide-deleted-files=true

It hides the commits that have already been reviewed in the next-8-dev branch. Also, you can skip reading the contents of the file in .yarn/plugins since those are just dependencies (but yarn plugins need to be committed because you might need to run them before yarn install).

- path: .yarn/plugins/@yarnpkg/plugin-constraints.js
spec: "@yarnpkg/plugin-constraints"
- path: .yarn/plugins/@yarnpkg/plugin-deduplicate.cjs
spec: "https://raw.githubusercontent.com/eps1lon/yarn-plugin-deduplicate/latest/bin/%40yarnpkg/plugin-deduplicate.js"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

In the future we will remove this plugin and use built-in yarn dedupe (PR) which is expected to ship in Yarn 2.2.0.

@@ -19,6 +19,6 @@
},
"peerDependencies": {
"@babel/eslint-parser": "^7.10.4",
"eslint-plugin-flowtype": "^3.0.0"
"eslint-plugin-flowtype": "^4.6.0"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

eslint-plugin-flowtypw@4.6.0 is installed in root package.json so we provided 4.6.0 for ^3.0.0, since @babel/eslint-config-internal is private, we bump the peerDependencies to what we used in root package.json.

Copy link
Member

@existentialism existentialism left a comment

Choose a reason for hiding this comment

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

Can't wait for no more patching :)

@JLHwung
Copy link
Contributor Author

JLHwung commented Aug 25, 2020

:shipit:

@JLHwung JLHwung merged commit 3fad7ea into babel:main Aug 25, 2020
@JLHwung JLHwung deleted the yarn-2 branch August 25, 2020 18:37
@arcanis
Copy link
Contributor

arcanis commented Aug 25, 2020

@github-actions github-actions bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label Nov 27, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 27, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
backport outdated A closed issue/PR that is archived due to age. Recommended to make a new issue PR: Internal 🏠 A type of pull request used for our changelog categories
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants