Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 140ec5a

Browse files
authored
chore: setup Yarn constraints (#13363)
1 parent 0b29b5c commit 140ec5a

File tree

161 files changed

+926
-316
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

161 files changed

+926
-316
lines changed

.github/workflows/ci.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,14 @@ jobs:
2323
key: yarn-${{ hashFiles('yarn.lock') }}
2424
restore-keys: |
2525
yarn-
26-
- name: Check Yarn dedupe
26+
- name: 'Check for unmet constraints (fix w/ "yarn constraints --fix")'
27+
run: |
28+
yarn constraints
29+
- name: 'Check for duplicate dependencies (fix w/ "yarn dedupe")'
2730
if: steps.yarn-cache.outputs.cache-hit != 'true'
2831
run: |
2932
yarn dedupe --check
30-
- name: Check or update Yarn cache
33+
- name: 'Check or update Yarn cache (fix w/ "yarn install")'
3134
env:
3235
YARN_ENABLE_SCRIPTS: false # disable post-install scripts
3336
YARN_NODE_LINKER: pnp # use pnp linker for better linking performance: it's meant to update yarn cache only

.yarn/plugins/@yarnpkg/plugin-constraints.cjs

Lines changed: 8 additions & 0 deletions
Large diffs are not rendered by default.

.yarn/releases/yarn-2.4.1.cjs

Lines changed: 2 additions & 2 deletions
Large diffs are not rendered by default.

.yarnrc.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ plugins:
1313
spec: "https://raw.githubusercontent.com/nicolo-ribaudo/yarn-plugin-babel-release-tool/main/bundles/%40yarnpkg/plugin-babel-release-tool.js"
1414
- path: .yarn/plugins/@yarnpkg/plugin-conditions.cjs
1515
spec: "https://raw.githubusercontent.com/nicolo-ribaudo/yarn-plugin-conditions/main/bundles/%40yarnpkg/plugin-conditions.js"
16+
- path: .yarn/plugins/@yarnpkg/plugin-constraints.cjs
17+
spec: "@yarnpkg/plugin-constraints"
1618

1719
releaseTool:
1820
ignoreChanges:

codemods/babel-plugin-codemod-object-assign-to-object-spread/package.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"publishConfig": {
1212
"access": "public"
1313
},
14-
"main": "lib/index.js",
14+
"main": "./lib/index.js",
1515
"keywords": [
1616
"@babel/codemod",
1717
"@babel/plugin"
@@ -25,5 +25,9 @@
2525
"devDependencies": {
2626
"@babel/core": "workspace:*",
2727
"@babel/helper-plugin-test-runner": "workspace:*"
28-
}
28+
},
29+
"engines": {
30+
"node": ">=6.9.0"
31+
},
32+
"author": "The Babel Team (https://babel.dev/team)"
2933
}

codemods/babel-plugin-codemod-optional-catch-binding/package.json

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@
55
"repository": {
66
"type": "git",
77
"url": "https://github.com/babel/babel.git",
8-
"directory": "codemods/babel-plugin-codemod-remove-unused-catch-binding"
8+
"directory": "codemods/babel-plugin-codemod-optional-catch-binding"
99
},
1010
"license": "MIT",
1111
"publishConfig": {
1212
"access": "public"
1313
},
14-
"main": "lib/index.js",
14+
"main": "./lib/index.js",
1515
"keywords": [
1616
"@babel/codemod",
1717
"@babel/plugin"
@@ -25,5 +25,9 @@
2525
"devDependencies": {
2626
"@babel/core": "workspace:*",
2727
"@babel/helper-plugin-test-runner": "workspace:*"
28-
}
28+
},
29+
"engines": {
30+
"node": ">=6.9.0"
31+
},
32+
"author": "The Babel Team (https://babel.dev/team)"
2933
}

constraints.pro

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
% Enforces that all workspaces depend on other workspaces using `workspace:*` in devDependencies
2+
gen_enforced_dependency(WorkspaceCwd, DependencyIdent, 'workspace:*', 'devDependencies') :-
3+
workspace_has_dependency(WorkspaceCwd, DependencyIdent, DependencyRange, 'devDependencies'),
4+
% Only consider dependency ranges that start with 'workspace:'
5+
atom_concat('workspace:', _, DependencyRange).
6+
7+
% Enforces the license in all public workspaces while removing it from private workspaces
8+
gen_enforced_field(WorkspaceCwd, 'license', 'MIT') :-
9+
\+ workspace_field(WorkspaceCwd, 'private', true).
10+
gen_enforced_field(WorkspaceCwd, 'license', null) :-
11+
workspace_field(WorkspaceCwd, 'private', true).
12+
13+
% Enforces the repository field for all public workspaces while removing it from private workspaces
14+
gen_enforced_field(WorkspaceCwd, 'repository.type', 'git') :-
15+
\+ workspace_field(WorkspaceCwd, 'private', true).
16+
gen_enforced_field(WorkspaceCwd, 'repository.url', 'https://github.com/babel/babel.git') :-
17+
\+ workspace_field(WorkspaceCwd, 'private', true).
18+
gen_enforced_field(WorkspaceCwd, 'repository.directory', WorkspaceCwd) :-
19+
\+ workspace_field(WorkspaceCwd, 'private', true).
20+
gen_enforced_field(WorkspaceCwd, 'repository', null) :-
21+
workspace_field(WorkspaceCwd, 'private', true).
22+
23+
% Enforces 'publishConfig.access' is set to public for public workspaces while removing it from private workspaces
24+
gen_enforced_field(WorkspaceCwd, 'publishConfig.access', 'public') :-
25+
\+ workspace_field(WorkspaceCwd, 'private', true).
26+
gen_enforced_field(WorkspaceCwd, 'publishConfig.access', null) :-
27+
workspace_field(WorkspaceCwd, 'private', true).
28+
29+
% Enforces the engines.node field for all workspaces except '@babel/eslint*'
30+
gen_enforced_field(WorkspaceCwd, 'engines.node', '>=6.9.0') :-
31+
\+ workspace_field(WorkspaceCwd, 'private', true),
32+
% Get the workspace name
33+
workspace_ident(WorkspaceCwd, WorkspaceIdent),
34+
% Exempt from the rule as it supports '>=4'. TODO: remove with the next major
35+
WorkspaceIdent \= '@babel/plugin-proposal-unicode-property-regex',
36+
% Exempt from the rule as it supports '>=6.0.0'. TODO: remove with the next major
37+
WorkspaceIdent \= '@babel/parser',
38+
% Skip '@babel/eslint*' workspaces. TODO: remove with the next major
39+
\+ atom_concat('@babel/eslint', _, WorkspaceIdent).
40+
41+
% Enforces the engines.node field for '@babel/eslint*' workspaces
42+
% TODO: remove with the next major
43+
gen_enforced_field(WorkspaceCwd, 'engines.node', '^10.13.0 || ^12.13.0 || >=14.0.0') :-
44+
\+ workspace_field(WorkspaceCwd, 'private', true),
45+
% Get the workspace name
46+
workspace_ident(WorkspaceCwd, WorkspaceIdent),
47+
% Only target '@babel/eslint*' workspaces
48+
atom_concat('@babel/eslint', _, WorkspaceIdent).
49+
50+
% Removes the 'engines.node' field from private workspaces
51+
gen_enforced_field(WorkspaceCwd, 'engines.node', null) :-
52+
workspace_field(WorkspaceCwd, 'private', true).
53+
54+
% Enforces the author field to be consistent
55+
gen_enforced_field(WorkspaceCwd, 'author', 'The Babel Team (https://babel.dev/team)') :-
56+
\+ workspace_field(WorkspaceCwd, 'private', true).
57+
gen_enforced_field(WorkspaceCwd, 'author', null) :-
58+
workspace_field(WorkspaceCwd, 'private', true).
59+
60+
% Enforces the main and types field to start with ./
61+
gen_enforced_field(WorkspaceCwd, FieldName, ExpectedValue) :-
62+
% Fields the rule applies to
63+
member(FieldName, ['main', 'types']),
64+
% Get current value
65+
workspace_field(WorkspaceCwd, FieldName, CurrentValue),
66+
% Must not start with ./ already
67+
\+ atom_concat('./', _, CurrentValue),
68+
% Store './' + CurrentValue in ExpectedValue
69+
atom_concat('./', CurrentValue, ExpectedValue).

eslint/babel-eslint-config-internal/package.json

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,6 @@
22
"name": "@babel/eslint-config-internal",
33
"version": "7.12.13",
44
"description": "The Babel Team's ESLint configuration. Since it's internal, it might not respect semver.",
5-
"author": "The Babel Team (https://babel.dev/team)",
6-
"license": "MIT",
7-
"repository": {
8-
"type": "git",
9-
"url": "https://github.com/babel/babel.git",
10-
"directory": "eslint/babel-eslint-config-internal"
11-
},
125
"private": true,
136
"main": "./index.js",
147
"type": "commonjs",

eslint/babel-eslint-plugin-development-internal/package.json

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,14 @@
22
"name": "@babel/eslint-plugin-development-internal",
33
"version": "7.14.0",
44
"description": "The Babel Team's ESLint custom rules plugin. Since it's internal, it might not respect semver.",
5-
"main": "lib/index.js",
6-
"repository": {
7-
"type": "git",
8-
"url": "git+https://github.com/babel/babel.git",
9-
"directory": "eslint/babel-eslint-plugin-development-internal"
10-
},
5+
"main": "./lib/index.js",
116
"keywords": [
127
"babel",
138
"eslint",
149
"eslintplugin",
1510
"eslint-plugin",
1611
"babel-eslint"
1712
],
18-
"author": "Kai Cataldo <[email protected]>",
19-
"license": "MIT",
2013
"private": true,
2114
"bugs": {
2215
"url": "https://github.com/babel/babel/issues"

eslint/babel-eslint-plugin-development/package.json

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,7 @@
77
"eslintplugin",
88
"eslint-plugin"
99
],
10-
"author": {
11-
"name": "Nicolò Ribaudo",
12-
"email": "[email protected]",
13-
"url": "https://github.com/nicolo-ribaudo"
14-
},
10+
"author": "The Babel Team (https://babel.dev/team)",
1511
"main": "./lib/index.js",
1612
"type": "commonjs",
1713
"exports": {

0 commit comments

Comments
 (0)