Skip to content

Commit 8903671

Browse files
chore: update commander and avoid del
1 parent b2ecd31 commit 8903671

6 files changed

Lines changed: 23 additions & 225 deletions

File tree

package-lock.json

Lines changed: 5 additions & 200 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
@@ -47,7 +47,7 @@
4747
"@discoveryjs/json-ext": "^0.6.3",
4848
"acorn": "^8.0.4",
4949
"acorn-walk": "^8.0.0",
50-
"commander": "^7.2.0",
50+
"commander": "^14.0.2",
5151
"escape-string-regexp": "^5.0.0",
5252
"html-escaper": "^3.0.3",
5353
"opener": "^1.5.2",
@@ -73,7 +73,6 @@
7373
"css-loader": "^7.1.3",
7474
"cssnano": "^7.1.2",
7575
"debounce": "^3.0.0",
76-
"del": "^6.0.0",
7776
"del-cli": "^7.0.0",
7877
"eslint": "^5.16.0",
7978
"eslint-config-th0r": "^2.0.0",

src/bin/analyzer.js

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
const { resolve, dirname } = require("path");
44

5-
const commander = require("commander");
5+
const { program: commanderProgram } = require("commander");
66
const { magenta } = require("picocolors");
77

88
const analyzer = require("../analyzer");
@@ -16,17 +16,13 @@ const COMPRESSION_ALGORITHMS = new Set(
1616
isZstdSupported ? ["gzip", "brotli", "zstd"] : ["gzip", "brotli"],
1717
);
1818

19-
const program = commander
19+
const program = commanderProgram
2020
.version(require("../../package.json").version)
21-
.usage(
22-
`<bundleStatsFile> [bundleDir] [options]
23-
24-
Arguments:
25-
26-
bundleStatsFile Path to Webpack Stats JSON file.
27-
bundleDir Directory containing all generated bundles.
28-
You should provided it if you want analyzer to show you the real parsed module sizes.
29-
By default a directory of stats file is used.`,
21+
.argument("<bundleStatsFile>", "Path to Webpack Stats JSON file.")
22+
.argument(
23+
"[bundleDir]",
24+
// eslint-disable-next-line max-len
25+
"Directory containing all generated bundles. You should provided it if you want analyzer to show you the real parsed module sizes. By default a directory of stats file is used.",
3026
)
3127
.option(
3228
"-m, --mode <mode>",
@@ -89,7 +85,9 @@ const program = commander
8985
"Log level." + br(`Possible values: ${[...Logger.levels].join(", ")}`),
9086
Logger.defaultLevel,
9187
)
92-
.parse(process.argv);
88+
.parse();
89+
90+
console.log(program.args);
9391

9492
let [bundleStatsFile, bundleDir] = program.args;
9593
let {

test/analyzer.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
const fs = require("fs");
22
const path = require("path");
3-
const del = require("del");
43
const childProcess = require("child_process");
54
const puppeteer = require("puppeteer");
65
const { isZstdSupported } = require("../src/sizeUtils");
@@ -12,15 +11,15 @@ describe("Analyzer", function () {
1211

1312
beforeAll(async function () {
1413
browser = await puppeteer.launch();
15-
del.sync(`${__dirname}/output`);
14+
await fs.promises.rm(`${__dirname}/output`, { force: true, recursive: true });
1615
});
1716

1817
beforeEach(async function () {
1918
jest.setTimeout(15000);
2019
});
2120

22-
afterEach(function () {
23-
del.sync(`${__dirname}/output`);
21+
afterEach(async function () {
22+
await fs.promises.rm(`${__dirname}/output`, { force: true, recursive: true });
2423
});
2524

2625
afterAll(async function () {

0 commit comments

Comments
 (0)