Skip to content

Commit afae6fb

Browse files
moonglumFND
authored andcommitted
removed minimist
1 parent 53890f9 commit afae6fb

File tree

2 files changed

+45
-18
lines changed

2 files changed

+45
-18
lines changed

lib/cli.js

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

33
let readConfig = require("./config");
44
let { abort, repr } = require("./util");
5-
let parseArgs = require("minimist");
5+
let { parseArgs } = require("node:util");
66

77
let HELP = `
88
Usage:
@@ -27,27 +27,55 @@ Options:
2727
serve generated files via HTTP with live reloading
2828
`.trim();
2929

30-
module.exports = function parseCLI(argv = process.argv.slice(2), help = HELP) {
31-
argv = parseArgs(argv, {
32-
boolean: ["watch", "fingerprint", "sourcemaps", "compact"],
33-
alias: {
34-
c: "config",
35-
w: "watch",
36-
h: "help"
30+
module.exports = function parseCLI() {
31+
let { values } = parseArgs({
32+
options: {
33+
help: {
34+
type: "boolean",
35+
short: "h",
36+
default: false
37+
},
38+
config: {
39+
type: "string",
40+
short: "c"
41+
},
42+
watch: {
43+
type: "boolean",
44+
short: "w",
45+
default: false
46+
},
47+
fingerprint: {
48+
type: "boolean",
49+
default: false
50+
},
51+
sourcemaps: {
52+
type: "boolean",
53+
default: false
54+
},
55+
compact: {
56+
type: "boolean",
57+
default: false
58+
},
59+
serve: {
60+
type: "string"
61+
},
62+
liveserve: {
63+
type: "string"
64+
}
3765
}
3866
});
3967

40-
if(argv.help) {
41-
abort(help, 0);
68+
if(values.help) {
69+
abort(HELP, 0);
4270
}
4371

4472
let options = {
45-
watch: argv.watch,
46-
fingerprint: argv.fingerprint,
47-
sourcemaps: argv.sourcemaps,
48-
compact: argv.compact,
49-
serve: argv.serve,
50-
liveserve: argv.liveserve
73+
watch: values.watch,
74+
fingerprint: values.fingerprint,
75+
sourcemaps: values.sourcemaps,
76+
compact: values.compact,
77+
serve: values.serve,
78+
liveserve: values.liveserve
5179
};
5280

5381
if(options.watch && options.fingerprint) { // for convenience
@@ -56,6 +84,6 @@ module.exports = function parseCLI(argv = process.argv.slice(2), help = HELP) {
5684
}
5785

5886
let rootDir = process.cwd();
59-
let { referenceDir, config } = readConfig(rootDir, argv.config);
87+
let { referenceDir, config } = readConfig(rootDir, values.config);
6088
return { referenceDir, config, options };
6189
};

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
},
3030
"dependencies": {
3131
"browserslist": "~4.21.4",
32-
"minimist": "~1.2.7",
3332
"nite-owl": "~5.0.5"
3433
},
3534
"devDependencies": {

0 commit comments

Comments
 (0)