@lerna-lite/core 1.3.0 → 1.4.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/README.md +13 -12
- package/dist/child-process.d.ts +62 -62
- package/dist/child-process.js +165 -165
- package/dist/command.d.ts +37 -35
- package/dist/command.js +266 -266
- package/dist/command.js.map +1 -1
- package/dist/conventional-commits/constants.d.ts +4 -4
- package/dist/conventional-commits/constants.js +12 -12
- package/dist/conventional-commits/get-changelog-config.d.ts +12 -12
- package/dist/conventional-commits/get-changelog-config.js +98 -98
- package/dist/conventional-commits/index.d.ts +6 -6
- package/dist/conventional-commits/index.js +22 -22
- package/dist/conventional-commits/make-bump-only-filter.d.ts +6 -6
- package/dist/conventional-commits/make-bump-only-filter.js +22 -22
- package/dist/conventional-commits/read-existing-changelog.d.ts +7 -7
- package/dist/conventional-commits/read-existing-changelog.js +32 -32
- package/dist/conventional-commits/recommend-version.d.ts +11 -11
- package/dist/conventional-commits/recommend-version.js +86 -86
- package/dist/conventional-commits/update-changelog.d.ts +11 -11
- package/dist/conventional-commits/update-changelog.js +83 -83
- package/dist/git-clients/GitLabClient.d.ts +8 -8
- package/dist/git-clients/GitLabClient.js +39 -39
- package/dist/git-clients/github-client.d.ts +6 -6
- package/dist/git-clients/github-client.js +40 -40
- package/dist/git-clients/gitlab-client.d.ts +6 -6
- package/dist/git-clients/gitlab-client.js +21 -21
- package/dist/git-clients/index.d.ts +2 -2
- package/dist/git-clients/index.js +18 -18
- package/dist/index.d.ts +12 -12
- package/dist/index.js +30 -30
- package/dist/models/command-options.d.ts +206 -0
- package/dist/models/command-options.js +3 -0
- package/dist/models/command-options.js.map +1 -0
- package/dist/models/index.d.ts +2 -186
- package/dist/models/index.js +18 -2
- package/dist/models/index.js.map +1 -1
- package/dist/models/interfaces.d.ts +201 -0
- package/dist/models/interfaces.js +3 -0
- package/dist/models/interfaces.js.map +1 -0
- package/dist/otplease.d.ts +14 -14
- package/dist/otplease.js +108 -108
- package/dist/package-graph/index.d.ts +2 -2
- package/dist/package-graph/index.js +18 -18
- package/dist/package-graph/lib/cyclic-package-graph-node.d.ts +42 -42
- package/dist/package-graph/lib/cyclic-package-graph-node.js +97 -97
- package/dist/package-graph/lib/index.d.ts +3 -3
- package/dist/package-graph/lib/index.js +19 -19
- package/dist/package-graph/lib/package-graph-node.d.ts +33 -33
- package/dist/package-graph/lib/package-graph-node.js +58 -58
- package/dist/package-graph/lib/report-cycles.d.ts +1 -1
- package/dist/package-graph/lib/report-cycles.js +19 -19
- package/dist/package-graph/package-graph.d.ts +79 -79
- package/dist/package-graph/package-graph.js +276 -276
- package/dist/package.d.ts +91 -85
- package/dist/package.js +282 -276
- package/dist/package.js.map +1 -1
- package/dist/project/index.d.ts +2 -2
- package/dist/project/index.js +18 -18
- package/dist/project/lib/apply-extends.d.ts +10 -10
- package/dist/project/lib/apply-extends.js +37 -37
- package/dist/project/lib/index.d.ts +3 -3
- package/dist/project/lib/index.js +19 -19
- package/dist/project/lib/make-file-finder.d.ts +3 -3
- package/dist/project/lib/make-file-finder.js +71 -71
- package/dist/project/lib/shallow-extend.d.ts +11 -11
- package/dist/project/lib/shallow-extend.js +24 -24
- package/dist/project/project.d.ts +45 -45
- package/dist/project/project.js +195 -195
- package/dist/prompt.d.ts +23 -23
- package/dist/prompt.js +75 -75
- package/dist/utils/check-working-tree.d.ts +8 -8
- package/dist/utils/check-working-tree.js +41 -41
- package/dist/utils/clean-stack.d.ts +5 -5
- package/dist/utils/clean-stack.js +18 -18
- package/dist/utils/collect-uncommitted.d.ts +18 -18
- package/dist/utils/collect-uncommitted.js +40 -40
- package/dist/utils/collect-updates/collect-updates.d.ts +11 -11
- package/dist/utils/collect-updates/collect-updates.js +82 -82
- package/dist/utils/collect-updates/index.d.ts +2 -2
- package/dist/utils/collect-updates/index.js +18 -18
- package/dist/utils/collect-updates/lib/collect-dependents.d.ts +11 -11
- package/dist/utils/collect-updates/lib/collect-dependents.js +45 -45
- package/dist/utils/collect-updates/lib/collect-packages.d.ts +13 -13
- package/dist/utils/collect-updates/lib/collect-packages.js +33 -33
- package/dist/utils/collect-updates/lib/get-packages-for-option.d.ts +5 -5
- package/dist/utils/collect-updates/lib/get-packages-for-option.js +30 -30
- package/dist/utils/collect-updates/lib/has-tags.d.ts +5 -5
- package/dist/utils/collect-updates/lib/has-tags.js +26 -26
- package/dist/utils/collect-updates/lib/index.d.ts +5 -5
- package/dist/utils/collect-updates/lib/index.js +21 -21
- package/dist/utils/collect-updates/lib/make-diff-predicate.d.ts +7 -7
- package/dist/utils/collect-updates/lib/make-diff-predicate.js +64 -64
- package/dist/utils/conf.d.ts +25 -25
- package/dist/utils/conf.js +255 -255
- package/dist/utils/defaults.d.ts +1 -1
- package/dist/utils/defaults.js +182 -182
- package/dist/utils/defaults.js.map +1 -1
- package/dist/utils/describe-ref.d.ts +37 -37
- package/dist/utils/describe-ref.js +80 -80
- package/dist/utils/env-replace.d.ts +1 -1
- package/dist/utils/env-replace.js +22 -22
- package/dist/utils/find-prefix.d.ts +2 -2
- package/dist/utils/find-prefix.js +48 -48
- package/dist/utils/index.d.ts +23 -22
- package/dist/utils/index.js +39 -38
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/log-package-error.d.ts +5 -5
- package/dist/utils/log-package-error.js +35 -35
- package/dist/utils/nerf-dart.d.ts +1 -1
- package/dist/utils/nerf-dart.js +18 -18
- package/dist/utils/npm-conf.d.ts +4 -4
- package/dist/utils/npm-conf.js +55 -55
- package/dist/utils/output.d.ts +1 -1
- package/dist/utils/output.js +13 -13
- package/dist/utils/parse-field.d.ts +1 -1
- package/dist/utils/parse-field.js +65 -65
- package/dist/utils/prerelease-id-from-version.d.ts +5 -5
- package/dist/utils/prerelease-id-from-version.js +15 -15
- package/dist/utils/pulse-till-done.d.ts +1 -1
- package/dist/utils/pulse-till-done.js +40 -40
- package/dist/utils/query-graph.d.ts +36 -36
- package/dist/utils/query-graph.js +77 -77
- package/dist/utils/query-graph.js.map +1 -1
- package/dist/utils/run-lifecycle.d.ts +10 -10
- package/dist/utils/run-lifecycle.js +131 -107
- package/dist/utils/run-lifecycle.js.map +1 -1
- package/dist/utils/run-topologically.d.ts +12 -12
- package/dist/utils/run-topologically.js +36 -36
- package/dist/utils/temp-write.d.ts +13 -0
- package/dist/utils/temp-write.js +50 -0
- package/dist/utils/temp-write.js.map +1 -0
- package/dist/utils/types.d.ts +131 -129
- package/dist/utils/types.js +138 -138
- package/dist/utils/warn-if-hanging.d.ts +1 -1
- package/dist/utils/warn-if-hanging.js +17 -17
- package/dist/utils/write-log-file.d.ts +1 -1
- package/dist/utils/write-log-file.js +32 -32
- package/dist/validation-error.d.ts +4 -4
- package/dist/validation-error.js +18 -18
- package/package.json +14 -10
|
@@ -1,66 +1,66 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.parseField = void 0;
|
|
7
|
-
const path_1 = __importDefault(require("path"));
|
|
8
|
-
const env_replace_1 = require("./env-replace");
|
|
9
|
-
const types_1 = require("./types");
|
|
10
|
-
// https://github.com/npm/npm/blob/latest/lib/config/core.js#L362-L407
|
|
11
|
-
function parseField(input, key) {
|
|
12
|
-
if (typeof input !== 'string') {
|
|
13
|
-
return input;
|
|
14
|
-
}
|
|
15
|
-
const typeList = [].concat(types_1.types[key]);
|
|
16
|
-
// @ts-ignore
|
|
17
|
-
const isPath = typeList.indexOf(path_1.default) !== -1;
|
|
18
|
-
// @ts-ignore
|
|
19
|
-
const isBool = typeList.indexOf(Boolean) !== -1;
|
|
20
|
-
// @ts-ignore
|
|
21
|
-
const isString = typeList.indexOf(String) !== -1;
|
|
22
|
-
// @ts-ignore
|
|
23
|
-
const isNumber = typeList.indexOf(Number) !== -1;
|
|
24
|
-
let field = `${input}`.trim();
|
|
25
|
-
if (/^'.*'$/.test(field)) {
|
|
26
|
-
try {
|
|
27
|
-
field = JSON.parse(field);
|
|
28
|
-
}
|
|
29
|
-
catch (err) {
|
|
30
|
-
throw new Error(`Failed parsing JSON config key ${key}: ${field}`);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
if (isBool && !isString && field === '') {
|
|
34
|
-
return true;
|
|
35
|
-
}
|
|
36
|
-
switch (field) {
|
|
37
|
-
case 'true': {
|
|
38
|
-
return true;
|
|
39
|
-
}
|
|
40
|
-
case 'false': {
|
|
41
|
-
return false;
|
|
42
|
-
}
|
|
43
|
-
case 'null': {
|
|
44
|
-
return null;
|
|
45
|
-
}
|
|
46
|
-
case 'undefined': {
|
|
47
|
-
return undefined;
|
|
48
|
-
}
|
|
49
|
-
// no default
|
|
50
|
-
}
|
|
51
|
-
field = (0, env_replace_1.envReplace)(field);
|
|
52
|
-
if (isPath) {
|
|
53
|
-
const regex = process.platform === 'win32' ? /^~(\/|\\)/ : /^~\//;
|
|
54
|
-
if (typeof field === 'string' && regex.test(field) && process.env.HOME) {
|
|
55
|
-
field = path_1.default.resolve(process.env.HOME, field.substring(2));
|
|
56
|
-
}
|
|
57
|
-
field = path_1.default.resolve(field);
|
|
58
|
-
}
|
|
59
|
-
// eslint-disable-next-line no-restricted-globals
|
|
60
|
-
if (isNumber && !isNaN(field)) {
|
|
61
|
-
field = Number(field);
|
|
62
|
-
}
|
|
63
|
-
return field;
|
|
64
|
-
}
|
|
65
|
-
exports.parseField = parseField;
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.parseField = void 0;
|
|
7
|
+
const path_1 = __importDefault(require("path"));
|
|
8
|
+
const env_replace_1 = require("./env-replace");
|
|
9
|
+
const types_1 = require("./types");
|
|
10
|
+
// https://github.com/npm/npm/blob/latest/lib/config/core.js#L362-L407
|
|
11
|
+
function parseField(input, key) {
|
|
12
|
+
if (typeof input !== 'string') {
|
|
13
|
+
return input;
|
|
14
|
+
}
|
|
15
|
+
const typeList = [].concat(types_1.types[key]);
|
|
16
|
+
// @ts-ignore
|
|
17
|
+
const isPath = typeList.indexOf(path_1.default) !== -1;
|
|
18
|
+
// @ts-ignore
|
|
19
|
+
const isBool = typeList.indexOf(Boolean) !== -1;
|
|
20
|
+
// @ts-ignore
|
|
21
|
+
const isString = typeList.indexOf(String) !== -1;
|
|
22
|
+
// @ts-ignore
|
|
23
|
+
const isNumber = typeList.indexOf(Number) !== -1;
|
|
24
|
+
let field = `${input}`.trim();
|
|
25
|
+
if (/^'.*'$/.test(field)) {
|
|
26
|
+
try {
|
|
27
|
+
field = JSON.parse(field);
|
|
28
|
+
}
|
|
29
|
+
catch (err) {
|
|
30
|
+
throw new Error(`Failed parsing JSON config key ${key}: ${field}`);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
if (isBool && !isString && field === '') {
|
|
34
|
+
return true;
|
|
35
|
+
}
|
|
36
|
+
switch (field) {
|
|
37
|
+
case 'true': {
|
|
38
|
+
return true;
|
|
39
|
+
}
|
|
40
|
+
case 'false': {
|
|
41
|
+
return false;
|
|
42
|
+
}
|
|
43
|
+
case 'null': {
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
case 'undefined': {
|
|
47
|
+
return undefined;
|
|
48
|
+
}
|
|
49
|
+
// no default
|
|
50
|
+
}
|
|
51
|
+
field = (0, env_replace_1.envReplace)(field);
|
|
52
|
+
if (isPath) {
|
|
53
|
+
const regex = process.platform === 'win32' ? /^~(\/|\\)/ : /^~\//;
|
|
54
|
+
if (typeof field === 'string' && regex.test(field) && process.env.HOME) {
|
|
55
|
+
field = path_1.default.resolve(process.env.HOME, field.substring(2));
|
|
56
|
+
}
|
|
57
|
+
field = path_1.default.resolve(field);
|
|
58
|
+
}
|
|
59
|
+
// eslint-disable-next-line no-restricted-globals
|
|
60
|
+
if (isNumber && !isNaN(field)) {
|
|
61
|
+
field = Number(field);
|
|
62
|
+
}
|
|
63
|
+
return field;
|
|
64
|
+
}
|
|
65
|
+
exports.parseField = parseField;
|
|
66
66
|
//# sourceMappingURL=parse-field.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @param {string} version
|
|
3
|
-
* @returns {string|undefined}
|
|
4
|
-
*/
|
|
5
|
-
export declare function prereleaseIdFromVersion(version: string): string | undefined;
|
|
1
|
+
/**
|
|
2
|
+
* @param {string} version
|
|
3
|
+
* @returns {string|undefined}
|
|
4
|
+
*/
|
|
5
|
+
export declare function prereleaseIdFromVersion(version: string): string | undefined;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.prereleaseIdFromVersion = void 0;
|
|
7
|
-
const semver_1 = __importDefault(require("semver"));
|
|
8
|
-
/**
|
|
9
|
-
* @param {string} version
|
|
10
|
-
* @returns {string|undefined}
|
|
11
|
-
*/
|
|
12
|
-
function prereleaseIdFromVersion(version) {
|
|
13
|
-
return (semver_1.default.prerelease(version) || []).shift();
|
|
14
|
-
}
|
|
15
|
-
exports.prereleaseIdFromVersion = prereleaseIdFromVersion;
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.prereleaseIdFromVersion = void 0;
|
|
7
|
+
const semver_1 = __importDefault(require("semver"));
|
|
8
|
+
/**
|
|
9
|
+
* @param {string} version
|
|
10
|
+
* @returns {string|undefined}
|
|
11
|
+
*/
|
|
12
|
+
function prereleaseIdFromVersion(version) {
|
|
13
|
+
return (semver_1.default.prerelease(version) || []).shift();
|
|
14
|
+
}
|
|
15
|
+
exports.prereleaseIdFromVersion = prereleaseIdFromVersion;
|
|
16
16
|
//# sourceMappingURL=prerelease-id-from-version.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function pulseTillDone(prefix: string | Promise<string>, promise?: Promise<any> | string): Promise<any>;
|
|
1
|
+
export declare function pulseTillDone(prefix: string | Promise<string>, promise?: Promise<any> | string): Promise<any>;
|
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.pulseTillDone = void 0;
|
|
7
|
-
const npmlog_1 = __importDefault(require("npmlog"));
|
|
8
|
-
let pulsers = 0;
|
|
9
|
-
let pulse;
|
|
10
|
-
function pulseStart(prefix) {
|
|
11
|
-
pulsers += 1;
|
|
12
|
-
if (pulsers > 1) {
|
|
13
|
-
return;
|
|
14
|
-
}
|
|
15
|
-
pulse = setInterval(() => npmlog_1.default.gauge.pulse(prefix), 150);
|
|
16
|
-
}
|
|
17
|
-
function pulseStop() {
|
|
18
|
-
pulsers -= 1;
|
|
19
|
-
if (pulsers > 0) {
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
|
-
clearInterval(pulse);
|
|
23
|
-
}
|
|
24
|
-
function pulseTillDone(prefix, promise) {
|
|
25
|
-
if (!promise) {
|
|
26
|
-
/* eslint-disable no-param-reassign */
|
|
27
|
-
promise = prefix;
|
|
28
|
-
prefix = '';
|
|
29
|
-
/* eslint-enable no-param-reassign */
|
|
30
|
-
}
|
|
31
|
-
pulseStart(prefix);
|
|
32
|
-
return Promise.resolve(promise).then((val) => {
|
|
33
|
-
pulseStop();
|
|
34
|
-
return val;
|
|
35
|
-
}, (err) => {
|
|
36
|
-
pulseStop();
|
|
37
|
-
throw err;
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
exports.pulseTillDone = pulseTillDone;
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.pulseTillDone = void 0;
|
|
7
|
+
const npmlog_1 = __importDefault(require("npmlog"));
|
|
8
|
+
let pulsers = 0;
|
|
9
|
+
let pulse;
|
|
10
|
+
function pulseStart(prefix) {
|
|
11
|
+
pulsers += 1;
|
|
12
|
+
if (pulsers > 1) {
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
pulse = setInterval(() => npmlog_1.default.gauge.pulse(prefix), 150);
|
|
16
|
+
}
|
|
17
|
+
function pulseStop() {
|
|
18
|
+
pulsers -= 1;
|
|
19
|
+
if (pulsers > 0) {
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
clearInterval(pulse);
|
|
23
|
+
}
|
|
24
|
+
function pulseTillDone(prefix, promise) {
|
|
25
|
+
if (!promise) {
|
|
26
|
+
/* eslint-disable no-param-reassign */
|
|
27
|
+
promise = prefix;
|
|
28
|
+
prefix = '';
|
|
29
|
+
/* eslint-enable no-param-reassign */
|
|
30
|
+
}
|
|
31
|
+
pulseStart(prefix);
|
|
32
|
+
return Promise.resolve(promise).then((val) => {
|
|
33
|
+
pulseStop();
|
|
34
|
+
return val;
|
|
35
|
+
}, (err) => {
|
|
36
|
+
pulseStop();
|
|
37
|
+
throw err;
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
exports.pulseTillDone = pulseTillDone;
|
|
41
41
|
//# sourceMappingURL=pulse-till-done.js.map
|
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
import { PackageGraph } from '../package-graph/package-graph';
|
|
2
|
-
import { QueryGraphConfig } from '../models';
|
|
3
|
-
import { Package } from '../package';
|
|
4
|
-
import { PackageGraphNode } from '../package-graph';
|
|
5
|
-
/**
|
|
6
|
-
* A mutable PackageGraph used to query for next available packages.
|
|
7
|
-
*/
|
|
8
|
-
export declare class QueryGraph {
|
|
9
|
-
graph: PackageGraph;
|
|
10
|
-
cycles: Set<any>;
|
|
11
|
-
/**
|
|
12
|
-
* Sort a list of Packages topologically.
|
|
13
|
-
*
|
|
14
|
-
* @param {import("@lerna/package").Package[]} packages An array of Packages to build the list out of
|
|
15
|
-
* @param {QueryGraphConfig} [options]
|
|
16
|
-
*
|
|
17
|
-
* @returns {import("@lerna/package").Package[]} A list of Package instances in topological order
|
|
18
|
-
*/
|
|
19
|
-
static toposort(packages: Package[], options
|
|
20
|
-
/**
|
|
21
|
-
* @param {import("@lerna/package").Package[]} packages An array of Packages to build the graph out of
|
|
22
|
-
* @param {QueryGraphConfig} [options]
|
|
23
|
-
*/
|
|
24
|
-
constructor(packages: Package[], { graphType, localDependencies, rejectCycles }?: QueryGraphConfig);
|
|
25
|
-
_getNextLeaf(): any[];
|
|
26
|
-
_getNextCycle(): any;
|
|
27
|
-
getAvailablePackages(): PackageGraphNode[];
|
|
28
|
-
/**
|
|
29
|
-
* @param {string} name
|
|
30
|
-
*/
|
|
31
|
-
markAsTaken(name: string): void;
|
|
32
|
-
/**
|
|
33
|
-
* @param {import("@lerna/package-graph").PackageGraphNode} candidateNode
|
|
34
|
-
*/
|
|
35
|
-
markAsDone(candidateNode: PackageGraphNode): void;
|
|
36
|
-
}
|
|
1
|
+
import { PackageGraph } from '../package-graph/package-graph';
|
|
2
|
+
import { QueryGraphConfig } from '../models';
|
|
3
|
+
import { Package } from '../package';
|
|
4
|
+
import { PackageGraphNode } from '../package-graph';
|
|
5
|
+
/**
|
|
6
|
+
* A mutable PackageGraph used to query for next available packages.
|
|
7
|
+
*/
|
|
8
|
+
export declare class QueryGraph {
|
|
9
|
+
graph: PackageGraph;
|
|
10
|
+
cycles: Set<any>;
|
|
11
|
+
/**
|
|
12
|
+
* Sort a list of Packages topologically.
|
|
13
|
+
*
|
|
14
|
+
* @param {import("@lerna/package").Package[]} packages An array of Packages to build the list out of
|
|
15
|
+
* @param {QueryGraphConfig} [options]
|
|
16
|
+
*
|
|
17
|
+
* @returns {import("@lerna/package").Package[]} A list of Package instances in topological order
|
|
18
|
+
*/
|
|
19
|
+
static toposort(packages: Package[], options?: QueryGraphConfig): never[];
|
|
20
|
+
/**
|
|
21
|
+
* @param {import("@lerna/package").Package[]} packages An array of Packages to build the graph out of
|
|
22
|
+
* @param {QueryGraphConfig} [options]
|
|
23
|
+
*/
|
|
24
|
+
constructor(packages: Package[], { graphType, localDependencies, rejectCycles }?: QueryGraphConfig);
|
|
25
|
+
_getNextLeaf(): any[];
|
|
26
|
+
_getNextCycle(): any;
|
|
27
|
+
getAvailablePackages(): PackageGraphNode[];
|
|
28
|
+
/**
|
|
29
|
+
* @param {string} name
|
|
30
|
+
*/
|
|
31
|
+
markAsTaken(name: string): void;
|
|
32
|
+
/**
|
|
33
|
+
* @param {import("@lerna/package-graph").PackageGraphNode} candidateNode
|
|
34
|
+
*/
|
|
35
|
+
markAsDone(candidateNode: PackageGraphNode): void;
|
|
36
|
+
}
|
|
@@ -1,78 +1,78 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.QueryGraph = void 0;
|
|
4
|
-
const package_graph_1 = require("../package-graph/package-graph");
|
|
5
|
-
/**
|
|
6
|
-
* A mutable PackageGraph used to query for next available packages.
|
|
7
|
-
*/
|
|
8
|
-
class QueryGraph {
|
|
9
|
-
/**
|
|
10
|
-
* @param {import("@lerna/package").Package[]} packages An array of Packages to build the graph out of
|
|
11
|
-
* @param {QueryGraphConfig} [options]
|
|
12
|
-
*/
|
|
13
|
-
constructor(packages, { graphType = 'allDependencies', localDependencies = 'auto', rejectCycles } = {}) {
|
|
14
|
-
// Create dependency graph
|
|
15
|
-
this.graph = new package_graph_1.PackageGraph(packages, graphType, localDependencies);
|
|
16
|
-
// Evaluate cycles
|
|
17
|
-
this.cycles = this.graph.collapseCycles(rejectCycles);
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Sort a list of Packages topologically.
|
|
21
|
-
*
|
|
22
|
-
* @param {import("@lerna/package").Package[]} packages An array of Packages to build the list out of
|
|
23
|
-
* @param {QueryGraphConfig} [options]
|
|
24
|
-
*
|
|
25
|
-
* @returns {import("@lerna/package").Package[]} A list of Package instances in topological order
|
|
26
|
-
*/
|
|
27
|
-
static toposort(packages, options) {
|
|
28
|
-
const graph = new QueryGraph(packages, options);
|
|
29
|
-
const result = [];
|
|
30
|
-
let batch = graph.getAvailablePackages();
|
|
31
|
-
while (batch.length) {
|
|
32
|
-
for (const node of batch) {
|
|
33
|
-
// no need to take() in synchronous loop
|
|
34
|
-
// @ts-ignore
|
|
35
|
-
result.push(node.pkg);
|
|
36
|
-
graph.markAsDone(node);
|
|
37
|
-
}
|
|
38
|
-
batch = graph.getAvailablePackages();
|
|
39
|
-
}
|
|
40
|
-
return result;
|
|
41
|
-
}
|
|
42
|
-
_getNextLeaf() {
|
|
43
|
-
return Array.from(this.graph.values()).filter((node) => node.localDependencies.size === 0);
|
|
44
|
-
}
|
|
45
|
-
_getNextCycle() {
|
|
46
|
-
const cycle = Array.from(this.cycles).find((cycleNode) => cycleNode.localDependencies.size === 0);
|
|
47
|
-
if (!cycle) {
|
|
48
|
-
return [];
|
|
49
|
-
}
|
|
50
|
-
this.cycles.delete(cycle);
|
|
51
|
-
return cycle.flatten();
|
|
52
|
-
}
|
|
53
|
-
getAvailablePackages() {
|
|
54
|
-
// Get the next leaf nodes
|
|
55
|
-
const availablePackages = this._getNextLeaf();
|
|
56
|
-
if (availablePackages.length > 0) {
|
|
57
|
-
return availablePackages;
|
|
58
|
-
}
|
|
59
|
-
return this._getNextCycle();
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* @param {string} name
|
|
63
|
-
*/
|
|
64
|
-
markAsTaken(name) {
|
|
65
|
-
this.graph.delete(name);
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* @param {import("@lerna/package-graph").PackageGraphNode} candidateNode
|
|
69
|
-
*/
|
|
70
|
-
markAsDone(candidateNode) {
|
|
71
|
-
this.graph.remove(candidateNode);
|
|
72
|
-
for (const cycle of this.cycles) {
|
|
73
|
-
cycle.unlink(candidateNode);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
exports.QueryGraph = QueryGraph;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.QueryGraph = void 0;
|
|
4
|
+
const package_graph_1 = require("../package-graph/package-graph");
|
|
5
|
+
/**
|
|
6
|
+
* A mutable PackageGraph used to query for next available packages.
|
|
7
|
+
*/
|
|
8
|
+
class QueryGraph {
|
|
9
|
+
/**
|
|
10
|
+
* @param {import("@lerna/package").Package[]} packages An array of Packages to build the graph out of
|
|
11
|
+
* @param {QueryGraphConfig} [options]
|
|
12
|
+
*/
|
|
13
|
+
constructor(packages, { graphType = 'allDependencies', localDependencies = 'auto', rejectCycles } = {}) {
|
|
14
|
+
// Create dependency graph
|
|
15
|
+
this.graph = new package_graph_1.PackageGraph(packages, graphType, localDependencies);
|
|
16
|
+
// Evaluate cycles
|
|
17
|
+
this.cycles = this.graph.collapseCycles(rejectCycles);
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Sort a list of Packages topologically.
|
|
21
|
+
*
|
|
22
|
+
* @param {import("@lerna/package").Package[]} packages An array of Packages to build the list out of
|
|
23
|
+
* @param {QueryGraphConfig} [options]
|
|
24
|
+
*
|
|
25
|
+
* @returns {import("@lerna/package").Package[]} A list of Package instances in topological order
|
|
26
|
+
*/
|
|
27
|
+
static toposort(packages, options) {
|
|
28
|
+
const graph = new QueryGraph(packages, options);
|
|
29
|
+
const result = [];
|
|
30
|
+
let batch = graph.getAvailablePackages();
|
|
31
|
+
while (batch.length) {
|
|
32
|
+
for (const node of batch) {
|
|
33
|
+
// no need to take() in synchronous loop
|
|
34
|
+
// @ts-ignore
|
|
35
|
+
result.push(node.pkg);
|
|
36
|
+
graph.markAsDone(node);
|
|
37
|
+
}
|
|
38
|
+
batch = graph.getAvailablePackages();
|
|
39
|
+
}
|
|
40
|
+
return result;
|
|
41
|
+
}
|
|
42
|
+
_getNextLeaf() {
|
|
43
|
+
return Array.from(this.graph.values()).filter((node) => node.localDependencies.size === 0);
|
|
44
|
+
}
|
|
45
|
+
_getNextCycle() {
|
|
46
|
+
const cycle = Array.from(this.cycles).find((cycleNode) => cycleNode.localDependencies.size === 0);
|
|
47
|
+
if (!cycle) {
|
|
48
|
+
return [];
|
|
49
|
+
}
|
|
50
|
+
this.cycles.delete(cycle);
|
|
51
|
+
return cycle.flatten();
|
|
52
|
+
}
|
|
53
|
+
getAvailablePackages() {
|
|
54
|
+
// Get the next leaf nodes
|
|
55
|
+
const availablePackages = this._getNextLeaf();
|
|
56
|
+
if (availablePackages.length > 0) {
|
|
57
|
+
return availablePackages;
|
|
58
|
+
}
|
|
59
|
+
return this._getNextCycle();
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* @param {string} name
|
|
63
|
+
*/
|
|
64
|
+
markAsTaken(name) {
|
|
65
|
+
this.graph.delete(name);
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* @param {import("@lerna/package-graph").PackageGraphNode} candidateNode
|
|
69
|
+
*/
|
|
70
|
+
markAsDone(candidateNode) {
|
|
71
|
+
this.graph.remove(candidateNode);
|
|
72
|
+
for (const cycle of this.cycles) {
|
|
73
|
+
cycle.unlink(candidateNode);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
exports.QueryGraph = QueryGraph;
|
|
78
78
|
//# sourceMappingURL=query-graph.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query-graph.js","sourceRoot":"","sources":["../../src/utils/query-graph.ts"],"names":[],"mappings":";;;AAAA,kEAA8D;AAK9D;;GAEG;AACH,MAAa,UAAU;IAgCrB;;;OAGG;IACH,YAAY,QAAmB,EAAE,EAAE,SAAS,GAAG,iBAAiB,EAAE,iBAAiB,GAAG,MAAM,EAAE,YAAY,KAAK,EAAsB;QACnI,0BAA0B;QAC1B,IAAI,CAAC,KAAK,GAAG,IAAI,4BAAY,CAAC,QAAQ,EAAE,
|
|
1
|
+
{"version":3,"file":"query-graph.js","sourceRoot":"","sources":["../../src/utils/query-graph.ts"],"names":[],"mappings":";;;AAAA,kEAA8D;AAK9D;;GAEG;AACH,MAAa,UAAU;IAgCrB;;;OAGG;IACH,YAAY,QAAmB,EAAE,EAAE,SAAS,GAAG,iBAAiB,EAAE,iBAAiB,GAAG,MAAM,EAAE,YAAY,KAAK,EAAsB;QACnI,0BAA0B;QAC1B,IAAI,CAAC,KAAK,GAAG,IAAI,4BAAY,CAAC,QAAQ,EAAE,SAA+C,EAAE,iBAAiB,CAAC,CAAC;QAE5G,kBAAkB;QAClB,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,YAAY,CAAC,CAAC;IACxD,CAAC;IAtCD;;;;;;;OAOG;IACH,MAAM,CAAC,QAAQ,CAAC,QAAmB,EAAE,OAA0B;QAC7D,MAAM,KAAK,GAAG,IAAI,UAAU,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QAChD,MAAM,MAAM,GAAG,EAAE,CAAC;QAElB,IAAI,KAAK,GAAG,KAAK,CAAC,oBAAoB,EAAE,CAAC;QAEzC,OAAO,KAAK,CAAC,MAAM,EAAE;YACnB,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE;gBACxB,wCAAwC;gBACxC,aAAa;gBACb,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;gBACtB,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;aACxB;YAED,KAAK,GAAG,KAAK,CAAC,oBAAoB,EAAE,CAAC;SACtC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;IAcD,YAAY;QACV,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,iBAAiB,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC;IAC7F,CAAC;IAED,aAAa;QACX,MAAM,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,iBAAiB,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC;QAElG,IAAI,CAAC,KAAK,EAAE;YACV,OAAO,EAAE,CAAC;SACX;QAED,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAE1B,OAAO,KAAK,CAAC,OAAO,EAAE,CAAC;IACzB,CAAC;IAED,oBAAoB;QAClB,0BAA0B;QAC1B,MAAM,iBAAiB,GAAG,IAAI,CAAC,YAAY,EAAE,CAAC;QAE9C,IAAI,iBAAiB,CAAC,MAAM,GAAG,CAAC,EAAE;YAChC,OAAO,iBAAiB,CAAC;SAC1B;QAED,OAAO,IAAI,CAAC,aAAa,EAAE,CAAC;IAC9B,CAAC;IAED;;OAEG;IACH,WAAW,CAAC,IAAY;QACtB,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;IAED;;OAEG;IACH,UAAU,CAAC,aAA+B;QACxC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;QAEjC,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,MAAM,EAAE;YAC/B,KAAK,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;SAC7B;IACH,CAAC;CACF;AAxFD,gCAwFC"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { LifecycleConfig } from '../models';
|
|
2
|
-
import { Package } from '../package';
|
|
3
|
-
/**
|
|
4
|
-
* Run a lifecycle script for a package.
|
|
5
|
-
* @param {import('@lerna/package').Package} pkg
|
|
6
|
-
* @param {string} stage
|
|
7
|
-
* @param {LifecycleConfig} options
|
|
8
|
-
*/
|
|
9
|
-
export declare function runLifecycle(pkg: Package, stage: string, options: LifecycleConfig): Promise<void>;
|
|
10
|
-
export declare function createRunner(commandOptions: any): (pkg: Package, stage: string) => Promise<void>;
|
|
1
|
+
import { LifecycleConfig } from '../models';
|
|
2
|
+
import { Package } from '../package';
|
|
3
|
+
/**
|
|
4
|
+
* Run a lifecycle script for a package.
|
|
5
|
+
* @param {import('@lerna/package').Package} pkg
|
|
6
|
+
* @param {string} stage
|
|
7
|
+
* @param {LifecycleConfig} options
|
|
8
|
+
*/
|
|
9
|
+
export declare function runLifecycle(pkg: Package, stage: string, options: LifecycleConfig): Promise<void>;
|
|
10
|
+
export declare function createRunner(commandOptions: any): (pkg: Package, stage: string) => Promise<void>;
|