@budsbox/constraints 1.0.2 → 2.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.
- package/dist/base.d.ts +5 -7
- package/dist/base.d.ts.map +1 -1
- package/dist/base.js +2 -2
- package/dist/dependencies/index.d.ts +1 -1
- package/dist/dependencies/index.d.ts.map +1 -1
- package/dist/dependencies/index.js +2 -2
- package/dist/dependencies/peer.d.ts +4 -2
- package/dist/dependencies/peer.d.ts.map +1 -1
- package/dist/dependencies/peer.js +8 -5
- package/dist/dependencies/workspace.d.ts +3 -3
- package/dist/dependencies/workspace.d.ts.map +1 -1
- package/dist/dependencies/workspace.js +2 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/utils.d.ts +1 -1
- package/dist/utils.d.ts.map +1 -1
- package/package.json +5 -4
package/dist/base.d.ts
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type ConstraintFactory } from './utils';
|
|
2
2
|
import { type Constraint } from './utils';
|
|
3
3
|
export declare const constraintPackageName: Constraint;
|
|
4
|
-
export declare const createManifestFieldsConstraint:
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
9
|
-
]>;
|
|
4
|
+
export declare const createManifestFieldsConstraint: ConstraintFactory<{
|
|
5
|
+
readonly sharedFields: readonly string[];
|
|
6
|
+
readonly requiredFields?: ReadonlyArray<string | [string, unknown]>;
|
|
7
|
+
}>;
|
|
10
8
|
//# sourceMappingURL=base.d.ts.map
|
package/dist/base.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../src/base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../src/base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,iBAAiB,EAAiC,MAAM,SAAS,CAAC;AAEhF,OAAO,EAAE,KAAK,UAAU,EAAa,MAAM,SAAS,CAAC;AAErD,eAAO,MAAM,qBAAqB,EAAE,UAwBnC,CAAC;AAEF,eAAO,MAAM,8BAA8B,EAAE,iBAAiB,CAAC;IAC7D,QAAQ,CAAC,YAAY,EAAE,SAAS,MAAM,EAAE,CAAC;IACzC,QAAQ,CAAC,cAAc,CAAC,EAAE,aAAa,CAAC,MAAM,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;CACrE,CAoBE,CAAC"}
|
package/dist/base.js
CHANGED
|
@@ -27,13 +27,13 @@ const constraintPackageName = ({ Yarn }) => {
|
|
|
27
27
|
}
|
|
28
28
|
};
|
|
29
29
|
exports.constraintPackageName = constraintPackageName;
|
|
30
|
-
const createManifestFieldsConstraint = ({ sharedFields, requiredFields }) => function constraintManifestFields({ Yarn }) {
|
|
30
|
+
const createManifestFieldsConstraint = ({ sharedFields, requiredFields = [] }) => function constraintManifestFields({ Yarn }) {
|
|
31
31
|
const rootManifest = (0, utils_1.getManifest)((0, utils_2.getRootWs)(Yarn));
|
|
32
32
|
for (const workspace of Yarn.workspaces()) {
|
|
33
33
|
for (const field of sharedFields) {
|
|
34
34
|
workspace.set(field, rootManifest[field]);
|
|
35
35
|
}
|
|
36
|
-
for (const field of [['type', 'module'], ...
|
|
36
|
+
for (const field of [['type', 'module'], ...requiredFields]) {
|
|
37
37
|
const [key, value] = Array.isArray(field) ? field : [field, null];
|
|
38
38
|
const manifest = (0, utils_1.getManifest)(workspace);
|
|
39
39
|
if (!Object.hasOwn(manifest, key)) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { constraintRootDependencies } from './root.js';
|
|
2
|
-
export {
|
|
2
|
+
export { createPeerDependenciesConstraint } from './peer.js';
|
|
3
3
|
export { createWorkspaceDependenciesConstraint } from './workspace.js';
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/dependencies/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,WAAW,CAAC;AACvD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/dependencies/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,WAAW,CAAC;AACvD,OAAO,EAAE,gCAAgC,EAAE,MAAM,WAAW,CAAC;AAC7D,OAAO,EAAE,qCAAqC,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createWorkspaceDependenciesConstraint = exports.
|
|
3
|
+
exports.createWorkspaceDependenciesConstraint = exports.createPeerDependenciesConstraint = exports.constraintRootDependencies = void 0;
|
|
4
4
|
var root_js_1 = require("./root.js");
|
|
5
5
|
Object.defineProperty(exports, "constraintRootDependencies", { enumerable: true, get: function () { return root_js_1.constraintRootDependencies; } });
|
|
6
6
|
var peer_js_1 = require("./peer.js");
|
|
7
|
-
Object.defineProperty(exports, "
|
|
7
|
+
Object.defineProperty(exports, "createPeerDependenciesConstraint", { enumerable: true, get: function () { return peer_js_1.createPeerDependenciesConstraint; } });
|
|
8
8
|
var workspace_js_1 = require("./workspace.js");
|
|
9
9
|
Object.defineProperty(exports, "createWorkspaceDependenciesConstraint", { enumerable: true, get: function () { return workspace_js_1.createWorkspaceDependenciesConstraint; } });
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
export declare const
|
|
1
|
+
import { type ConstraintFactory } from '../utils';
|
|
2
|
+
export declare const createPeerDependenciesConstraint: ConstraintFactory<{
|
|
3
|
+
readonly allowPrivates?: boolean;
|
|
4
|
+
}>;
|
|
3
5
|
//# sourceMappingURL=peer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"peer.d.ts","sourceRoot":"","sources":["../../src/dependencies/peer.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,
|
|
1
|
+
{"version":3,"file":"peer.d.ts","sourceRoot":"","sources":["../../src/dependencies/peer.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,iBAAiB,EAGvB,MAAM,UAAU,CAAC;AAElB,eAAO,MAAM,gCAAgC,EAAE,iBAAiB,CAAC;IAC/D,QAAQ,CAAC,aAAa,CAAC,EAAE,OAAO,CAAC;CAClC,CAgGE,CAAC"}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.createPeerDependenciesConstraint = void 0;
|
|
4
4
|
const utils_1 = require("../utils");
|
|
5
|
-
const
|
|
5
|
+
const createPeerDependenciesConstraint = ({ allowPrivates = false } = {}) => function constraintPeerDependencies({ Yarn }) {
|
|
6
6
|
for (const workspace of Yarn.workspaces()) {
|
|
7
7
|
const isPrivate = (0, utils_1.getManifest)(workspace).private === true;
|
|
8
8
|
for (const peerDependency of Yarn.dependencies({
|
|
9
9
|
workspace,
|
|
10
10
|
type: 'peerDependencies',
|
|
11
11
|
})) {
|
|
12
|
-
if (isPrivate) {
|
|
12
|
+
if (isPrivate && !allowPrivates) {
|
|
13
13
|
// private packages should have no peer dependencies
|
|
14
14
|
peerDependency.delete();
|
|
15
15
|
}
|
|
@@ -45,7 +45,10 @@ const constraintPeerDependencies = ({ Yarn }) => {
|
|
|
45
45
|
[
|
|
46
46
|
[
|
|
47
47
|
workspace.ident,
|
|
48
|
-
Yarn.dependencies({
|
|
48
|
+
Yarn.dependencies({
|
|
49
|
+
workspace,
|
|
50
|
+
type: 'peerDependencies',
|
|
51
|
+
}).filter(({ ident }) => peerDependenciesMeta[ident]?.optional !== true),
|
|
49
52
|
],
|
|
50
53
|
]
|
|
51
54
|
: [];
|
|
@@ -75,4 +78,4 @@ const constraintPeerDependencies = ({ Yarn }) => {
|
|
|
75
78
|
}
|
|
76
79
|
}
|
|
77
80
|
};
|
|
78
|
-
exports.
|
|
81
|
+
exports.createPeerDependenciesConstraint = createPeerDependenciesConstraint;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
export declare const createWorkspaceDependenciesConstraint:
|
|
1
|
+
import { type ConstraintFactory } from '../utils';
|
|
2
|
+
export declare const createWorkspaceDependenciesConstraint: ConstraintFactory<{
|
|
3
3
|
readonly bannedDependencies?: readonly string[];
|
|
4
|
-
}
|
|
4
|
+
}>;
|
|
5
5
|
//# sourceMappingURL=workspace.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workspace.d.ts","sourceRoot":"","sources":["../../src/dependencies/workspace.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"workspace.d.ts","sourceRoot":"","sources":["../../src/dependencies/workspace.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,iBAAiB,EAAa,MAAM,UAAU,CAAC;AAE7D,eAAO,MAAM,qCAAqC,EAAE,iBAAiB,CAAC;IACpE,QAAQ,CAAC,kBAAkB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CACjD,CAwBE,CAAC"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createWorkspaceDependenciesConstraint = void 0;
|
|
4
4
|
const utils_1 = require("../utils");
|
|
5
|
-
const createWorkspaceDependenciesConstraint = ({ bannedDependencies
|
|
5
|
+
const createWorkspaceDependenciesConstraint = ({ bannedDependencies = [] } = {}) => function constraintWorkspaceDependencies({ Yarn }) {
|
|
6
6
|
const root = (0, utils_1.getRootWs)(Yarn);
|
|
7
7
|
const workspaces = Yarn.workspaces();
|
|
8
8
|
for (const workspace of workspaces) {
|
|
@@ -14,7 +14,7 @@ const createWorkspaceDependenciesConstraint = ({ bannedDependencies, } = {}) =>
|
|
|
14
14
|
const banned = new Set([
|
|
15
15
|
root.ident,
|
|
16
16
|
workspace.ident,
|
|
17
|
-
...
|
|
17
|
+
...bannedDependencies,
|
|
18
18
|
]);
|
|
19
19
|
for (const dep of Yarn.dependencies({ workspace })) {
|
|
20
20
|
if (banned.has(dep.ident)) {
|
package/dist/index.d.ts
CHANGED
|
@@ -2,5 +2,5 @@ import type { Constraint, ConstraintOptions } from './utils.js';
|
|
|
2
2
|
export declare function runConstraintsSequence(options: ConstraintOptions, ...constraints: readonly Constraint[]): Promise<void>;
|
|
3
3
|
export { constraintPackageName, createManifestFieldsConstraint, } from './base.js';
|
|
4
4
|
export { constraintExports, constraintImports } from './esm.js';
|
|
5
|
-
export { constraintRootDependencies,
|
|
5
|
+
export { constraintRootDependencies, createPeerDependenciesConstraint, createWorkspaceDependenciesConstraint, } from './dependencies/index.js';
|
|
6
6
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAEhE,wBAAsB,sBAAsB,CAC1C,OAAO,EAAE,iBAAiB,EAC1B,GAAG,WAAW,EAAE,SAAS,UAAU,EAAE,GACpC,OAAO,CAAC,IAAI,CAAC,CAIf;AAED,OAAO,EACL,qBAAqB,EACrB,8BAA8B,GAC/B,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAChE,OAAO,EACL,0BAA0B,EAC1B,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAEhE,wBAAsB,sBAAsB,CAC1C,OAAO,EAAE,iBAAiB,EAC1B,GAAG,WAAW,EAAE,SAAS,UAAU,EAAE,GACpC,OAAO,CAAC,IAAI,CAAC,CAIf;AAED,OAAO,EACL,qBAAqB,EACrB,8BAA8B,GAC/B,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAChE,OAAO,EACL,0BAA0B,EAC1B,gCAAgC,EAChC,qCAAqC,GACtC,MAAM,yBAAyB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createWorkspaceDependenciesConstraint = exports.
|
|
3
|
+
exports.createWorkspaceDependenciesConstraint = exports.createPeerDependenciesConstraint = exports.constraintRootDependencies = exports.constraintImports = exports.constraintExports = exports.createManifestFieldsConstraint = exports.constraintPackageName = void 0;
|
|
4
4
|
exports.runConstraintsSequence = runConstraintsSequence;
|
|
5
5
|
async function runConstraintsSequence(options, ...constraints) {
|
|
6
6
|
for (const constraint of constraints) {
|
|
@@ -15,5 +15,5 @@ Object.defineProperty(exports, "constraintExports", { enumerable: true, get: fun
|
|
|
15
15
|
Object.defineProperty(exports, "constraintImports", { enumerable: true, get: function () { return esm_js_1.constraintImports; } });
|
|
16
16
|
var index_js_1 = require("./dependencies/index.js");
|
|
17
17
|
Object.defineProperty(exports, "constraintRootDependencies", { enumerable: true, get: function () { return index_js_1.constraintRootDependencies; } });
|
|
18
|
-
Object.defineProperty(exports, "
|
|
18
|
+
Object.defineProperty(exports, "createPeerDependenciesConstraint", { enumerable: true, get: function () { return index_js_1.createPeerDependenciesConstraint; } });
|
|
19
19
|
Object.defineProperty(exports, "createWorkspaceDependenciesConstraint", { enumerable: true, get: function () { return index_js_1.createWorkspaceDependenciesConstraint; } });
|
package/dist/utils.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ export interface ConstraintOptions {
|
|
|
4
4
|
readonly Yarn: Yarn.Constraints.Yarn;
|
|
5
5
|
}
|
|
6
6
|
export type Constraint = (options: ConstraintOptions) => AsyncV<void>;
|
|
7
|
-
export type
|
|
7
|
+
export type ConstraintFactory<Options extends object> = object extends Options ? (options?: Options) => Constraint : (options: Options) => Constraint;
|
|
8
8
|
export declare function getRootWs(yarn: Yarn.Constraints.Yarn): Yarn.Constraints.Workspace;
|
|
9
9
|
export declare function getManifest<T extends object = Record<string, unknown>>(workspace: Yarn.Constraints.Workspace): T;
|
|
10
10
|
export declare function getRangeConsideringRoot(yarn: Yarn.Constraints.Yarn, dependency: Yarn.Constraints.Dependency): string;
|
package/dist/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAE3C,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC;CACtC;AAED,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,EAAE,iBAAiB,KAAK,MAAM,CAAC,IAAI,CAAC,CAAC;AAEtE,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAE3C,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC;CACtC;AAED,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,EAAE,iBAAiB,KAAK,MAAM,CAAC,IAAI,CAAC,CAAC;AAEtE,MAAM,MAAM,iBAAiB,CAAC,OAAO,SAAS,MAAM,IAClD,MAAM,SAAS,OAAO,GAAG,CAAC,OAAO,CAAC,EAAE,OAAO,KAAK,UAAU,GACxD,CAAC,OAAO,EAAE,OAAO,KAAK,UAAU,CAAC;AAErC,wBAAgB,SAAS,CACvB,IAAI,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI,GAC1B,IAAI,CAAC,WAAW,CAAC,SAAS,CAQ5B;AACD,wBAAgB,WAAW,CAEzB,CAAC,SAAS,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC1C,SAAS,EAAE,IAAI,CAAC,WAAW,CAAC,SAAS,GAAG,CAAC,CAO1C;AAED,wBAAgB,uBAAuB,CACrC,IAAI,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI,EAC3B,UAAU,EAAE,IAAI,CAAC,WAAW,CAAC,UAAU,GACtC,MAAM,CAOR;AAED,wBAAgB,gBAAgB,CAAC,WAAW,EAAE,MAAM,GAAG;IACrD,EAAE,EAAE,IAAI,MAAM,GAAG,GAAG,IAAI,CAAC;IACzB,IAAI,EAAE,MAAM,CAAC;CACd,CAQA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@budsbox/constraints",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"homepage": "https://gitlab.com/budsbox/fe/seed",
|
|
5
5
|
"bugs": {
|
|
6
6
|
"url": "https://gitlab.com/budsbox/fe/seed/-/issues"
|
|
@@ -31,17 +31,18 @@
|
|
|
31
31
|
"prepack": "yarn p:ts:prepack"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@budsbox/iso-utils": "^1.0.
|
|
34
|
+
"@budsbox/iso-utils": "^1.0.3",
|
|
35
35
|
"@yarnpkg/types": "^4.0.0"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
|
-
"@budsbox/linting": "^1.
|
|
38
|
+
"@budsbox/linting": "^1.3.1",
|
|
39
39
|
"@budsbox/tsconfigs": "^2.0.2",
|
|
40
|
-
"@budsbox/types": "^1.0.
|
|
40
|
+
"@budsbox/types": "^1.0.3",
|
|
41
41
|
"@eslint/js": "^9.9.1",
|
|
42
42
|
"@types/node": "^20.16.2",
|
|
43
43
|
"@typescript-eslint/parser": "^8.3.0",
|
|
44
44
|
"eslint": "^8.57.0",
|
|
45
|
+
"eslint-config-prettier": "^9.1.0",
|
|
45
46
|
"eslint-import-resolver-typescript": "^3.6.3",
|
|
46
47
|
"eslint-plugin-jsdoc": "^50.2.2",
|
|
47
48
|
"eslint-plugin-react": "^7.35.0",
|