Add yarn-plugin-conditions to update Babel 8 dependencies (#12659)
* Add `yarn-plugin-conditions` to update Babel 8 dependencies https://github.com/nicolo-ribaudo/yarn-plugin-conditions * Update .gitattributes
This commit is contained in:
parent
dc4bace114
commit
2811b535d6
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -1 +1,2 @@
|
||||
* text eol=lf
|
||||
/.yarn/** linguist-vendored
|
||||
|
||||
8
.yarn/plugins/@yarnpkg/plugin-conditions.cjs
vendored
Normal file
8
.yarn/plugins/@yarnpkg/plugin-conditions.cjs
vendored
Normal file
File diff suppressed because one or more lines are too long
16
.yarnrc.yml
16
.yarnrc.yml
@ -7,6 +7,8 @@ nodeLinker: node-modules
|
||||
plugins:
|
||||
- path: .yarn/plugins/@yarnpkg/plugin-babel-release-tool.cjs
|
||||
spec: "https://raw.githubusercontent.com/nicolo-ribaudo/yarn-plugin-babel-release-tool/main/bundles/%40yarnpkg/plugin-babel-release-tool.js"
|
||||
- path: .yarn/plugins/@yarnpkg/plugin-conditions.cjs
|
||||
spec: "https://raw.githubusercontent.com/nicolo-ribaudo/yarn-plugin-conditions/main/bundles/%40yarnpkg/plugin-conditions.js"
|
||||
|
||||
releaseTool:
|
||||
ignoreChanges:
|
||||
@ -16,11 +18,17 @@ releaseTool:
|
||||
- "**/test/**"
|
||||
- codemods/**
|
||||
- "@(!(native-modules|built-ins|plugins|package)).json"
|
||||
|
||||
implicitDependencies:
|
||||
"@babel/runtime": ["@babel/helpers"]
|
||||
"@babel/runtime-corejs2": ["@babel/helpers"]
|
||||
"@babel/runtime-corejs3": ["@babel/helpers"]
|
||||
"@babel/runtime":
|
||||
- "@babel/helpers"
|
||||
"@babel/runtime-corejs2":
|
||||
- "@babel/helpers"
|
||||
"@babel/runtime-corejs3":
|
||||
- "@babel/helpers"
|
||||
|
||||
conditions:
|
||||
BABEL_8_BREAKING:
|
||||
default: false
|
||||
|
||||
unsafeHttpWhitelist:
|
||||
- localhost
|
||||
|
||||
@ -293,6 +293,16 @@ function pluginToggleBabel8Breaking({ types: t }, { breaking }) {
|
||||
keepConsequent = !keepConsequent;
|
||||
}
|
||||
|
||||
// yarn-plugin-conditions inject bool(process.env.BABEL_8_BREAKING)
|
||||
// tests, to properly cast the env variable to a boolean.
|
||||
if (
|
||||
test.isCallExpression() &&
|
||||
test.get("callee").isIdentifier({ name: "bool" }) &&
|
||||
test.get("arguments").length === 1
|
||||
) {
|
||||
test = test.get("arguments")[0];
|
||||
}
|
||||
|
||||
if (!test.matchesPattern("process.env.BABEL_8_BREAKING")) return;
|
||||
|
||||
path.replaceWith(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user