Skip to content

Commit 7899ab8

Browse files
committed
feat(cli): Upgrade to Yargs 12
It is no longer necessary to specify `default: undefined` for boolean options, as those keys are no longer automatically assigned to the parsed argv regardless of presence in process.argv.
1 parent 2d2ab8d commit 7899ab8

File tree

16 files changed

+262
-87
lines changed

16 files changed

+262
-87
lines changed

commands/bootstrap/command.js

-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ exports.builder = yargs => {
3535
group: "Command Options:",
3636
describe: "Don't run lifecycle scripts in bootstrapped packages",
3737
type: "boolean",
38-
default: undefined,
3938
},
4039
"npm-client": {
4140
group: "Command Options:",

commands/changed/command.js

-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ exports.builder = yargs =>
1717
describe: "Show information in JSON format",
1818
group: "Command Options:",
1919
type: "boolean",
20-
default: undefined,
2120
},
2221
});
2322

commands/clean/command.js

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ exports.builder = yargs => {
1414
yes: {
1515
group: "Command Options:",
1616
describe: "Skip all confirmation prompts",
17+
type: "boolean",
1718
},
1819
});
1920

commands/create/command.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ exports.builder = yargs => {
4242
"es-module": {
4343
group: "Command Options:",
4444
describe: "Initialize a transpiled ES Module",
45-
// type: "boolean",
45+
type: "boolean",
4646
},
4747
homepage: {
4848
group: "Command Options:",
@@ -63,7 +63,7 @@ exports.builder = yargs => {
6363
private: {
6464
group: "Command Options:",
6565
describe: "Make the new package private, never published to any external registry",
66-
// type: "boolean",
66+
type: "boolean",
6767
},
6868
registry: {
6969
group: "Command Options:",
@@ -78,7 +78,7 @@ exports.builder = yargs => {
7878
yes: {
7979
group: "Command Options:",
8080
describe: "Skip all prompts, accepting default values",
81-
// type: "boolean",
81+
type: "boolean",
8282
},
8383
});
8484

commands/exec/command.js

+2-6
Original file line numberDiff line numberDiff line change
@@ -25,30 +25,26 @@ exports.builder = yargs => {
2525
bail: {
2626
group: "Command Options:",
2727
describe: "Stop when the command fails in a package.\nPass --no-bail to continue despite failure.",
28-
defaultDescription: "true",
28+
default: true,
2929
type: "boolean",
30-
default: undefined,
3130
},
3231
stream: {
3332
group: "Command Options:",
3433
describe: "Stream output with lines prefixed by package.",
3534
type: "boolean",
36-
default: undefined,
3735
},
3836
parallel: {
3937
group: "Command Options:",
4038
describe: "Run command in all packages with unlimited concurrency, streaming prefixed output",
4139
type: "boolean",
42-
default: undefined,
4340
},
4441
// This option controls prefix for stream output so that it can be disabled to be friendly
4542
// to tools like Visual Studio Code to highlight the raw results
4643
prefix: {
4744
group: "Command Options:",
4845
describe: "Pass --no-prefix to disable prefixing of streamed output.",
49-
defaultDescription: "true",
46+
default: true,
5047
type: "boolean",
51-
default: undefined,
5248
},
5349
});
5450

commands/import/command.js

+2
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,12 @@ exports.builder = yargs =>
1414
flatten: {
1515
group: "Command Options:",
1616
describe: "Import each merge commit as a single change the merge introduced",
17+
type: "boolean",
1718
},
1819
yes: {
1920
group: "Command Options:",
2021
describe: "Skip all confirmation prompts",
22+
type: "boolean",
2123
},
2224
});
2325

commands/init/command.js

-2
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,11 @@ exports.builder = {
1111
exact: {
1212
describe: "Specify lerna dependency version in package.json without a caret (^)",
1313
type: "boolean",
14-
default: undefined,
1514
},
1615
independent: {
1716
describe: "Version packages independently",
1817
alias: "i",
1918
type: "boolean",
20-
default: undefined,
2119
},
2220
};
2321

commands/link/command.js

-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ exports.builder = yargs => {
1313
group: "Command Options:",
1414
describe: "Force local sibling links regardless of version range match",
1515
type: "boolean",
16-
default: undefined,
1716
},
1817
});
1918

commands/list/command.js

-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ exports.builder = yargs => {
1717
group: "Command Options:",
1818
describe: "Show information in JSON format",
1919
type: "boolean",
20-
default: undefined,
2120
},
2221
});
2322

commands/publish/command.js

-8
Original file line numberDiff line numberDiff line change
@@ -40,17 +40,14 @@ exports.builder = yargs => {
4040
"conventional-commits": {
4141
describe: "Use angular conventional-commit format to determine version bump and generate CHANGELOG.",
4242
type: "boolean",
43-
default: undefined,
4443
},
4544
"changelog-preset": {
4645
describe: "Use another conventional-changelog preset rather than angular.",
4746
type: "string",
48-
default: undefined,
4947
},
5048
exact: {
5149
describe: "Specify cross-dependency version numbers exactly rather than with a caret (^).",
5250
type: "boolean",
53-
default: undefined,
5451
},
5552
"git-remote": {
5653
defaultDescription: "origin",
@@ -71,7 +68,6 @@ exports.builder = yargs => {
7168
amend: {
7269
describe: "Amend the existing commit, instead of generating a new one.",
7370
type: "boolean",
74-
default: false,
7571
},
7672
"npm-tag": {
7773
describe: "Publish packages with the specified npm dist-tag",
@@ -101,22 +97,18 @@ exports.builder = yargs => {
10197
"skip-git": {
10298
describe: "Skip commiting, tagging, and pushing git changes.",
10399
type: "boolean",
104-
default: undefined,
105100
},
106101
"skip-npm": {
107102
describe: "Stop before actually publishing change to npm.",
108103
type: "boolean",
109-
default: undefined,
110104
},
111105
"temp-tag": {
112106
describe: "Create a temporary tag while publishing.",
113107
type: "boolean",
114-
default: undefined,
115108
},
116109
yes: {
117110
describe: "Skip all confirmation prompts.",
118111
type: "boolean",
119-
default: undefined,
120112
},
121113
};
122114

commands/run/command.js

+2-6
Original file line numberDiff line numberDiff line change
@@ -20,30 +20,26 @@ exports.builder = yargs => {
2020
bail: {
2121
group: "Command Options:",
2222
describe: "Stop when the script fails in a package.\nPass --no-bail to continue despite failure.",
23-
defaultDescription: "true",
23+
default: true,
2424
type: "boolean",
25-
default: undefined,
2625
},
2726
stream: {
2827
group: "Command Options:",
2928
describe: "Stream output with lines prefixed by package.",
3029
type: "boolean",
31-
default: undefined,
3230
},
3331
parallel: {
3432
group: "Command Options:",
3533
describe: "Run script in all packages with unlimited concurrency, streaming prefixed output.",
3634
type: "boolean",
37-
default: undefined,
3835
},
3936
// This option controls prefix for stream output so that it can be disabled to be friendly
4037
// to tools like Visual Studio Code to highlight the raw results
4138
prefix: {
4239
group: "Command Options:",
4340
describe: "Pass --no-prefix to disable prefixing of streamed output.",
44-
defaultDescription: "true",
41+
default: true,
4542
type: "boolean",
46-
default: undefined,
4743
},
4844
"npm-client": {
4945
group: "Command Options:",

core/cli/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,6 @@
5050
"dedent": "^0.7.0",
5151
"is-ci": "^1.0.10",
5252
"npmlog": "^4.1.2",
53-
"yargs": "^11.0.0"
53+
"yargs": "^12.0.1"
5454
}
5555
}

core/filter-options/index.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,14 @@ function filterOptions(yargs) {
3232
Include all transitive dependents when running a command
3333
regardless of --scope, --ignore, or --since.
3434
`,
35-
boolean: true,
35+
type: "boolean",
3636
},
3737
"include-filtered-dependencies": {
3838
describe: dedent`
3939
Include all transitive dependencies when running a command
4040
regardless of --scope, --ignore, or --since.
4141
`,
42-
boolean: true,
42+
type: "boolean",
4343
},
4444
};
4545

core/global-options/index.js

+1-4
Original file line numberDiff line numberDiff line change
@@ -18,22 +18,19 @@ function globalOptions(yargs) {
1818
"reject-cycles": {
1919
describe: "Fail if a cycle is detected among dependencies.",
2020
type: "boolean",
21-
default: undefined,
2221
},
2322
progress: {
2423
defaultDescription: "true",
2524
describe: "Enable progress bars. Pass --no-progress to disable. (Always off in CI)",
2625
type: "boolean",
27-
default: undefined,
2826
},
2927
sort: {
3028
defaultDescription: "true",
3129
describe: "Sort packages topologically (all dependencies before dependents).",
3230
type: "boolean",
33-
default: undefined,
3431
},
3532
"max-buffer": {
36-
describe: "Set max-buffer(bytes) for Command execution",
33+
describe: "Set max-buffer (in bytes) for subcommand execution",
3734
type: "number",
3835
requiresArg: true,
3936
},

helpers/command-runner/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@
77
"license": "MIT",
88
"dependencies": {
99
"@lerna/global-options": "file:../../core/global-options",
10-
"yargs": "^11.0.0"
10+
"yargs": "^12.0.1"
1111
}
1212
}

0 commit comments

Comments
 (0)