Skip to content

Commit b6de2d2

Browse files
alan-agius4dgp1130
authored andcommitted
refactor(@angular-devkit/benchmark): replace parser with yargs-parser
1 parent 5330d52 commit b6de2d2

File tree

3 files changed

+18
-9
lines changed

3 files changed

+18
-9
lines changed

Diff for: packages/angular_devkit/benchmark/BUILD.bazel

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ ts_library(
2525
deps = [
2626
"//packages/angular_devkit/core",
2727
"//packages/angular_devkit/core/node",
28-
"@npm//@types/minimist",
2928
"@npm//@types/node",
3029
"@npm//@types/pidusage",
30+
"@npm//@types/yargs-parser",
3131
"@npm//ansi-colors",
3232
"@npm//rxjs",
3333
],
@@ -60,12 +60,12 @@ jasmine_node_test(
6060
srcs = [":benchmark_test_lib"],
6161
deps = [
6262
"@npm//jasmine",
63-
"@npm//minimist",
6463
"@npm//pidtree",
6564
"@npm//pidusage",
6665
"@npm//source-map",
6766
"@npm//temp",
6867
"@npm//tree-kill",
68+
"@npm//yargs-parser",
6969
],
7070
)
7171

Diff for: packages/angular_devkit/benchmark/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@
1212
"dependencies": {
1313
"@angular-devkit/core": "0.0.0-PLACEHOLDER",
1414
"ansi-colors": "4.1.1",
15-
"minimist": "1.2.5",
1615
"pidusage": "3.0.0",
1716
"pidtree": "0.5.0",
1817
"rxjs": "6.6.7",
19-
"tree-kill": "^1.2.0"
18+
"tree-kill": "^1.2.0",
19+
"yargs-parser": "21.0.1"
2020
}
2121
}

Diff for: packages/angular_devkit/benchmark/src/main.ts

+14-5
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ import { logging, tags } from '@angular-devkit/core';
1111
import { ProcessOutput } from '@angular-devkit/core/node';
1212
import * as ansiColors from 'ansi-colors';
1313
import { appendFileSync, writeFileSync } from 'fs';
14-
import minimist from 'minimist';
1514
import { filter, map, toArray } from 'rxjs/operators';
15+
import yargsParser from 'yargs-parser';
1616
import { Command } from '../src/command';
1717
import { defaultReporter } from '../src/default-reporter';
1818
import { defaultStatsCapture } from '../src/default-stats-capture';
@@ -25,6 +25,7 @@ export interface MainOptions {
2525
stderr?: ProcessOutput;
2626
}
2727

28+
// eslint-disable-next-line max-lines-per-function
2829
export async function main({
2930
args,
3031
stdout = process.stdout,
@@ -69,13 +70,22 @@ export async function main({
6970
'watch-timeout': number;
7071
'watch-matcher'?: string;
7172
'watch-script'?: string;
72-
'--': string[] | null;
73+
'--': string[];
74+
_: string[];
75+
$0: string;
7376
}
7477

7578
// Parse the command line.
76-
const argv = minimist(args, {
79+
const argv = yargsParser(args, {
7780
boolean: ['help', 'verbose', 'overwrite-output-file'],
7881
string: ['watch-matcher', 'watch-script'],
82+
configuration: {
83+
'dot-notation': false,
84+
'boolean-negation': true,
85+
'strip-aliased': true,
86+
'populate--': true,
87+
'camel-case-expansion': false,
88+
},
7989
default: {
8090
'exit-code': 0,
8191
'iterations': 5,
@@ -85,8 +95,7 @@ export async function main({
8595
'prefix': '[benchmark]',
8696
'watch-timeout': 10000,
8797
},
88-
'--': true,
89-
}) as {} as BenchmarkCliArgv;
98+
}) as BenchmarkCliArgv;
9099

91100
// Create the DevKit Logger used through the CLI.
92101
const logger = new logging.TransformLogger('benchmark-prefix-logger', (stream) =>

0 commit comments

Comments
 (0)