@budsbox/constraints 2.1.2 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -30,10 +30,18 @@ const createPeerDependenciesConstraint = ({ allowPrivates = false, autoImportFro
|
|
|
30
30
|
.filter(guards_1.isTruly)
|
|
31
31
|
.map((glob) => micromatch.matcher(glob));
|
|
32
32
|
const depsToAutoImportPeersFrom = new Map(Yarn.dependencies()
|
|
33
|
-
.filter(({ ident,
|
|
34
|
-
(0, logical_1.sure)(resolution, (res) => res.peerDependencies.size > 0, false) &&
|
|
33
|
+
.filter(({ ident, type }) => type !== 'peerDependencies' &&
|
|
35
34
|
autoImportMatchers.some((matcher) => matcher(ident)))
|
|
36
|
-
.map((dep) =>
|
|
35
|
+
.map((dep) => {
|
|
36
|
+
return [
|
|
37
|
+
dep,
|
|
38
|
+
(0, logical_1.sure)(dep.resolution?.workspace, (workspace) => {
|
|
39
|
+
const manifest = (0, utils_1.getManifest)(workspace);
|
|
40
|
+
return (0, logical_1.sure)(manifest.peerDependencies, (peerDeps) => new Map(Object.entries(peerDeps).filter(([ident]) => !manifest.peerDependenciesMeta?.[ident]?.optional)), new Map());
|
|
41
|
+
}, dep.resolution?.peerDependencies ?? new Map()),
|
|
42
|
+
];
|
|
43
|
+
})
|
|
44
|
+
.filter(([, peerDependencies]) => peerDependencies.size > 0));
|
|
37
45
|
for (const workspace of Yarn.workspaces()) {
|
|
38
46
|
const isPrivate = (0, guards_1.hasProp)((0, utils_1.getManifest)(workspace), 'private', guards_1.isTrue);
|
|
39
47
|
for (const peerDependency of Yarn.dependencies({
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.constraintRootDependencies = void 0;
|
|
4
4
|
const guards_1 = require("@budsbox/lib-es/guards");
|
|
5
5
|
const utils_1 = require("../utils");
|
|
6
|
+
const guards_2 = require("@budsbox/lib-es/guards");
|
|
6
7
|
/**
|
|
7
8
|
* A constraint function that enforces the consistency of dependencies among Yarn workspaces.
|
|
8
9
|
* It ensures that if a dependency exists with multiple version ranges across different workspaces,
|
|
@@ -16,6 +17,11 @@ const utils_1 = require("../utils");
|
|
|
16
17
|
*/
|
|
17
18
|
const constraintRootDependencies = ({ Yarn }) => {
|
|
18
19
|
const root = (0, utils_1.getRootWs)(Yarn);
|
|
20
|
+
for (const ws of Yarn.workspaces()) {
|
|
21
|
+
if (ws !== root && (0, guards_2.isNotNil)(ws.ident)) {
|
|
22
|
+
root.set(['dependencies', ws.ident], 'workspace:^');
|
|
23
|
+
}
|
|
24
|
+
}
|
|
19
25
|
const dependencyRecords = Yarn.workspaces()
|
|
20
26
|
.filter((ws) => ws !== root)
|
|
21
27
|
.reduce((acc, workspace) => Yarn.dependencies({ workspace }).reduce((depAcc, { ident, range }) => ([
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@budsbox/constraints",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"homepage": "https://gitlab.com/budsbox/fe/seed",
|
|
5
5
|
"bugs": {
|
|
6
6
|
"url": "https://gitlab.com/budsbox/fe/seed/-/issues"
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"setup": "[ -f dist/dist.tsbuildinfo ] || run p:lib:setup"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@budsbox/lib-es": "^2.
|
|
36
|
+
"@budsbox/lib-es": "^2.2.0",
|
|
37
37
|
"@types/micromatch": "^4.0.9",
|
|
38
38
|
"@yarnpkg/types": "^4.0.1",
|
|
39
39
|
"micromatch": "^4.0.8",
|
|
@@ -42,11 +42,11 @@
|
|
|
42
42
|
"type-fest": "^4.32.0"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"@budsbox/eslint": "^1.0
|
|
46
|
-
"@budsbox/eslint_presets-node-lib": "^1.0.
|
|
47
|
-
"@budsbox/eslint_presets-tools": "^1.0.
|
|
48
|
-
"@budsbox/lib-types": "^1.
|
|
49
|
-
"@budsbox/tsconfigs": "^4.
|
|
45
|
+
"@budsbox/eslint": "^1.2.0",
|
|
46
|
+
"@budsbox/eslint_presets-node-lib": "^1.0.3",
|
|
47
|
+
"@budsbox/eslint_presets-tools": "^1.0.3",
|
|
48
|
+
"@budsbox/lib-types": "^1.1.0",
|
|
49
|
+
"@budsbox/tsconfigs": "^4.3.0",
|
|
50
50
|
"@budsbox/types": "^2.0.0",
|
|
51
51
|
"@eslint/js": "^9.26.0",
|
|
52
52
|
"@types/eslint": "^9.6.1",
|