Skip to content

Commit

Permalink
chore: setup Yarn constraints (#13363)
Browse files Browse the repository at this point in the history
  • Loading branch information
merceyz committed May 31, 2021
1 parent 0b29b5c commit 140ec5a
Show file tree
Hide file tree
Showing 161 changed files with 926 additions and 316 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/ci.yml
Expand Up @@ -23,11 +23,14 @@ jobs:
key: yarn-${{ hashFiles('yarn.lock') }}
restore-keys: |
yarn-
- name: Check Yarn dedupe
- name: 'Check for unmet constraints (fix w/ "yarn constraints --fix")'
run: |
yarn constraints
- name: 'Check for duplicate dependencies (fix w/ "yarn dedupe")'
if: steps.yarn-cache.outputs.cache-hit != 'true'
run: |
yarn dedupe --check
- name: Check or update Yarn cache
- name: 'Check or update Yarn cache (fix w/ "yarn install")'
env:
YARN_ENABLE_SCRIPTS: false # disable post-install scripts
YARN_NODE_LINKER: pnp # use pnp linker for better linking performance: it's meant to update yarn cache only
Expand Down
8 changes: 8 additions & 0 deletions .yarn/plugins/@yarnpkg/plugin-constraints.cjs

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions .yarn/releases/yarn-2.4.1.cjs

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions .yarnrc.yml
Expand Up @@ -13,6 +13,8 @@ plugins:
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"
- path: .yarn/plugins/@yarnpkg/plugin-constraints.cjs
spec: "@yarnpkg/plugin-constraints"

releaseTool:
ignoreChanges:
Expand Down
Expand Up @@ -11,7 +11,7 @@
"publishConfig": {
"access": "public"
},
"main": "lib/index.js",
"main": "./lib/index.js",
"keywords": [
"@babel/codemod",
"@babel/plugin"
Expand All @@ -25,5 +25,9 @@
"devDependencies": {
"@babel/core": "workspace:*",
"@babel/helper-plugin-test-runner": "workspace:*"
}
},
"engines": {
"node": ">=6.9.0"
},
"author": "The Babel Team (https://babel.dev/team)"
}
Expand Up @@ -5,13 +5,13 @@
"repository": {
"type": "git",
"url": "https://github.com/babel/babel.git",
"directory": "codemods/babel-plugin-codemod-remove-unused-catch-binding"
"directory": "codemods/babel-plugin-codemod-optional-catch-binding"
},
"license": "MIT",
"publishConfig": {
"access": "public"
},
"main": "lib/index.js",
"main": "./lib/index.js",
"keywords": [
"@babel/codemod",
"@babel/plugin"
Expand All @@ -25,5 +25,9 @@
"devDependencies": {
"@babel/core": "workspace:*",
"@babel/helper-plugin-test-runner": "workspace:*"
}
},
"engines": {
"node": ">=6.9.0"
},
"author": "The Babel Team (https://babel.dev/team)"
}
69 changes: 69 additions & 0 deletions constraints.pro
@@ -0,0 +1,69 @@
% Enforces that all workspaces depend on other workspaces using `workspace:*` in devDependencies
gen_enforced_dependency(WorkspaceCwd, DependencyIdent, 'workspace:*', 'devDependencies') :-
workspace_has_dependency(WorkspaceCwd, DependencyIdent, DependencyRange, 'devDependencies'),
% Only consider dependency ranges that start with 'workspace:'
atom_concat('workspace:', _, DependencyRange).

% Enforces the license in all public workspaces while removing it from private workspaces
gen_enforced_field(WorkspaceCwd, 'license', 'MIT') :-
\+ workspace_field(WorkspaceCwd, 'private', true).
gen_enforced_field(WorkspaceCwd, 'license', null) :-
workspace_field(WorkspaceCwd, 'private', true).

% Enforces the repository field for all public workspaces while removing it from private workspaces
gen_enforced_field(WorkspaceCwd, 'repository.type', 'git') :-
\+ workspace_field(WorkspaceCwd, 'private', true).
gen_enforced_field(WorkspaceCwd, 'repository.url', 'https://github.com/babel/babel.git') :-
\+ workspace_field(WorkspaceCwd, 'private', true).
gen_enforced_field(WorkspaceCwd, 'repository.directory', WorkspaceCwd) :-
\+ workspace_field(WorkspaceCwd, 'private', true).
gen_enforced_field(WorkspaceCwd, 'repository', null) :-
workspace_field(WorkspaceCwd, 'private', true).

% Enforces 'publishConfig.access' is set to public for public workspaces while removing it from private workspaces
gen_enforced_field(WorkspaceCwd, 'publishConfig.access', 'public') :-
\+ workspace_field(WorkspaceCwd, 'private', true).
gen_enforced_field(WorkspaceCwd, 'publishConfig.access', null) :-
workspace_field(WorkspaceCwd, 'private', true).

% Enforces the engines.node field for all workspaces except '@babel/eslint*'
gen_enforced_field(WorkspaceCwd, 'engines.node', '>=6.9.0') :-
\+ workspace_field(WorkspaceCwd, 'private', true),
% Get the workspace name
workspace_ident(WorkspaceCwd, WorkspaceIdent),
% Exempt from the rule as it supports '>=4'. TODO: remove with the next major
WorkspaceIdent \= '@babel/plugin-proposal-unicode-property-regex',
% Exempt from the rule as it supports '>=6.0.0'. TODO: remove with the next major
WorkspaceIdent \= '@babel/parser',
% Skip '@babel/eslint*' workspaces. TODO: remove with the next major
\+ atom_concat('@babel/eslint', _, WorkspaceIdent).

% Enforces the engines.node field for '@babel/eslint*' workspaces
% TODO: remove with the next major
gen_enforced_field(WorkspaceCwd, 'engines.node', '^10.13.0 || ^12.13.0 || >=14.0.0') :-
\+ workspace_field(WorkspaceCwd, 'private', true),
% Get the workspace name
workspace_ident(WorkspaceCwd, WorkspaceIdent),
% Only target '@babel/eslint*' workspaces
atom_concat('@babel/eslint', _, WorkspaceIdent).

% Removes the 'engines.node' field from private workspaces
gen_enforced_field(WorkspaceCwd, 'engines.node', null) :-
workspace_field(WorkspaceCwd, 'private', true).

% Enforces the author field to be consistent
gen_enforced_field(WorkspaceCwd, 'author', 'The Babel Team (https://babel.dev/team)') :-
\+ workspace_field(WorkspaceCwd, 'private', true).
gen_enforced_field(WorkspaceCwd, 'author', null) :-
workspace_field(WorkspaceCwd, 'private', true).

% Enforces the main and types field to start with ./
gen_enforced_field(WorkspaceCwd, FieldName, ExpectedValue) :-
% Fields the rule applies to
member(FieldName, ['main', 'types']),
% Get current value
workspace_field(WorkspaceCwd, FieldName, CurrentValue),
% Must not start with ./ already
\+ atom_concat('./', _, CurrentValue),
% Store './' + CurrentValue in ExpectedValue
atom_concat('./', CurrentValue, ExpectedValue).
7 changes: 0 additions & 7 deletions eslint/babel-eslint-config-internal/package.json
Expand Up @@ -2,13 +2,6 @@
"name": "@babel/eslint-config-internal",
"version": "7.12.13",
"description": "The Babel Team's ESLint configuration. Since it's internal, it might not respect semver.",
"author": "The Babel Team (https://babel.dev/team)",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/babel/babel.git",
"directory": "eslint/babel-eslint-config-internal"
},
"private": true,
"main": "./index.js",
"type": "commonjs",
Expand Down
9 changes: 1 addition & 8 deletions eslint/babel-eslint-plugin-development-internal/package.json
Expand Up @@ -2,21 +2,14 @@
"name": "@babel/eslint-plugin-development-internal",
"version": "7.14.0",
"description": "The Babel Team's ESLint custom rules plugin. Since it's internal, it might not respect semver.",
"main": "lib/index.js",
"repository": {
"type": "git",
"url": "git+https://github.com/babel/babel.git",
"directory": "eslint/babel-eslint-plugin-development-internal"
},
"main": "./lib/index.js",
"keywords": [
"babel",
"eslint",
"eslintplugin",
"eslint-plugin",
"babel-eslint"
],
"author": "Kai Cataldo <kai@kaicataldo.com>",
"license": "MIT",
"private": true,
"bugs": {
"url": "https://github.com/babel/babel/issues"
Expand Down
6 changes: 1 addition & 5 deletions eslint/babel-eslint-plugin-development/package.json
Expand Up @@ -7,11 +7,7 @@
"eslintplugin",
"eslint-plugin"
],
"author": {
"name": "Nicolò Ribaudo",
"email": "nicolo.ribaudo@gmail.com",
"url": "https://github.com/nicolo-ribaudo"
},
"author": "The Babel Team (https://babel.dev/team)",
"main": "./lib/index.js",
"type": "commonjs",
"exports": {
Expand Down
2 changes: 1 addition & 1 deletion eslint/babel-eslint-plugin/package.json
Expand Up @@ -23,7 +23,7 @@
"eslint-plugin",
"babel-eslint"
],
"author": "Jason Quense @monasticpanic",
"author": "The Babel Team (https://babel.dev/team)",
"license": "MIT",
"engines": {
"node": "^10.13.0 || ^12.13.0 || >=14.0.0"
Expand Down
1 change: 0 additions & 1 deletion eslint/babel-eslint-shared-fixtures/package.json
Expand Up @@ -2,7 +2,6 @@
"name": "@babel/eslint-shared-fixtures",
"version": "7.12.13",
"description": "Shared fixtures for testing @babel/eslint-* packages",
"license": "MIT",
"private": true,
"dependencies": {
"@babel/core": "workspace:^7.12.13",
Expand Down
1 change: 0 additions & 1 deletion eslint/babel-eslint-tests/package.json
Expand Up @@ -2,7 +2,6 @@
"name": "@babel/eslint-tests",
"version": "7.14.4",
"description": "Tests for babel/eslint-* packages",
"license": "MIT",
"private": true,
"dependencies": {
"@babel/core": "workspace:^7.14.3",
Expand Down
2 changes: 0 additions & 2 deletions package.json
Expand Up @@ -2,7 +2,6 @@
"name": "babel",
"version": "7.14.4",
"private": true,
"license": "MIT",
"type": "commonjs",
"scripts": {
"bootstrap": "make bootstrap",
Expand Down Expand Up @@ -90,7 +89,6 @@
"babel-plugin-polyfill-corejs2/@babel/compat-data": "workspace:*"
},
"engines": {
"node": ">= 6.9.0",
"yarn": ">=1.4.0"
},
"lint-staged": {
Expand Down
5 changes: 4 additions & 1 deletion packages/babel-cli/package.json
Expand Up @@ -2,7 +2,7 @@
"name": "@babel/cli",
"version": "7.14.3",
"description": "Babel command line.",
"author": "Sebastian McKenzie <sebmck@gmail.com>",
"author": "The Babel Team (https://babel.dev/team)",
"homepage": "https://babel.dev/docs/en/next/babel-cli",
"bugs": "https://github.com/babel/babel/issues?utf8=%E2%9C%93&q=is%3Aissue+label%3A%22pkg%3A%20cli%22+is%3Aopen",
"license": "MIT",
Expand Down Expand Up @@ -47,5 +47,8 @@
"bin": {
"babel": "./bin/babel.js",
"babel-external-helpers": "./bin/babel-external-helpers.js"
},
"engines": {
"node": ">=6.9.0"
}
}
7 changes: 5 additions & 2 deletions packages/babel-code-frame/package.json
Expand Up @@ -2,7 +2,7 @@
"name": "@babel/code-frame",
"version": "7.12.13",
"description": "Generate errors that contain a code frame that point to source locations.",
"author": "Sebastian McKenzie <sebmck@gmail.com>",
"author": "The Babel Team (https://babel.dev/team)",
"homepage": "https://babel.dev/docs/en/next/babel-code-frame",
"bugs": "https://github.com/babel/babel/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aopen",
"license": "MIT",
Expand All @@ -14,13 +14,16 @@
"url": "https://github.com/babel/babel.git",
"directory": "packages/babel-code-frame"
},
"main": "lib/index.js",
"main": "./lib/index.js",
"dependencies": {
"@babel/highlight": "workspace:^7.12.13"
},
"devDependencies": {
"@types/chalk": "^2.0.0",
"chalk": "^2.0.0",
"strip-ansi": "^4.0.0"
},
"engines": {
"node": ">=6.9.0"
}
}
3 changes: 3 additions & 0 deletions packages/babel-compat-data/package.json
Expand Up @@ -32,5 +32,8 @@
"@mdn/browser-compat-data": "^3.3.4",
"core-js-compat": "^3.9.0",
"electron-to-chromium": "^1.3.738"
},
"engines": {
"node": ">=6.9.0"
}
}
4 changes: 2 additions & 2 deletions packages/babel-core/package.json
Expand Up @@ -2,8 +2,8 @@
"name": "@babel/core",
"version": "7.14.3",
"description": "Babel compiler core.",
"main": "lib/index.js",
"author": "Sebastian McKenzie <sebmck@gmail.com>",
"main": "./lib/index.js",
"author": "The Babel Team (https://babel.dev/team)",
"license": "MIT",
"publishConfig": {
"access": "public"
Expand Down
7 changes: 5 additions & 2 deletions packages/babel-generator/package.json
Expand Up @@ -2,7 +2,7 @@
"name": "@babel/generator",
"version": "7.14.3",
"description": "Turns an AST into code.",
"author": "Sebastian McKenzie <sebmck@gmail.com>",
"author": "The Babel Team (https://babel.dev/team)",
"license": "MIT",
"publishConfig": {
"access": "public"
Expand All @@ -14,7 +14,7 @@
},
"homepage": "https://babel.dev/docs/en/next/babel-generator",
"bugs": "https://github.com/babel/babel/issues?utf8=%E2%9C%93&q=is%3Aissue+label%3A%22pkg%3A%20generator%22+is%3Aopen",
"main": "lib/index.js",
"main": "./lib/index.js",
"files": [
"lib"
],
Expand All @@ -28,5 +28,8 @@
"@babel/parser": "workspace:*",
"@types/jsesc": "^2.5.0",
"@types/source-map": "^0.5.0"
},
"engines": {
"node": ">=6.9.0"
}
}
8 changes: 6 additions & 2 deletions packages/babel-helper-annotate-as-pure/package.json
Expand Up @@ -12,8 +12,12 @@
"publishConfig": {
"access": "public"
},
"main": "lib/index.js",
"main": "./lib/index.js",
"dependencies": {
"@babel/types": "workspace:^7.12.13"
}
},
"engines": {
"node": ">=6.9.0"
},
"author": "The Babel Team (https://babel.dev/team)"
}
Expand Up @@ -12,9 +12,13 @@
"publishConfig": {
"access": "public"
},
"main": "lib/index.js",
"main": "./lib/index.js",
"dependencies": {
"@babel/helper-explode-assignable-expression": "workspace:^7.12.13",
"@babel/types": "workspace:^7.12.13"
}
},
"engines": {
"node": ">=6.9.0"
},
"author": "The Babel Team (https://babel.dev/team)"
}
8 changes: 6 additions & 2 deletions packages/babel-helper-builder-react-jsx/package.json
Expand Up @@ -12,9 +12,13 @@
"publishConfig": {
"access": "public"
},
"main": "lib/index.js",
"main": "./lib/index.js",
"dependencies": {
"@babel/helper-annotate-as-pure": "workspace:^7.12.13",
"@babel/types": "workspace:^7.12.13"
}
},
"engines": {
"node": ">=6.9.0"
},
"author": "The Babel Team (https://babel.dev/team)"
}
5 changes: 4 additions & 1 deletion packages/babel-helper-compilation-targets/package.json
Expand Up @@ -9,7 +9,7 @@
"url": "https://github.com/babel/babel.git",
"directory": "packages/babel-helper-compilation-targets"
},
"main": "lib/index.js",
"main": "./lib/index.js",
"exports": {
".": "./lib/index.js"
},
Expand All @@ -33,5 +33,8 @@
"@babel/core": "workspace:*",
"@babel/helper-plugin-test-runner": "workspace:*",
"@types/semver": "^5.5.0"
},
"engines": {
"node": ">=6.9.0"
}
}

0 comments on commit 140ec5a

Please sign in to comment.