Skip to content

Commit f57b73d

Browse files
committed
Remove dependency to yargs and use node:utils parseArgs
1 parent 00d9d3a commit f57b73d

File tree

5 files changed

+136
-307
lines changed

5 files changed

+136
-307
lines changed

gulpfile.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -736,7 +736,7 @@ function runTests(testsName, { bot = false, xfaOnly = false } = {}) {
736736
}
737737
if (process.argv.includes("--coverage-output")) {
738738
args.push(
739-
"--coverage-output",
739+
"--coverageOutput",
740740
process.argv[process.argv.indexOf("--coverage-output") + 1]
741741
);
742742
}

package-lock.json

Lines changed: 25 additions & 118 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,7 @@
6565
"typescript": "^5.9.3",
6666
"vinyl": "^3.0.1",
6767
"webpack": "^5.105.2",
68-
"webpack-stream": "^7.0.0",
69-
"yargs": "^18.0.0"
68+
"webpack-stream": "^7.0.0"
7069
},
7170
"repository": {
7271
"type": "git",

test/stats/statcmp.js

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,33 +2,36 @@
22

33
import { createRequire } from "module";
44
import fs from "fs";
5+
import { parseArgs } from "node:util";
56

67
const require = createRequire(import.meta.url);
78
const ttest = require("ttest");
89

910
const VALID_GROUP_BYS = ["browser", "pdf", "page", "round", "stat"];
1011

1112
function parseOptions() {
12-
const yargs = require("yargs")
13-
.usage(
13+
const { values, positionals } = parseArgs({
14+
args: process.argv.slice(2),
15+
allowPositionals: true,
16+
options: {
17+
groupBy: { type: "string", default: "browser,stat" },
18+
},
19+
});
20+
21+
if (positionals.length < 2) {
22+
console.error(
1423
"Compare the results of two stats files.\n" +
15-
"Usage:\n $0 <BASELINE> <CURRENT> [options]"
16-
)
17-
.demand(2)
18-
.string(["groupBy"])
19-
.describe(
20-
"groupBy",
21-
"How statistics should grouped. Valid options: " +
22-
VALID_GROUP_BYS.join(" ")
23-
)
24-
.default("groupBy", "browser,stat");
25-
const result = yargs.argv;
26-
result.baseline = result._[0];
27-
result.current = result._[1];
28-
if (result.groupBy) {
29-
result.groupBy = result.groupBy.split(/[;, ]+/);
24+
"Usage:\n statcmp.js <BASELINE> <CURRENT> [--groupBy=<fields>]\n\n" +
25+
` --groupBy How statistics should be grouped. Valid options: ${VALID_GROUP_BYS.join(" ")}. [browser,stat]`
26+
);
27+
process.exit(1);
3028
}
31-
return result;
29+
30+
return {
31+
baseline: positionals[0],
32+
current: positionals[1],
33+
groupBy: values.groupBy.split(/[;, ]+/),
34+
};
3235
}
3336

3437
function group(stats, groupBy) {

0 commit comments

Comments
 (0)