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
chore: setup Yarn constraints #13363
Changes from all commits
beb30a4
b881c9c
d19f1a4
99e579a
68193c5
ca684e8
3dacee4
65ed375
cba830a
9ed9ebe
f8d02f1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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). | ||
Comment on lines
+55
to
+56
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. While I would love to do it, I'm not 100% sure that we can legally remove Sebastian, Logan and the other people from the existing Maybe we should add an explicit list of packages that can have a different author (it doesn't need to be maintained anyway, it's "legacy"), and only enforce We can probably replace @hzoo in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. While I'm not a lawyer the MIT license only requires that the license is included so based on that it's fine to change it as it's part of the "Software" and permission was granted to modify it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hey! Not a lawyer here either, but I worked a bit on licenses in the past. I just want to mention that license and author rights are two different things. I think the change here is fine as long as Sebastian and others' attributions are still present otherwise (an AUTHORS file, or maybe the output Other free software sometimes uses a CLA that enforces that every contribution's author rights are given to one single organization... but even this doesn't work in some countries (eg: France). My (unwanted) 2 cents :-) |
||
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). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are these two actually built for
>=6.9.0
but theengines.node
value wasn't updated back in the day or are they correct and special cased?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh good catch, they are both built for
6.9.0
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should I let them get updated or wait for the next major to be on the safe side?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets keep them for now, just to be safe.