fscr 6.2.3 → 7.3.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.
Files changed (98) hide show
  1. package/README.md +48 -30
  2. package/dist/index.js +502 -185
  3. package/dist/lib/auth/auth-conf.js +49 -45
  4. package/dist/lib/cache/README.md +341 -0
  5. package/dist/lib/cache/cli.js +152 -0
  6. package/dist/lib/cache/file-watcher.js +193 -0
  7. package/dist/lib/cache/index.js +422 -0
  8. package/dist/lib/cache/monitor.js +224 -0
  9. package/dist/lib/commands/doctor.js +225 -0
  10. package/dist/lib/completions/completion.js +342 -0
  11. package/dist/lib/completions/generator.js +152 -0
  12. package/dist/lib/completions/scripts/bash.sh +108 -0
  13. package/dist/lib/completions/scripts/fish.sh +105 -0
  14. package/dist/lib/completions/scripts/powershell.ps1 +168 -0
  15. package/dist/lib/completions/scripts/zsh.sh +124 -0
  16. package/dist/lib/diagnostics/cache.js +121 -0
  17. package/dist/lib/diagnostics/fileSystem.js +236 -0
  18. package/dist/lib/diagnostics/gitCheck.js +41 -0
  19. package/dist/lib/diagnostics/nodeVersion.js +68 -0
  20. package/dist/lib/diagnostics/packageManager.js +64 -0
  21. package/dist/lib/diagnostics/performance.js +141 -0
  22. package/dist/lib/encryption/decryptConfig.js +3 -2
  23. package/dist/lib/encryption/encryption.js +153 -113
  24. package/dist/lib/generators/generateFScripts.js +16 -13
  25. package/dist/lib/generators/generateToc.js +23 -14
  26. package/dist/lib/generators/index.js +1 -1
  27. package/dist/lib/git/pub.js +27 -31
  28. package/dist/lib/git/taskRunner.js +79 -69
  29. package/dist/lib/git/validateNotDev.js +65 -54
  30. package/dist/lib/optionList.js +69 -57
  31. package/dist/lib/parsers/parseScriptsMd.cached.js +208 -0
  32. package/dist/lib/parsers/parseScriptsMd.js +88 -79
  33. package/dist/lib/parsers/parseScriptsPackage.js +4 -3
  34. package/dist/lib/performance/cache.js +199 -0
  35. package/dist/lib/performance/lazy-loader.js +189 -0
  36. package/dist/lib/performance/monitor.js +303 -0
  37. package/dist/lib/plugins/deployment/index.js +113 -0
  38. package/dist/lib/plugins/hooks.js +17 -0
  39. package/dist/lib/plugins/loader.js +91 -0
  40. package/dist/lib/plugins/task-notifier/index.js +72 -0
  41. package/dist/lib/release/bump.js +51 -43
  42. package/dist/lib/release/commitWithMessage.js +80 -52
  43. package/dist/lib/release/publish.js +19 -14
  44. package/dist/lib/release/pushToGit.js +40 -31
  45. package/dist/lib/release/releasenotes.js +116 -97
  46. package/dist/lib/release/seeChangedFiles.js +68 -60
  47. package/dist/lib/release/sort.js +200 -116
  48. package/dist/lib/release/tree.js +161 -147
  49. package/dist/lib/release/validateNotDev.js +52 -44
  50. package/dist/lib/running/index.js +1 -1
  51. package/dist/lib/running/runCLICommand.js +41 -31
  52. package/dist/lib/running/runParallel.js +61 -59
  53. package/dist/lib/running/runSequence.js +55 -53
  54. package/dist/lib/startScripts.js +129 -114
  55. package/dist/lib/taskList.js +99 -84
  56. package/dist/lib/test-files/.fscripts.md +113 -0
  57. package/dist/lib/test-files/.fscripts.test.md +103 -0
  58. package/dist/lib/test-files/.fscriptsb.md +107 -0
  59. package/dist/lib/test-files/.mdtest.md +40 -0
  60. package/dist/lib/test-files/consoleSample.js +17 -0
  61. package/dist/lib/test-files/inputSample.js +20 -0
  62. package/dist/lib/test-files/testConsole.js +1 -0
  63. package/dist/lib/test-files/testInput.js +2 -0
  64. package/dist/lib/upgradePackages.js +56 -46
  65. package/dist/lib/utils/clear.js +16 -13
  66. package/dist/lib/utils/console.js +27 -21
  67. package/dist/lib/utils/encryption.js +55 -13
  68. package/dist/lib/utils/hash.js +128 -0
  69. package/dist/lib/utils/helpers.js +153 -142
  70. package/dist/lib/utils/index.js +1 -1
  71. package/dist/lib/utils/prompt.js +24 -29
  72. package/package.json +20 -32
  73. package/dist/lib/codemod/arrow.js +0 -13
  74. package/dist/lib/codemod/arrow2.js +0 -67
  75. package/dist/lib/codemod/funcs.js +0 -25
  76. package/dist/lib/codemod/removeConsole.js +0 -12
  77. package/dist/lib/codemod/test.js +0 -8
  78. package/dist/lib/components/App.js +0 -64
  79. package/dist/lib/components/Selector.js +0 -133
  80. package/dist/lib/components/TabChanger.js +0 -113
  81. package/dist/lib/components/Table.js +0 -177
  82. package/dist/lib/components/Tabs.js +0 -221
  83. package/dist/lib/generateFScripts.js +0 -25
  84. package/dist/lib/generateToc.js +0 -30
  85. package/dist/lib/helpers.js +0 -191
  86. package/dist/lib/parseScriptsMd.js +0 -85
  87. package/dist/lib/parseScriptsPackage.js +0 -9
  88. package/dist/lib/release/index.js +0 -4
  89. package/dist/lib/run/lib.js +0 -454
  90. package/dist/lib/run/main-p.js +0 -59
  91. package/dist/lib/run/main-s.js +0 -56
  92. package/dist/lib/run/parse-cli-args.js +0 -222
  93. package/dist/lib/run/run-p.js +0 -30
  94. package/dist/lib/run/run-s.js +0 -57
  95. package/dist/lib/runCLICommand.js +0 -30
  96. package/dist/lib/runParallel.js +0 -20
  97. package/dist/lib/runSequence.js +0 -38
  98. package/dist/lib/taskListAutoComplete.js +0 -15
@@ -1,454 +0,0 @@
1
- parcelRequire = function (e, r, t, n) {
2
- var i,
3
- o = "function" == typeof parcelRequire && parcelRequire,
4
- u = "function" == typeof require && require;
5
- function f(t, n) {
6
- if (!r[t]) {
7
- if (!e[t]) {
8
- var i = "function" == typeof parcelRequire && parcelRequire;
9
- if (!n && i) return i(t, !0);
10
- if (o) return o(t, !0);
11
- if (u && "string" == typeof t) return u(t);
12
- var c = new Error("Cannot find module '" + t + "'");
13
- throw c.code = "MODULE_NOT_FOUND", c;
14
- }
15
- p.resolve = function (r) {
16
- return e[t][1][r] || r;
17
- }, p.cache = {};
18
- var l = r[t] = new f.Module(t);
19
- e[t][0].call(l.exports, p, l, l.exports, this);
20
- }
21
- return r[t].exports;
22
- function p(e) {
23
- return f(p.resolve(e));
24
- }
25
- }
26
- f.isParcelRequire = !0, f.Module = function (e) {
27
- this.id = e, this.bundle = f, this.exports = {};
28
- }, f.modules = e, f.cache = r, f.parent = o, f.register = function (r, t) {
29
- e[r] = [function (e, r) {
30
- r.exports = t;
31
- }, {}];
32
- };
33
- for (var c = 0; c < t.length; c++) try {
34
- f(t[c]);
35
- } catch (e) {
36
- i || (i = e);
37
- }
38
- if (t.length) {
39
- var l = f(t[t.length - 1]);
40
- "object" == typeof exports && "undefined" != typeof module ? module.exports = l : "function" == typeof define && define.amd ? define(function () {
41
- return l;
42
- }) : n && (this[n] = l);
43
- }
44
- if (parcelRequire = f, i) throw i;
45
- return f;
46
- }({
47
- "xX+4": [function (require, module, exports) {
48
- "use strict";
49
-
50
- const t = require("minimatch").Minimatch,
51
- s = /[:\/]/g,
52
- e = {
53
- ":": "/",
54
- "/": ":"
55
- };
56
- function n(t) {
57
- return t.replace(s, t => e[t]);
58
- }
59
- function r(s) {
60
- const e = s.trim(),
61
- r = e.indexOf(" "),
62
- a = r < 0 ? e : e.slice(0, r),
63
- c = r < 0 ? "" : e.slice(r),
64
- o = new t(n(a), {
65
- nonegate: !0
66
- });
67
- return {
68
- match: o.match.bind(o),
69
- task: a,
70
- args: c
71
- };
72
- }
73
- class a {
74
- constructor() {
75
- this.result = [], this.sourceMap = Object.create(null);
76
- }
77
- add(t, s) {
78
- const e = this.sourceMap[t] || (this.sourceMap[t] = []);
79
- 0 !== e.length && -1 === e.indexOf(s) || this.result.push(t), e.push(s);
80
- }
81
- }
82
- module.exports = function (t, s) {
83
- const e = s.map(r),
84
- c = t.map(n),
85
- o = new a(),
86
- i = Object.create(null);
87
- for (const r of e) {
88
- let t = !1;
89
- for (const s of c) r.match(s) && (t = !0, o.add(n(s) + r.args, r.task));
90
- t || "restart" !== r.task && "env" !== r.task || (o.add(r.task + r.args, r.task), t = !0), t || (i[r.task] = !0);
91
- }
92
- const u = Object.keys(i);
93
- if (u.length > 0) throw new Error(`Task not found: "${u.join('", ')}"`);
94
- return o.result;
95
- };
96
- }, {}],
97
- "7fyY": [function (require, module, exports) {
98
- "use strict";
99
-
100
- const e = require("path").join,
101
- t = require("read-pkg");
102
- module.exports = function () {
103
- const s = e(process.cwd(), "package.json");
104
- return t(s).then(e => ({
105
- taskList: Object.keys(e.scripts || {}),
106
- packageInfo: {
107
- path: s,
108
- body: e
109
- }
110
- }));
111
- };
112
- }, {}],
113
- "m/QK": [function (require, module, exports) {
114
- "use strict";
115
-
116
- module.exports = class extends Error {
117
- constructor(e, s) {
118
- super(`"${e.task}" exited with ${e.code}.`), this.name = e.name, this.code = e.code, this.results = s;
119
- }
120
- };
121
- }, {}],
122
- "5T3V": [function (require, module, exports) {
123
- "use strict";
124
-
125
- const n = require("ansi-styles");
126
- module.exports = function (e, s, o) {
127
- if (!s) return `\n> ${e}\n\n`;
128
- const r = e.indexOf(" "),
129
- t = -1 === r ? e : e.slice(0, r),
130
- $ = -1 === r ? "" : e.slice(r + 1),
131
- c = s.body.name,
132
- i = s.body.version,
133
- l = s.body.scripts[t],
134
- p = s.path,
135
- u = o ? n.gray : {
136
- open: "",
137
- close: ""
138
- };
139
- return `\n${u.open}> ${c}@${i} ${t} ${p}${u.close}\n${u.open}> ${l} ${$}${u.close}\n\n`;
140
- };
141
- }, {}],
142
- HZWK: [function (require, module, exports) {
143
- "use strict";
144
-
145
- const e = require("stream"),
146
- t = /\n/g;
147
- class s extends e.Transform {
148
- constructor(e, t) {
149
- super(), this.prefix = e, this.state = t;
150
- }
151
- _transform(e, s, r) {
152
- const n = this.prefix,
153
- a = `\n${n}`,
154
- i = this.state,
155
- l = `${i.lastIsLinebreak ? n : i.lastPrefix !== n ? "\n" : ""}${e}`.replace(t, a),
156
- c = l.indexOf(n, Math.max(0, l.length - n.length));
157
- i.lastPrefix = n, i.lastIsLinebreak = -1 !== c, r(null, -1 !== c ? l.slice(0, c) : l);
158
- }
159
- }
160
- module.exports = function (e, t) {
161
- return new s(e, t);
162
- };
163
- }, {}],
164
- "/Q4c": [function (require, module, exports) {
165
- "use strict";
166
-
167
- const r = require("cross-spawn"),
168
- t = require("pidtree");
169
- function o() {
170
- t(this.pid, {
171
- root: !0
172
- }, (r, t) => {
173
- if (!r) for (const s of t) try {
174
- process.kill(s);
175
- } catch (o) {}
176
- });
177
- }
178
- module.exports = function (t, s, e) {
179
- const i = r(t, s, e);
180
- return i.kill = o, i;
181
- };
182
- }, {}],
183
- DaxP: [function (require, module, exports) {
184
- "use strict";
185
-
186
- module.exports = require("./spawn-posix");
187
- }, {
188
- "./spawn-posix": "/Q4c"
189
- }],
190
- vpwb: [function (require, module, exports) {
191
- "use strict";
192
-
193
- const e = require("path"),
194
- t = require("chalk"),
195
- r = require("shell-quote").parse,
196
- n = require("string.prototype.padend"),
197
- s = require("./create-header"),
198
- p = require("./create-prefix-transform-stream"),
199
- i = require("./spawn"),
200
- o = [t.cyan, t.green, t.magenta, t.yellow, t.red];
201
- let a = 0;
202
- const l = new Map();
203
- function u(e) {
204
- let t = l.get(e);
205
- return t || (t = o[a], a = (a + 1) % o.length, l.set(e, t)), t;
206
- }
207
- function c(e, t, r) {
208
- if (null == t || !r.enabled) return t;
209
- const s = n(e, r.width),
210
- i = (t.isTTY ? u(e) : e => e)(`[${s}] `),
211
- o = p(i, r);
212
- return o.pipe(t), o;
213
- }
214
- function d(e, t) {
215
- return null == e ? "ignore" : e === t && t.isTTY ? e : "pipe";
216
- }
217
- function f(e) {
218
- return e.pattern || e.op || e;
219
- }
220
- module.exports = function (t, n) {
221
- let p = null;
222
- const o = new Promise((o, a) => {
223
- const l = n.stdin,
224
- u = c(t, n.stdout, n.labelState),
225
- h = c(t, n.stderr, n.labelState),
226
- m = d(l, process.stdin),
227
- y = d(u, process.stdout),
228
- g = d(h, process.stderr),
229
- q = {
230
- stdio: [m, y, g]
231
- };
232
- n.printName && null != u && u.write(s(t, n.packageInfo, n.stdout.isTTY));
233
- const x = n.npmPath || process.env.npm_execpath,
234
- w = "string" == typeof x && /\.m?js/.test(e.extname(x)),
235
- T = w ? process.execPath : x || "npm",
236
- b = e.basename(x || "npm").startsWith("yarn"),
237
- k = ["run"];
238
- w && k.unshift(x), b ? -1 !== n.prefixOptions.indexOf("--silent") && k.push("--silent") : Array.prototype.push.apply(k, n.prefixOptions), Array.prototype.push.apply(k, r(t).map(f)), p = i(T, k, q), "pipe" === m && l.pipe(p.stdin), "pipe" === y && p.stdout.pipe(u, {
239
- end: !1
240
- }), "pipe" === g && p.stderr.pipe(h, {
241
- end: !1
242
- }), p.on("error", e => {
243
- p = null, a(e);
244
- }), p.on("close", (e, r) => {
245
- p = null, o({
246
- task: t,
247
- code: e,
248
- signal: r
249
- });
250
- });
251
- });
252
- return o.abort = function () {
253
- null != p && (p.kill(), p = null);
254
- }, o;
255
- };
256
- }, {
257
- "./create-header": "5T3V",
258
- "./create-prefix-transform-stream": "HZWK",
259
- "./spawn": "DaxP"
260
- }],
261
- U8F2: [function (require, module, exports) {
262
- "use strict";
263
-
264
- const e = require("memorystream"),
265
- n = require("./npm-run-all-error"),
266
- t = require("./run-task");
267
- function r(e, n) {
268
- const t = e.indexOf(n);
269
- -1 !== t && e.splice(t, 1);
270
- }
271
- const o = {
272
- SIGABRT: 6,
273
- SIGALRM: 14,
274
- SIGBUS: 10,
275
- SIGCHLD: 20,
276
- SIGCONT: 19,
277
- SIGFPE: 8,
278
- SIGHUP: 1,
279
- SIGILL: 4,
280
- SIGINT: 2,
281
- SIGKILL: 9,
282
- SIGPIPE: 13,
283
- SIGQUIT: 3,
284
- SIGSEGV: 11,
285
- SIGSTOP: 17,
286
- SIGTERM: 15,
287
- SIGTRAP: 5,
288
- SIGTSTP: 18,
289
- SIGTTIN: 21,
290
- SIGTTOU: 22,
291
- SIGUSR1: 30,
292
- SIGUSR2: 31
293
- };
294
- function i(e) {
295
- return o[e] || 0;
296
- }
297
- module.exports = function (o, u) {
298
- return new Promise((l, c) => {
299
- if (0 === o.length) return void l([]);
300
- const S = o.map(e => ({
301
- name: e,
302
- code: void 0
303
- })),
304
- I = o.map((e, n) => ({
305
- name: e,
306
- index: n
307
- })),
308
- a = [];
309
- let s = null,
310
- G = !1;
311
- function d() {
312
- null == s ? l(S) : c(s);
313
- }
314
- function f() {
315
- if (!G) if (G = !0, 0 === a.length) d();else {
316
- for (const e of a) e.abort();
317
- Promise.all(a).then(d, c);
318
- }
319
- }
320
- function g() {
321
- if (G) return;
322
- if (0 === I.length) return void (0 === a.length && d());
323
- const o = u.stdout,
324
- l = Object.assign({}, u),
325
- c = new e(null, {
326
- readable: !1
327
- });
328
- u.aggregateOutput && (l.stdout = c);
329
- const m = I.shift(),
330
- T = t(m.name, l);
331
- a.push(T), T.then(e => {
332
- r(a, T), G || (u.aggregateOutput && o.write(c.toString()), null === e.code && null !== e.signal && (e.code = 128 + i(e.signal)), S[m.index].code = e.code, (!e.code || (s = new n(e, S), u.continueOnError)) && (!u.race || e.code) ? g() : f());
333
- }, e => {
334
- if (r(a, T), !u.continueOnError || u.race) return s = e, void f();
335
- g();
336
- });
337
- }
338
- const m = u.maxParallel,
339
- T = "number" == typeof m && m > 0 ? Math.min(o.length, m) : o.length;
340
- for (let e = 0; e < T; ++e) g();
341
- });
342
- };
343
- }, {
344
- "./npm-run-all-error": "m/QK",
345
- "./run-task": "vpwb"
346
- }],
347
- Focm: [function (require, module, exports) {
348
- const e = require("shell-quote"),
349
- r = require("./match-tasks"),
350
- t = require("./read-package-json"),
351
- n = require("./run-tasks"),
352
- o = /\{(!)?([*@]|\d+)([^}]+)?}/g;
353
- function l(e) {
354
- return null == e ? [] : Array.isArray(e) ? e : [e];
355
- }
356
- function a(r, t) {
357
- const n = Object.create(null);
358
- return r.map(r => r.replace(o, (r, o, l, a) => {
359
- if (null != o) throw Error(`Invalid Placeholder: ${r}`);
360
- if ("@" === l) return e.quote(t);
361
- if ("*" === l) return e.quote([t.join(" ")]);
362
- const s = parseInt(l, 10);
363
- if (s >= 1 && s <= t.length) return e.quote([t[s - 1]]);
364
- if (null != a) {
365
- const t = a.slice(0, 2);
366
- if (":=" === t) return n[l] = e.quote([a.slice(2)]), n[l];
367
- if (":-" === t) return e.quote([a.slice(2)]);
368
- throw Error(`Invalid Placeholder: ${r}`);
369
- }
370
- return null != n[l] ? n[l] : "";
371
- }));
372
- }
373
- function s(e, r) {
374
- const t = l(e);
375
- return t.some(e => o.test(e)) ? a(t, r) : t;
376
- }
377
- function u(e) {
378
- const r = [];
379
- for (const t of Object.keys(e)) {
380
- const n = e[t];
381
- for (const e of Object.keys(n)) {
382
- const o = n[e];
383
- r.push(`--${t}:${e}=${o}`);
384
- }
385
- }
386
- return r;
387
- }
388
- function i(e) {
389
- return Object.keys(e).map(r => `--${r}=${e[r]}`);
390
- }
391
- function c(e, r) {
392
- return Math.max(r.length, e);
393
- }
394
- module.exports = function (e, o) {
395
- const l = o && o.stdin || null,
396
- a = o && o.stdout || null,
397
- f = o && o.stderr || null,
398
- p = o && o.taskList || null,
399
- g = o && o.config || null,
400
- h = o && o.packageConfig || null,
401
- d = o && o.arguments || [],
402
- m = Boolean(o && o.parallel),
403
- k = Boolean(o && o.silent),
404
- I = Boolean(o && o.continueOnError),
405
- q = Boolean(o && o.printLabel),
406
- w = Boolean(o && o.printName),
407
- P = Boolean(o && o.race),
408
- O = m ? o && o.maxParallel || 0 : 1,
409
- b = Boolean(o && o.aggregateOutput),
410
- y = o && o.npmPath;
411
- try {
412
- const o = s(e, d);
413
- if (0 === o.length) return Promise.resolve(null);
414
- if (null != p && !1 === Array.isArray(p)) throw new Error("Invalid options.taskList");
415
- if ("number" != typeof O || !(O >= 0)) throw new Error("Invalid options.maxParallel");
416
- if (!m && b) throw new Error("Invalid options.aggregateOutput; It requires options.parallel");
417
- if (!m && P) throw new Error("Invalid options.race; It requires options.parallel");
418
- const v = [].concat(k ? ["--silent"] : [], h ? u(h) : [], g ? i(g) : []);
419
- return Promise.resolve().then(() => null != p ? {
420
- taskList: p,
421
- packageInfo: null
422
- } : t()).then(e => {
423
- const t = r(e.taskList, o),
424
- s = t.reduce(c, 0);
425
- return n(t, {
426
- stdin: l,
427
- stdout: a,
428
- stderr: f,
429
- prefixOptions: v,
430
- continueOnError: I,
431
- labelState: {
432
- enabled: q,
433
- width: s,
434
- lastPrefix: null,
435
- lastIsLinebreak: !0
436
- },
437
- printName: w,
438
- packageInfo: e.packageInfo,
439
- race: P,
440
- maxParallel: O,
441
- npmPath: y,
442
- aggregateOutput: b
443
- });
444
- });
445
- } catch (E) {
446
- return Promise.reject(new Error(E.message));
447
- }
448
- };
449
- }, {
450
- "./match-tasks": "xX+4",
451
- "./read-package-json": "7fyY",
452
- "./run-tasks": "U8F2"
453
- }]
454
- }, {}, ["Focm"], null);
@@ -1,59 +0,0 @@
1
- import runAll from "./lib.js";
2
- import parseCLIArgs from "./parse-cli-args.js";
3
-
4
- //------------------------------------------------------------------------------
5
- // Public Interface
6
- //------------------------------------------------------------------------------
7
-
8
- /**
9
- * Parses arguments, then run specified npm-scripts.
10
- *
11
- * @param {string[]} args - Arguments to parse.
12
- * @param {stream.Writable} stdout - A writable stream to print logs.
13
- * @param {stream.Writable} stderr - A writable stream to print errors.
14
- * @returns {Promise} A promise which comes to be fulfilled when all npm-scripts are completed.
15
- * @private
16
- */
17
- export default function npmRunAll(args, stdout, stderr) {
18
- try {
19
- const stdin = process.stdin;
20
- const argv = parseCLIArgs(args, {
21
- parallel: true
22
- }, {
23
- singleMode: true
24
- });
25
- const group = argv.lastGroup;
26
- if (group.patterns.length === 0) {
27
- return Promise.resolve(null);
28
- }
29
- const promise = runAll(group.patterns, {
30
- stdout,
31
- stderr,
32
- stdin,
33
- parallel: group.parallel,
34
- maxParallel: argv.maxParallel,
35
- continueOnError: argv.continueOnError,
36
- printLabel: argv.printLabel,
37
- printName: argv.printName,
38
- config: argv.config,
39
- packageConfig: argv.packageConfig,
40
- silent: argv.silent,
41
- arguments: argv.rest,
42
- race: argv.race,
43
- npmPath: argv.npmPath,
44
- aggregateOutput: argv.aggregateOutput
45
- });
46
- if (!argv.silent) {
47
- promise.catch(err => {
48
- //eslint-disable-next-line no-console
49
- console.error("ERROR:", err.message);
50
- });
51
- }
52
- return promise;
53
- } catch (err) {
54
- //eslint-disable-next-line no-console
55
- console.error("ERROR:", err.message);
56
- return Promise.reject(err);
57
- }
58
- }
59
- ;
@@ -1,56 +0,0 @@
1
- import runAll from "./lib.js";
2
- import parseCLIArgs from "./parse-cli-args.js";
3
-
4
- //------------------------------------------------------------------------------
5
- // Public Interface
6
- //------------------------------------------------------------------------------
7
-
8
- /**
9
- * Parses arguments, then run specified npm-scripts.
10
- *
11
- * @param {string[]} args - Arguments to parse.
12
- * @param {stream.Writable} stdout - A writable stream to print logs.
13
- * @param {stream.Writable} stderr - A writable stream to print errors.
14
- * @returns {Promise} A promise which comes to be fulfilled when all npm-scripts are completed.
15
- * @private
16
- */
17
- export default function npmRunAll(args, stdout, stderr) {
18
- try {
19
- const stdin = process.stdin;
20
- const argv = parseCLIArgs(args, {
21
- parallel: false
22
- }, {
23
- singleMode: true
24
- });
25
- const group = argv.lastGroup;
26
- if (group.patterns.length === 0) {
27
- return Promise.resolve(null);
28
- }
29
- const promise = runAll(group.patterns, {
30
- stdout,
31
- stderr,
32
- stdin,
33
- parallel: group.parallel,
34
- continueOnError: argv.continueOnError,
35
- printLabel: argv.printLabel,
36
- printName: argv.printName,
37
- config: argv.config,
38
- packageConfig: argv.packageConfig,
39
- silent: argv.silent,
40
- arguments: argv.rest,
41
- npmPath: argv.npmPath
42
- });
43
- if (!argv.silent) {
44
- promise.catch(err => {
45
- //eslint-disable-next-line no-console
46
- console.error("ERROR:", err.message);
47
- });
48
- }
49
- return promise;
50
- } catch (err) {
51
- //eslint-disable-next-line no-console
52
- console.error("ERROR:", err.message);
53
- return Promise.reject(err);
54
- }
55
- }
56
- ;