forked from lerna/lerna
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
command.js
69 lines (63 loc) · 1.97 KB
/
command.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
"use strict";
const filterable = require("@lerna/filter-options");
/**
* @see https://github.com/yargs/yargs/blob/master/docs/advanced.md#providing-a-command-module
*/
exports.command = "run <script>";
exports.describe = "Run an npm script in each package that contains that script";
exports.builder = yargs => {
yargs
.example("$0 run build -- --silent", "# `npm run build --silent` in all packages with a build script")
.parserConfiguration({
"populate--": true,
})
.positional("script", {
describe: "The npm script to run. Pass flags to send to the npm client after --",
type: "string",
})
.options({
"npm-client": {
group: "Command Options:",
describe: "Executable used to run scripts (npm, yarn, pnpm, ...).",
defaultDescription: "npm",
type: "string",
requiresArg: true,
},
stream: {
group: "Command Options:",
describe: "Stream output with lines prefixed by package.",
type: "boolean",
},
parallel: {
group: "Command Options:",
describe: "Run script with unlimited concurrency, streaming prefixed output.",
type: "boolean",
},
"no-bail": {
group: "Command Options:",
describe: "Continue running script despite non-zero exit in a given package.",
type: "boolean",
},
bail: {
// proxy for --no-bail
hidden: true,
type: "boolean",
},
// This option controls prefix for stream output so that it can be disabled to be friendly
// to tools like Visual Studio Code to highlight the raw results
"no-prefix": {
group: "Command Options:",
describe: "Do not prefix streaming output.",
type: "boolean",
},
prefix: {
// proxy for --no-prefix
hidden: true,
type: "boolean",
},
});
return filterable(yargs);
};
exports.handler = function handler(argv) {
return require(".")(argv);
};