Skip to content

Commit 5b3aa08

Browse files
committed
remove yargs-parser
1 parent 3ecb5d1 commit 5b3aa08

File tree

4 files changed

+43
-29
lines changed

4 files changed

+43
-29
lines changed

benchmark/package-lock.json

Lines changed: 1 addition & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

benchmark/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
"type": "module",
33
"dependencies": {
44
"express": "^5.1.0",
5-
"playwright": "^1.54.2",
6-
"yargs-parser": "^22.0.0"
5+
"playwright": "^1.54.2"
76
}
87
}

benchmark/run.js

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,37 @@ import { mkdir, readdir } from "node:fs/promises";
44
import { createServer } from "node:http";
55
import { dirname, join } from "node:path";
66
import { fileURLToPath } from "node:url";
7+
import { parseArgs } from "node:util";
78
import { chromium, firefox } from "playwright";
8-
import yargsParser from "yargs-parser";
99

1010
const ctx = dirname(fileURLToPath(import.meta.url));
11-
const args = yargsParser(process.argv.slice(2), {
12-
boolean: ["headless", "trace", "trace-all"],
13-
default: {
14-
headless: true,
11+
const args = parseArgs({
12+
allowNegative: true,
13+
options: {
14+
headless: {
15+
type: "boolean",
16+
default: true,
17+
},
18+
trace: {
19+
type: "boolean",
20+
default: false,
21+
},
22+
"trace-all": {
23+
type: "boolean",
24+
default: false,
25+
},
26+
only: {
27+
type: "string",
28+
},
29+
snapshot: {
30+
type: "string",
31+
},
1532
},
16-
string: ["only", "snapshot"],
17-
});
18-
const headless = args.headless ?? false;
19-
const traceAll = args["trace-all"] ?? false;
20-
const trace = traceAll ? false : (args.trace ?? false);
33+
}).values;
34+
35+
const headless = args.headless;
36+
const traceAll = args["trace-all"];
37+
const trace = traceAll ? false : args.trace;
2138

2239
const traces = join(ctx, "traces");
2340
if (trace || traceAll) {

benchmark/snapshot.js

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,26 @@ import { spawn } from "node:child_process";
33
import { access, mkdir } from "node:fs/promises";
44
import { dirname, join } from "node:path";
55
import { fileURLToPath } from "node:url";
6+
import { parseArgs } from "node:util";
67
import { rollup } from "rollup";
7-
import yargsParser from "yargs-parser";
88
import { tscOut } from "../scripts/common.js";
99

1010
const ctx = dirname(fileURLToPath(import.meta.url));
1111
const repo = join(ctx, "..");
1212
const snapshots = join(ctx, "src/snapshots");
1313

14-
const args = yargsParser(process.argv.slice(2), {
15-
boolean: ["build"],
16-
string: ["name"],
17-
});
14+
const args = parseArgs({
15+
allowNegative: true,
16+
options: {
17+
build: {
18+
type: "boolean",
19+
default: true,
20+
},
21+
name: {
22+
type: "string",
23+
},
24+
},
25+
}).values;
1826

1927
await mkdir(snapshots, { recursive: true });
2028
const baseExists = await access(join(snapshots, "base.js")).then(() => true, () => false);
@@ -23,7 +31,7 @@ if (typeof name !== "string" || !/^[a-z0-9\-]+$/.test(name)) {
2331
throw new Error("invalid name");
2432
}
2533

26-
if (args.build ?? true) {
34+
if (args.build) {
2735
await exec(repo, "npm run build:es");
2836
}
2937

0 commit comments

Comments
 (0)