@lerna-lite/core 1.15.1 → 1.16.1
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/child-process.d.ts +62 -62
- package/dist/child-process.js +164 -166
- package/dist/child-process.js.map +1 -1
- package/dist/command.d.ts +37 -37
- package/dist/command.js +269 -271
- package/dist/command.js.map +1 -1
- package/dist/constants.d.ts +1 -1
- package/dist/constants.js +4 -4
- package/dist/index.d.ts +10 -10
- package/dist/index.js +15 -28
- package/dist/index.js.map +1 -1
- package/dist/models/command-options.d.ts +345 -341
- package/dist/models/command-options.js +2 -2
- package/dist/models/index.d.ts +2 -2
- package/dist/models/index.js +5 -18
- package/dist/models/index.js.map +1 -1
- package/dist/models/interfaces.d.ts +175 -173
- package/dist/models/interfaces.js +2 -2
- package/dist/package-graph/index.d.ts +2 -2
- package/dist/package-graph/index.js +5 -18
- package/dist/package-graph/index.js.map +1 -1
- 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 +6 -19
- package/dist/package-graph/lib/index.js.map +1 -1
- package/dist/package-graph/lib/package-graph-node.d.ts +33 -33
- package/dist/package-graph/lib/package-graph-node.js +56 -58
- package/dist/package-graph/lib/package-graph-node.js.map +1 -1
- package/dist/package-graph/lib/report-cycles.d.ts +1 -1
- package/dist/package-graph/lib/report-cycles.js +17 -19
- package/dist/package-graph/lib/report-cycles.js.map +1 -1
- package/dist/package-graph/package-graph.d.ts +79 -79
- package/dist/package-graph/package-graph.js +269 -271
- package/dist/package-graph/package-graph.js.map +1 -1
- package/dist/package.d.ts +113 -113
- package/dist/package.js +352 -354
- package/dist/package.js.map +1 -1
- package/dist/project/index.d.ts +2 -2
- package/dist/project/index.js +5 -18
- package/dist/project/index.js.map +1 -1
- package/dist/project/lib/apply-extends.d.ts +10 -10
- package/dist/project/lib/apply-extends.js +36 -38
- package/dist/project/lib/apply-extends.js.map +1 -1
- package/dist/project/lib/index.d.ts +3 -3
- package/dist/project/lib/index.js +6 -19
- package/dist/project/lib/index.js.map +1 -1
- package/dist/project/lib/make-file-finder.d.ts +3 -3
- package/dist/project/lib/make-file-finder.js +69 -71
- package/dist/project/lib/make-file-finder.js.map +1 -1
- 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 +46 -46
- package/dist/project/project.js +195 -197
- package/dist/project/project.js.map +1 -1
- package/dist/prompt.d.ts +23 -23
- package/dist/prompt.js +73 -75
- package/dist/prompt.js.map +1 -1
- package/dist/utils/check-working-tree.d.ts +9 -9
- 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 +17 -17
- package/dist/utils/collect-uncommitted.js +37 -39
- package/dist/utils/collect-uncommitted.js.map +1 -1
- package/dist/utils/collect-updates/__helpers__/build-graph.d.ts +3 -3
- package/dist/utils/collect-updates/__helpers__/build-graph.js +74 -74
- package/dist/utils/collect-updates/collect-updates.d.ts +11 -11
- package/dist/utils/collect-updates/collect-updates.js +89 -89
- package/dist/utils/collect-updates/collect-updates.js.map +1 -1
- package/dist/utils/collect-updates/index.d.ts +2 -2
- package/dist/utils/collect-updates/index.js +5 -18
- package/dist/utils/collect-updates/index.js.map +1 -1
- 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 +7 -7
- package/dist/utils/collect-updates/lib/has-tags.js +30 -32
- package/dist/utils/collect-updates/lib/has-tags.js.map +1 -1
- package/dist/utils/collect-updates/lib/index.d.ts +5 -5
- package/dist/utils/collect-updates/lib/index.js +8 -21
- package/dist/utils/collect-updates/lib/index.js.map +1 -1
- package/dist/utils/collect-updates/lib/make-diff-predicate.d.ts +9 -7
- package/dist/utils/collect-updates/lib/make-diff-predicate.js +74 -63
- package/dist/utils/collect-updates/lib/make-diff-predicate.js.map +1 -1
- package/dist/utils/conf.d.ts +25 -25
- package/dist/utils/conf.js +253 -255
- package/dist/utils/conf.js.map +1 -1
- package/dist/utils/defaults.d.ts +1 -1
- package/dist/utils/defaults.js +180 -182
- package/dist/utils/defaults.js.map +1 -1
- package/dist/utils/describe-ref.d.ts +13 -13
- package/dist/utils/describe-ref.js +86 -88
- package/dist/utils/describe-ref.js.map +1 -1
- 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 +46 -48
- package/dist/utils/find-prefix.js.map +1 -1
- package/dist/utils/index.d.ts +22 -22
- package/dist/utils/index.js +26 -39
- 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 +33 -35
- package/dist/utils/log-package-error.js.map +1 -1
- package/dist/utils/nerf-dart.d.ts +1 -1
- package/dist/utils/nerf-dart.js +16 -18
- package/dist/utils/nerf-dart.js.map +1 -1
- package/dist/utils/npm-conf.d.ts +4 -4
- package/dist/utils/npm-conf.js +53 -78
- package/dist/utils/npm-conf.js.map +1 -1
- package/dist/utils/object-utils.d.ts +21 -21
- package/dist/utils/object-utils.js +51 -53
- package/dist/utils/object-utils.js.map +1 -1
- package/dist/utils/output.d.ts +1 -1
- package/dist/utils/output.js +11 -13
- package/dist/utils/output.js.map +1 -1
- package/dist/utils/parse-field.d.ts +1 -1
- package/dist/utils/parse-field.js +63 -65
- package/dist/utils/parse-field.js.map +1 -1
- package/dist/utils/prerelease-id-from-version.d.ts +5 -5
- package/dist/utils/prerelease-id-from-version.js +13 -15
- package/dist/utils/prerelease-id-from-version.js.map +1 -1
- package/dist/utils/pulse-till-done.d.ts +1 -1
- package/dist/utils/pulse-till-done.js +38 -40
- package/dist/utils/pulse-till-done.js.map +1 -1
- package/dist/utils/query-graph.d.ts +36 -36
- package/dist/utils/query-graph.js +77 -77
- package/dist/utils/run-lifecycle.d.ts +10 -10
- package/dist/utils/run-lifecycle.js +138 -140
- package/dist/utils/run-lifecycle.js.map +1 -1
- package/dist/utils/run-topologically.d.ts +12 -12
- package/dist/utils/run-topologically.js +34 -36
- package/dist/utils/run-topologically.js.map +1 -1
- package/dist/utils/string-utils.d.ts +2 -2
- package/dist/utils/string-utils.js +9 -9
- package/dist/utils/types.d.ts +128 -131
- package/dist/utils/types.js +136 -138
- package/dist/utils/types.js.map +1 -1
- package/dist/utils/warn-if-hanging.d.ts +1 -1
- package/dist/utils/warn-if-hanging.js +15 -17
- package/dist/utils/warn-if-hanging.js.map +1 -1
- package/dist/utils/write-log-file.d.ts +1 -1
- package/dist/utils/write-log-file.js +30 -32
- package/dist/utils/write-log-file.js.map +1 -1
- package/dist/validation-error.d.ts +4 -4
- package/dist/validation-error.js +16 -18
- package/dist/validation-error.js.map +1 -1
- package/package.json +4 -4
package/dist/child-process.d.ts
CHANGED
|
@@ -1,62 +1,62 @@
|
|
|
1
|
-
import execa from 'execa';
|
|
2
|
-
import { Package } from './package';
|
|
3
|
-
/**
|
|
4
|
-
* Execute a command asynchronously, piping stdio by default.
|
|
5
|
-
* @param {string} command
|
|
6
|
-
* @param {string[]} args
|
|
7
|
-
* @param {import("execa").Options} [opts]
|
|
8
|
-
*/
|
|
9
|
-
export declare function exec(command: string, args: string[], opts?: execa.Options & {
|
|
10
|
-
pkg?: Package;
|
|
11
|
-
}, dryRun?: boolean): Promise<any>;
|
|
12
|
-
/**
|
|
13
|
-
* Execute a command synchronously.
|
|
14
|
-
* @param {string} command
|
|
15
|
-
* @param {string[]} args
|
|
16
|
-
* @param {import("execa").SyncOptions} [opts]
|
|
17
|
-
*/
|
|
18
|
-
export declare function execSync(command: string, args?: string[], opts?: execa.SyncOptions<string>, dryRun?: boolean): string;
|
|
19
|
-
/**
|
|
20
|
-
* Spawn a command asynchronously, _always_ inheriting stdio.
|
|
21
|
-
* @param {string} command
|
|
22
|
-
* @param {string[]} args
|
|
23
|
-
* @param {import("execa").Options} [opts]
|
|
24
|
-
*/
|
|
25
|
-
export declare function spawn(command: string, args: string[], opts?: execa.Options & {
|
|
26
|
-
pkg?: Package;
|
|
27
|
-
}, dryRun?: boolean): Promise<any>;
|
|
28
|
-
/**
|
|
29
|
-
* Spawn a command asynchronously, streaming stdio with optional prefix.
|
|
30
|
-
* @param {string} command
|
|
31
|
-
* @param {string[]} args
|
|
32
|
-
* @param {import("execa").Options} [opts]
|
|
33
|
-
* @param {string} [prefix]
|
|
34
|
-
*/
|
|
35
|
-
export declare function spawnStreaming(command: string, args: string[], opts?: execa.Options & {
|
|
36
|
-
pkg?: Package;
|
|
37
|
-
}, prefix?: string | boolean, dryRun?: boolean): Promise<any>;
|
|
38
|
-
export declare function getChildProcessCount(): number;
|
|
39
|
-
export declare function getExitCode(result: any): any;
|
|
40
|
-
/**
|
|
41
|
-
* @param {string} command
|
|
42
|
-
* @param {string[]} args
|
|
43
|
-
* @param {import("execa").Options} opts
|
|
44
|
-
*/
|
|
45
|
-
export declare function spawnProcess(command: string, args: string[], opts: execa.Options & {
|
|
46
|
-
pkg?: Package;
|
|
47
|
-
}, dryRun?: boolean): any;
|
|
48
|
-
/**
|
|
49
|
-
* Spawn a command asynchronously, _always_ inheriting stdio.
|
|
50
|
-
* @param {string} command
|
|
51
|
-
* @param {string[]} args
|
|
52
|
-
* @param {import("execa").Options} [opts]
|
|
53
|
-
*/
|
|
54
|
-
export declare function wrapError(spawned: execa.ExecaChildProcess & {
|
|
55
|
-
pkg?: Package;
|
|
56
|
-
}): Promise<execa.ExecaReturnValue<string>>;
|
|
57
|
-
/**
|
|
58
|
-
* Log the child-process command and its arguments as dry-run (without executing the process)
|
|
59
|
-
* @param {string} command
|
|
60
|
-
* @param {string[]} args
|
|
61
|
-
*/
|
|
62
|
-
export declare function logExecCommand(command: string, args?: string[]): string;
|
|
1
|
+
import execa from 'execa';
|
|
2
|
+
import { Package } from './package';
|
|
3
|
+
/**
|
|
4
|
+
* Execute a command asynchronously, piping stdio by default.
|
|
5
|
+
* @param {string} command
|
|
6
|
+
* @param {string[]} args
|
|
7
|
+
* @param {import("execa").Options} [opts]
|
|
8
|
+
*/
|
|
9
|
+
export declare function exec(command: string, args: string[], opts?: execa.Options & {
|
|
10
|
+
pkg?: Package;
|
|
11
|
+
}, dryRun?: boolean): Promise<any>;
|
|
12
|
+
/**
|
|
13
|
+
* Execute a command synchronously.
|
|
14
|
+
* @param {string} command
|
|
15
|
+
* @param {string[]} args
|
|
16
|
+
* @param {import("execa").SyncOptions} [opts]
|
|
17
|
+
*/
|
|
18
|
+
export declare function execSync(command: string, args?: string[], opts?: execa.SyncOptions<string>, dryRun?: boolean): string;
|
|
19
|
+
/**
|
|
20
|
+
* Spawn a command asynchronously, _always_ inheriting stdio.
|
|
21
|
+
* @param {string} command
|
|
22
|
+
* @param {string[]} args
|
|
23
|
+
* @param {import("execa").Options} [opts]
|
|
24
|
+
*/
|
|
25
|
+
export declare function spawn(command: string, args: string[], opts?: execa.Options & {
|
|
26
|
+
pkg?: Package;
|
|
27
|
+
}, dryRun?: boolean): Promise<any>;
|
|
28
|
+
/**
|
|
29
|
+
* Spawn a command asynchronously, streaming stdio with optional prefix.
|
|
30
|
+
* @param {string} command
|
|
31
|
+
* @param {string[]} args
|
|
32
|
+
* @param {import("execa").Options} [opts]
|
|
33
|
+
* @param {string} [prefix]
|
|
34
|
+
*/
|
|
35
|
+
export declare function spawnStreaming(command: string, args: string[], opts?: execa.Options & {
|
|
36
|
+
pkg?: Package;
|
|
37
|
+
}, prefix?: string | boolean, dryRun?: boolean): Promise<any>;
|
|
38
|
+
export declare function getChildProcessCount(): number;
|
|
39
|
+
export declare function getExitCode(result: any): any;
|
|
40
|
+
/**
|
|
41
|
+
* @param {string} command
|
|
42
|
+
* @param {string[]} args
|
|
43
|
+
* @param {import("execa").Options} opts
|
|
44
|
+
*/
|
|
45
|
+
export declare function spawnProcess(command: string, args: string[], opts: execa.Options & {
|
|
46
|
+
pkg?: Package;
|
|
47
|
+
}, dryRun?: boolean): any;
|
|
48
|
+
/**
|
|
49
|
+
* Spawn a command asynchronously, _always_ inheriting stdio.
|
|
50
|
+
* @param {string} command
|
|
51
|
+
* @param {string[]} args
|
|
52
|
+
* @param {import("execa").Options} [opts]
|
|
53
|
+
*/
|
|
54
|
+
export declare function wrapError(spawned: execa.ExecaChildProcess & {
|
|
55
|
+
pkg?: Package;
|
|
56
|
+
}): Promise<execa.ExecaReturnValue<string>>;
|
|
57
|
+
/**
|
|
58
|
+
* Log the child-process command and its arguments as dry-run (without executing the process)
|
|
59
|
+
* @param {string} command
|
|
60
|
+
* @param {string[]} args
|
|
61
|
+
*/
|
|
62
|
+
export declare function logExecCommand(command: string, args?: string[]): string;
|
package/dist/child-process.js
CHANGED
|
@@ -1,167 +1,165 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
const
|
|
12
|
-
//
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
*
|
|
21
|
-
* @param {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
*
|
|
33
|
-
* @param {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
*
|
|
46
|
-
* @param {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
*
|
|
58
|
-
* @param {
|
|
59
|
-
* @param {string[]
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
const
|
|
66
|
-
|
|
67
|
-
const
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
* @param {
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
*
|
|
134
|
-
* @param {
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
//
|
|
142
|
-
err.
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
*
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
}
|
|
166
|
-
exports.logExecCommand = logExecCommand;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.logExecCommand = exports.wrapError = exports.spawnProcess = exports.getExitCode = exports.getChildProcessCount = exports.spawnStreaming = exports.spawn = exports.execSync = exports.exec = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
6
|
+
const execa_1 = tslib_1.__importDefault(require("execa"));
|
|
7
|
+
const npmlog_1 = tslib_1.__importDefault(require("npmlog"));
|
|
8
|
+
const os_1 = tslib_1.__importDefault(require("os"));
|
|
9
|
+
const strong_log_transformer_1 = tslib_1.__importDefault(require("strong-log-transformer"));
|
|
10
|
+
// bookkeeping for spawned processes
|
|
11
|
+
const children = new Set();
|
|
12
|
+
// when streaming processes are spawned, use this color for prefix
|
|
13
|
+
const colorWheel = ['cyan', 'magenta', 'blue', 'yellow', 'green', 'red'];
|
|
14
|
+
const NUM_COLORS = colorWheel.length;
|
|
15
|
+
// ever-increasing index ensures colors are always sequential
|
|
16
|
+
let currentColor = 0;
|
|
17
|
+
/**
|
|
18
|
+
* Execute a command asynchronously, piping stdio by default.
|
|
19
|
+
* @param {string} command
|
|
20
|
+
* @param {string[]} args
|
|
21
|
+
* @param {import("execa").Options} [opts]
|
|
22
|
+
*/
|
|
23
|
+
function exec(command, args, opts, dryRun = false) {
|
|
24
|
+
const options = Object.assign({ stdio: 'pipe' }, opts);
|
|
25
|
+
const spawned = spawnProcess(command, args, options, dryRun);
|
|
26
|
+
return dryRun ? Promise.resolve() : wrapError(spawned);
|
|
27
|
+
}
|
|
28
|
+
exports.exec = exec;
|
|
29
|
+
/**
|
|
30
|
+
* Execute a command synchronously.
|
|
31
|
+
* @param {string} command
|
|
32
|
+
* @param {string[]} args
|
|
33
|
+
* @param {import("execa").SyncOptions} [opts]
|
|
34
|
+
*/
|
|
35
|
+
function execSync(command, args, opts, dryRun = false) {
|
|
36
|
+
// prettier-ignore
|
|
37
|
+
return dryRun
|
|
38
|
+
? logExecCommand(command, args)
|
|
39
|
+
: execa_1.default.sync(command, args, opts).stdout;
|
|
40
|
+
}
|
|
41
|
+
exports.execSync = execSync;
|
|
42
|
+
/**
|
|
43
|
+
* Spawn a command asynchronously, _always_ inheriting stdio.
|
|
44
|
+
* @param {string} command
|
|
45
|
+
* @param {string[]} args
|
|
46
|
+
* @param {import("execa").Options} [opts]
|
|
47
|
+
*/
|
|
48
|
+
function spawn(command, args, opts, dryRun = false) {
|
|
49
|
+
const options = Object.assign({}, opts, { stdio: 'inherit' });
|
|
50
|
+
const spawned = spawnProcess(command, args, options, dryRun);
|
|
51
|
+
return wrapError(spawned);
|
|
52
|
+
}
|
|
53
|
+
exports.spawn = spawn;
|
|
54
|
+
/**
|
|
55
|
+
* Spawn a command asynchronously, streaming stdio with optional prefix.
|
|
56
|
+
* @param {string} command
|
|
57
|
+
* @param {string[]} args
|
|
58
|
+
* @param {import("execa").Options} [opts]
|
|
59
|
+
* @param {string} [prefix]
|
|
60
|
+
*/
|
|
61
|
+
// istanbul ignore next
|
|
62
|
+
function spawnStreaming(command, args, opts, prefix, dryRun = false) {
|
|
63
|
+
const options = Object.assign({}, opts);
|
|
64
|
+
options.stdio = ['ignore', 'pipe', 'pipe'];
|
|
65
|
+
const spawned = spawnProcess(command, args, options, dryRun);
|
|
66
|
+
const stdoutOpts = {};
|
|
67
|
+
const stderrOpts = {}; // mergeMultiline causes escaped newlines :P
|
|
68
|
+
if (prefix) {
|
|
69
|
+
const colorName = colorWheel[currentColor % NUM_COLORS];
|
|
70
|
+
const color = chalk_1.default[colorName];
|
|
71
|
+
currentColor += 1;
|
|
72
|
+
stdoutOpts.tag = `${color.bold(prefix)}:`;
|
|
73
|
+
stderrOpts.tag = `${color(prefix)}:`;
|
|
74
|
+
}
|
|
75
|
+
// Avoid 'Possible EventEmitter memory leak detected' warning due to piped stdio
|
|
76
|
+
if (children.size > process.stdout.listenerCount('close')) {
|
|
77
|
+
process.stdout.setMaxListeners(children.size);
|
|
78
|
+
process.stderr.setMaxListeners(children.size);
|
|
79
|
+
}
|
|
80
|
+
spawned.stdout.pipe((0, strong_log_transformer_1.default)(stdoutOpts)).pipe(process.stdout);
|
|
81
|
+
spawned.stderr.pipe((0, strong_log_transformer_1.default)(stderrOpts)).pipe(process.stderr);
|
|
82
|
+
return wrapError(spawned);
|
|
83
|
+
}
|
|
84
|
+
exports.spawnStreaming = spawnStreaming;
|
|
85
|
+
function getChildProcessCount() {
|
|
86
|
+
return children.size;
|
|
87
|
+
}
|
|
88
|
+
exports.getChildProcessCount = getChildProcessCount;
|
|
89
|
+
function getExitCode(result) {
|
|
90
|
+
var _a, _b, _c;
|
|
91
|
+
// https://nodejs.org/docs/latest-v6.x/api/child_process.html#child_process_event_close
|
|
92
|
+
if (typeof result.code === 'number' || typeof result.exitCode === 'number') {
|
|
93
|
+
return (_a = result.code) !== null && _a !== void 0 ? _a : result.exitCode;
|
|
94
|
+
}
|
|
95
|
+
// https://nodejs.org/docs/latest-v6.x/api/errors.html#errors_error_code
|
|
96
|
+
// istanbul ignore else
|
|
97
|
+
if (typeof result.code === 'string' || typeof result.exitCode === 'string') {
|
|
98
|
+
return os_1.default.constants.errno[(_b = result.code) !== null && _b !== void 0 ? _b : result.exitCode];
|
|
99
|
+
}
|
|
100
|
+
// istanbul ignore next: extremely weird
|
|
101
|
+
throw new TypeError(`Received unexpected exit code value ${JSON.stringify((_c = result.code) !== null && _c !== void 0 ? _c : result.exitCode)}`);
|
|
102
|
+
}
|
|
103
|
+
exports.getExitCode = getExitCode;
|
|
104
|
+
/**
|
|
105
|
+
* @param {string} command
|
|
106
|
+
* @param {string[]} args
|
|
107
|
+
* @param {import("execa").Options} opts
|
|
108
|
+
*/
|
|
109
|
+
function spawnProcess(command, args, opts, dryRun = false) {
|
|
110
|
+
if (dryRun) {
|
|
111
|
+
return logExecCommand(command, args);
|
|
112
|
+
}
|
|
113
|
+
const child = (0, execa_1.default)(command, args, opts);
|
|
114
|
+
const drain = (_code, signal) => {
|
|
115
|
+
children.delete(child);
|
|
116
|
+
// don't run repeatedly if this is the error event
|
|
117
|
+
if (signal === undefined) {
|
|
118
|
+
child.removeListener('exit', drain);
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
child.once('exit', drain);
|
|
122
|
+
child.once('error', drain);
|
|
123
|
+
if (opts.pkg) {
|
|
124
|
+
child.pkg = opts.pkg;
|
|
125
|
+
}
|
|
126
|
+
children.add(child);
|
|
127
|
+
return child;
|
|
128
|
+
}
|
|
129
|
+
exports.spawnProcess = spawnProcess;
|
|
130
|
+
/**
|
|
131
|
+
* Spawn a command asynchronously, _always_ inheriting stdio.
|
|
132
|
+
* @param {string} command
|
|
133
|
+
* @param {string[]} args
|
|
134
|
+
* @param {import("execa").Options} [opts]
|
|
135
|
+
*/
|
|
136
|
+
function wrapError(spawned) {
|
|
137
|
+
if (spawned.pkg) {
|
|
138
|
+
return spawned.catch((err) => {
|
|
139
|
+
// ensure exit code is always a number
|
|
140
|
+
err.exitCode = getExitCode(err);
|
|
141
|
+
// log non-lerna error cleanly
|
|
142
|
+
err.pkg = spawned.pkg;
|
|
143
|
+
throw err;
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
return spawned;
|
|
147
|
+
}
|
|
148
|
+
exports.wrapError = wrapError;
|
|
149
|
+
/**
|
|
150
|
+
* Log the child-process command and its arguments as dry-run (without executing the process)
|
|
151
|
+
* @param {string} command
|
|
152
|
+
* @param {string[]} args
|
|
153
|
+
*/
|
|
154
|
+
function logExecCommand(command, args) {
|
|
155
|
+
var _a;
|
|
156
|
+
const argStr = (_a = (Array.isArray(args) ? args.join(' ') : args)) !== null && _a !== void 0 ? _a : '';
|
|
157
|
+
const cmdList = [];
|
|
158
|
+
for (const c of [command, argStr]) {
|
|
159
|
+
cmdList.push(Array.isArray(c) ? c.join(' ') : c);
|
|
160
|
+
}
|
|
161
|
+
npmlog_1.default.info(chalk_1.default.bold.magenta('[dry-run] >'), cmdList.join(' '));
|
|
162
|
+
return '';
|
|
163
|
+
}
|
|
164
|
+
exports.logExecCommand = logExecCommand;
|
|
167
165
|
//# sourceMappingURL=child-process.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"child-process.js","sourceRoot":"","sources":["../src/child-process.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"child-process.js","sourceRoot":"","sources":["../src/child-process.ts"],"names":[],"mappings":";;;;AAAA,0DAA0B;AAC1B,0DAA0B;AAC1B,4DAAyB;AACzB,oDAAoB;AACpB,4FAAoD;AAIpD,oCAAoC;AACpC,MAAM,QAAQ,GAAG,IAAI,GAAG,EAAE,CAAC;AAE3B,kEAAkE;AAClE,MAAM,UAAU,GAAG,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;AACzE,MAAM,UAAU,GAAG,UAAU,CAAC,MAAM,CAAC;AAErC,6DAA6D;AAC7D,IAAI,YAAY,GAAG,CAAC,CAAC;AAErB;;;;;GAKG;AACH,SAAgB,IAAI,CAClB,OAAe,EACf,IAAc,EACd,IAAwC,EACxC,MAAM,GAAG,KAAK;IAEd,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,EAA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;AAVD,wCAUC"}
|
package/dist/command.d.ts
CHANGED
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
import { Logger } from 'npmlog';
|
|
2
|
-
import { Project } from './project/project';
|
|
3
|
-
import { ChangedCommandOption, CommandType, DiffCommandOption, ExecCommandOption, ExecOpts, InitCommandOption, ListCommandOption, ProjectConfig, PublishCommandOption, VersionCommandOption, WatchCommandOption } from './models';
|
|
4
|
-
import { PackageGraph } from './package-graph/package-graph';
|
|
5
|
-
type AvailableCommandOption = ChangedCommandOption | DiffCommandOption | ExecCommandOption | InitCommandOption | ListCommandOption | PublishCommandOption | VersionCommandOption | WatchCommandOption | ProjectConfig;
|
|
6
|
-
export declare class Command<T extends AvailableCommandOption> {
|
|
7
|
-
argv: any;
|
|
8
|
-
concurrency: number;
|
|
9
|
-
envDefaults: any;
|
|
10
|
-
sort: any;
|
|
11
|
-
toposort?: boolean;
|
|
12
|
-
execOpts: ExecOpts;
|
|
13
|
-
commandName: CommandType;
|
|
14
|
-
composed: any;
|
|
15
|
-
logger: Logger;
|
|
16
|
-
options: T & ExecOpts & ProjectConfig;
|
|
17
|
-
project: Project;
|
|
18
|
-
packageGraph: PackageGraph;
|
|
19
|
-
runner?: Promise<any>;
|
|
20
|
-
constructor(_argv: AvailableCommandOption);
|
|
21
|
-
then(onResolved: typeof Promise.resolve, onRejected: typeof Promise.reject): Promise<unknown> | undefined;
|
|
22
|
-
catch(onRejected: typeof Promise.reject): Promise<any> | undefined;
|
|
23
|
-
get requiresGit(): boolean;
|
|
24
|
-
get otherCommandConfigs(): string[];
|
|
25
|
-
configureEnvironment(): void;
|
|
26
|
-
configureOptions(): void;
|
|
27
|
-
configureProperties(): void;
|
|
28
|
-
configureLogging(): void;
|
|
29
|
-
enableProgressBar(): void;
|
|
30
|
-
gitInitialized(): boolean;
|
|
31
|
-
runValidations(): void;
|
|
32
|
-
runPreparations(): Promise<any> | void;
|
|
33
|
-
runCommand(): Promise<any>;
|
|
34
|
-
initialize(): any | Promise<any>;
|
|
35
|
-
execute(): any | Promise<any>;
|
|
36
|
-
}
|
|
37
|
-
export {};
|
|
1
|
+
import { Logger } from 'npmlog';
|
|
2
|
+
import { Project } from './project/project';
|
|
3
|
+
import { ChangedCommandOption, CommandType, DiffCommandOption, ExecCommandOption, ExecOpts, InitCommandOption, ListCommandOption, ProjectConfig, PublishCommandOption, VersionCommandOption, WatchCommandOption } from './models';
|
|
4
|
+
import { PackageGraph } from './package-graph/package-graph';
|
|
5
|
+
type AvailableCommandOption = ChangedCommandOption | DiffCommandOption | ExecCommandOption | InitCommandOption | ListCommandOption | PublishCommandOption | VersionCommandOption | WatchCommandOption | ProjectConfig;
|
|
6
|
+
export declare class Command<T extends AvailableCommandOption> {
|
|
7
|
+
argv: any;
|
|
8
|
+
concurrency: number;
|
|
9
|
+
envDefaults: any;
|
|
10
|
+
sort: any;
|
|
11
|
+
toposort?: boolean;
|
|
12
|
+
execOpts: ExecOpts;
|
|
13
|
+
commandName: CommandType;
|
|
14
|
+
composed: any;
|
|
15
|
+
logger: Logger;
|
|
16
|
+
options: T & ExecOpts & ProjectConfig;
|
|
17
|
+
project: Project;
|
|
18
|
+
packageGraph: PackageGraph;
|
|
19
|
+
runner?: Promise<any>;
|
|
20
|
+
constructor(_argv: AvailableCommandOption);
|
|
21
|
+
then(onResolved: typeof Promise.resolve, onRejected: typeof Promise.reject): Promise<unknown> | undefined;
|
|
22
|
+
catch(onRejected: typeof Promise.reject): Promise<any> | undefined;
|
|
23
|
+
get requiresGit(): boolean;
|
|
24
|
+
get otherCommandConfigs(): string[];
|
|
25
|
+
configureEnvironment(): void;
|
|
26
|
+
configureOptions(): void;
|
|
27
|
+
configureProperties(): void;
|
|
28
|
+
configureLogging(): void;
|
|
29
|
+
enableProgressBar(): void;
|
|
30
|
+
gitInitialized(): boolean;
|
|
31
|
+
runValidations(): void;
|
|
32
|
+
runPreparations(): Promise<any> | void;
|
|
33
|
+
runCommand(): Promise<any>;
|
|
34
|
+
initialize(): any | Promise<any>;
|
|
35
|
+
execute(): any | Promise<any>;
|
|
36
|
+
}
|
|
37
|
+
export {};
|