Skip to content

Commit

Permalink
Fix constraints validation
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolo-ribaudo committed May 15, 2024
1 parent 1519a1b commit d550a2f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
10 changes: 7 additions & 3 deletions yarn.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -253,9 +253,13 @@ gen_enforced_dependency(WorkspaceCwd, DependencyIdent, null, 'dependencies') :-
function enforceBabelHelperBabelDeps({ Yarn }) {
for (const workspace of Yarn.workspaces()) {
if (workspace.ident?.startsWith("@babel/helper-")) {
workspace.unset("dependencies['@babel/traverse']");

if (workspace.pkg.peerDependencies.has("@babel/core")) {
if (
workspace.pkg.peerDependencies.has("@babel/core") &&
// In some cases, we remove peerDependencies for Babel 7
workspace.manifest.conditions?.BABEL_8_BREAKING?.[1]
?.peerDependencies !== null
) {
workspace.unset("dependencies['@babel/traverse']");
workspace.unset("dependencies['@babel/template']");
workspace.unset("dependencies['@babel/types']");
}
Expand Down
8 changes: 6 additions & 2 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -571,6 +571,8 @@ __metadata:
"@babel/helper-annotate-as-pure": "workspace:^"
"@babel/traverse": "workspace:^"
"@babel/types": "workspace:^"
peerDependencies:
"@babel/core": ^7.0.0
languageName: unknown
linkType: soft

Expand Down Expand Up @@ -726,6 +728,8 @@ __metadata:
"@jridgewell/gen-mapping": "npm:^0.3.5"
"@types/semver": "npm:^7.3.4"
semver: "condition:BABEL_8_BREAKING ? ^7.3.4 : ^6.3.1"
peerDependencies:
"@babel/core": ^7.0.0
languageName: unknown
linkType: soft

Expand Down Expand Up @@ -851,7 +855,6 @@ __metadata:
version: 0.0.0-use.local
resolution: "@babel/helper-module-imports@workspace:packages/babel-helper-module-imports"
dependencies:
"@babel/core": "workspace:^"
"@babel/traverse": "workspace:^"
"@babel/types": "workspace:^"
languageName: unknown
Expand Down Expand Up @@ -897,7 +900,6 @@ __metadata:
"@babel/helper-simple-access": "workspace:^"
"@babel/helper-split-export-declaration": "workspace:^"
"@babel/helper-validator-identifier": "workspace:^"
"@babel/traverse": "workspace:^"
peerDependencies:
"@babel/core": ^7.0.0
languageName: unknown
Expand Down Expand Up @@ -949,6 +951,8 @@ __metadata:
resolution: "@babel/helper-plugin-utils@workspace:packages/babel-helper-plugin-utils"
dependencies:
"@babel/core": "workspace:^"
peerDependencies:
"@babel/core": ^7.0.0
languageName: unknown
linkType: soft

Expand Down

0 comments on commit d550a2f

Please sign in to comment.