This repository has been archived by the owner on May 12, 2021. It is now read-only.
forked from lerna/lerna
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
109 lines (103 loc) · 3.32 KB
/
index.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
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
108
109
"use strict";
const log = require("npmlog");
const dedent = require("dedent");
const getFilteredPackages = require("./lib/get-filtered-packages");
module.exports = filterOptions;
module.exports.getFilteredPackages = getFilteredPackages;
function filterOptions(yargs) {
// Only for 'run', 'exec', 'clean', 'ls', and 'bootstrap' commands
const opts = {
scope: {
describe: "Include only packages with names matching the given glob.",
type: "string",
requiresArg: true,
},
ignore: {
describe: "Exclude packages with names matching the given glob.",
type: "string",
requiresArg: true,
},
"no-private": {
describe: 'Exclude packages with { "private": true } in their package.json.',
type: "boolean",
},
private: {
// proxy for --no-private
hidden: true,
type: "boolean",
},
since: {
describe: dedent`
Only include packages that have been changed since the specified [ref].
If no ref is passed, it defaults to the most-recent tag.
`,
type: "string",
},
"exclude-dependents": {
describe: dedent`
Exclude all transitive dependents when running a command
with --since, overriding the default "changed" algorithm.
`,
conflicts: "include-dependents",
type: "boolean",
},
"include-dependents": {
describe: dedent`
Include all transitive dependents when running a command
regardless of --scope, --ignore, or --since.
`,
conflicts: "exclude-dependents",
type: "boolean",
},
"include-dependencies": {
describe: dedent`
Include all transitive dependencies when running a command
regardless of --scope, --ignore, or --since.
`,
type: "boolean",
},
"include-merged-tags": {
describe: "Include tags from merged branches when running a command with --since.",
type: "boolean",
},
"continue-if-no-match": {
describe: "Don't fail if no package is matched",
hidden: true,
type: "boolean",
},
};
return yargs
.options(opts)
.group(Object.keys(opts), "Filter Options:")
.option("include-filtered-dependents", {
// TODO: remove in next major release
hidden: true,
conflicts: ["exclude-dependents", "include-dependents"],
type: "boolean",
})
.option("include-filtered-dependencies", {
// TODO: remove in next major release
hidden: true,
conflicts: "include-dependencies",
type: "boolean",
})
.check(argv => {
/* eslint-disable no-param-reassign */
if (argv.includeFilteredDependents) {
argv.includeDependents = true;
argv["include-dependents"] = true;
delete argv.includeFilteredDependents;
delete argv["include-filtered-dependents"];
log.warn("deprecated", "--include-filtered-dependents has been renamed --include-dependents");
}
if (argv.includeFilteredDependencies) {
argv.includeDependencies = true;
argv["include-dependencies"] = true;
delete argv.includeFilteredDependencies;
delete argv["include-filtered-dependencies"];
log.warn("deprecated", "--include-filtered-dependencies has been renamed --include-dependencies");
}
/* eslint-enable no-param-reassign */
return argv;
});
}