-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
constraints.pro
19 lines (15 loc) · 1.04 KB
/
constraints.pro
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
% Yarn Constraints https://yarnpkg.com/features/constraints
% check with "yarn constraints" (fix w/ "yarn constraints --fix")
% reference for other constraints: https://github.com/babel/babel/blob/main/constraints.pro
% Enforces the license in all public workspaces
gen_enforced_field(WorkspaceCwd, 'license', 'MIT') :-
\+ workspace_field(WorkspaceCwd, 'private', true).
% Enforces that a dependency doesn't appear in both `dependencies` and `devDependencies`
gen_enforced_dependency(WorkspaceCwd, DependencyIdent, null, 'devDependencies') :-
workspace_has_dependency(WorkspaceCwd, DependencyIdent, _, 'devDependencies'),
workspace_has_dependency(WorkspaceCwd, DependencyIdent, _, 'dependencies').
% Force all workspace dependencies to be made explicit
% https://yarnpkg.com/features/constraints#force-all-workspace-dependencies-to-be-made-explicit
gen_enforced_dependency(WorkspaceCwd, DependencyIdent, 'workspace:^', DependencyType) :-
workspace_ident(_, DependencyIdent),
workspace_has_dependency(WorkspaceCwd, DependencyIdent, _, DependencyType).