Skip to content

Commit d0d36bd

Browse files
committed
fix: bump yargs and fix wwwroot path
1 parent 1224307 commit d0d36bd

File tree

3 files changed

+82
-83
lines changed

3 files changed

+82
-83
lines changed

lib/options.js

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,16 @@ function getConfig(filePath, configFileType, failureConsequence, quiet) {
6363
}
6464

6565
function loadCommandLine() {
66-
var yargs = require("yargs")
67-
.parserConfiguration({
68-
"duplicate-arguments-array": false
66+
var yargs = require("yargs");
67+
var hideBin = require("yargs/helpers").hideBin;
68+
69+
const argv = yargs(hideBin(process.argv))
70+
.usage("$0 [options] <wwwroot>", false, (y) => {
71+
return y.positional("wwwroot", {
72+
describe: "path/to/wwwroot",
73+
type: "string"
74+
});
6975
})
70-
.usage("$0 [options] [path/to/wwwroot]")
7176
.strict()
7277
.options({
7378
port: {
@@ -98,11 +103,25 @@ function loadCommandLine() {
98103
description: "Show this help."
99104
}
100105
});
101-
if (yargs.argv.help) {
102-
yargs.showHelp();
106+
107+
if (argv.argv.help) {
108+
argv.showHelp();
103109
process.exit();
104110
}
105-
return yargs.argv;
111+
112+
Object.keys(argv.argv).forEach((key) => {
113+
if (key !== "_") {
114+
argv.coerce(key, (opt) => {
115+
if (Array.isArray(opt) && opt.length > 0) {
116+
return opt[opt.length - 1];
117+
} else {
118+
return opt;
119+
}
120+
});
121+
}
122+
});
123+
124+
return argv.parseSync();
106125
}
107126

108127
options.init = function (quiet) {
@@ -129,7 +148,7 @@ options.init = function (quiet) {
129148
}
130149

131150
this.port = argv.port || this.settings.port || 3001;
132-
this.wwwroot = argv._.length > 0 ? argv._[0] : process.cwd() + "/wwwroot";
151+
this.wwwroot = argv.wwwroot ? argv.wwwroot : process.cwd() + "/wwwroot";
133152
this.configDir = argv.configFile ? path.dirname(argv.configFile) : ".";
134153
this.verbose = argv.verbose;
135154
this.hostName = this.listenHost || this.settings.hostName || "localhost";

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
"rate-limiter-flexible": "^7.1.1",
4747
"request": "^2.88.2",
4848
"request-promise": "^4.0.1",
49-
"yargs": "^17.7.2"
49+
"yargs": "^18.0.0"
5050
},
5151
"devDependencies": {
5252
"jasmine": "^4.6.0",

yarn.lock

Lines changed: 54 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -62,17 +62,15 @@ ajv@^6.12.3:
6262
json-schema-traverse "^0.4.1"
6363
uri-js "^4.2.2"
6464

65-
ansi-regex@^5.0.1:
66-
version "5.0.1"
67-
resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.1.tgz#082cb2c89c9fe8659a311a53bd6a4dc5301db304"
68-
integrity sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==
65+
ansi-regex@^6.0.1:
66+
version "6.2.2"
67+
resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-6.2.2.tgz#60216eea464d864597ce2832000738a0589650c1"
68+
integrity sha512-Bq3SmSpyFHaWjPk8If9yc6svM8c56dB5BAtW4Qbw5jHTwwXXcTLoRMkpDJp6VL0XzlWaCHTXrkFURMYmD0sLqg==
6969

70-
ansi-styles@^4.0.0:
71-
version "4.3.0"
72-
resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-4.3.0.tgz#edd803628ae71c04c85ae7a0906edad34b648937"
73-
integrity sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==
74-
dependencies:
75-
color-convert "^2.0.1"
70+
ansi-styles@^6.2.1:
71+
version "6.2.3"
72+
resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-6.2.3.tgz#c044d5dcc521a076413472597a1acb1f103c4041"
73+
integrity sha512-4Dj6M28JB+oAH8kFkTLUo+a2jwOFkuqb3yucU0CANcRRUbxS0cP0nZYCGjcc3BNXwRIsUVmDGgzawme7zvJHvg==
7674

7775
array-flatten@1.1.1:
7876
version "1.1.1"
@@ -239,26 +237,14 @@ caseless@~0.12.0:
239237
resolved "https://registry.yarnpkg.com/caseless/-/caseless-0.12.0.tgz#1b681c21ff84033c826543090689420d187151dc"
240238
integrity sha512-4tYFyifaFfGacoiObjJegolkwSU4xQNGbVgUiNYVUxbQ2x2lUsFvY4hVgVzGiIe6WLOPqycWXA40l+PWsxthUw==
241239

242-
cliui@^8.0.1:
243-
version "8.0.1"
244-
resolved "https://registry.yarnpkg.com/cliui/-/cliui-8.0.1.tgz#0c04b075db02cbfe60dc8e6cf2f5486b1a3608aa"
245-
integrity sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==
240+
cliui@^9.0.1:
241+
version "9.0.1"
242+
resolved "https://registry.yarnpkg.com/cliui/-/cliui-9.0.1.tgz#6f7890f386f6f1f79953adc1f78dec46fcc2d291"
243+
integrity sha512-k7ndgKhwoQveBL+/1tqGJYNz097I7WOvwbmmU2AR5+magtbjPWQTS1C5vzGkBC8Ym8UWRzfKUzUUqFLypY4Q+w==
246244
dependencies:
247-
string-width "^4.2.0"
248-
strip-ansi "^6.0.1"
249-
wrap-ansi "^7.0.0"
250-
251-
color-convert@^2.0.1:
252-
version "2.0.1"
253-
resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-2.0.1.tgz#72d3a68d598c9bdb3af2ad1e84f21d896abd4de3"
254-
integrity sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==
255-
dependencies:
256-
color-name "~1.1.4"
257-
258-
color-name@~1.1.4:
259-
version "1.1.4"
260-
resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2"
261-
integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==
245+
string-width "^7.2.0"
246+
strip-ansi "^7.1.0"
247+
wrap-ansi "^9.0.0"
262248

263249
combined-stream@^1.0.6, combined-stream@^1.0.8, combined-stream@~1.0.6:
264250
version "1.0.8"
@@ -412,10 +398,10 @@ ee-first@1.1.1:
412398
resolved "https://registry.yarnpkg.com/ee-first/-/ee-first-1.1.1.tgz#590c61156b0ae2f4f0255732a158b266bc56b21d"
413399
integrity sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==
414400

415-
emoji-regex@^8.0.0:
416-
version "8.0.0"
417-
resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-8.0.0.tgz#e818fd69ce5ccfcb404594f842963bf53164cc37"
418-
integrity sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==
401+
emoji-regex@^10.3.0:
402+
version "10.6.0"
403+
resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-10.6.0.tgz#bf3d6e8f7f8fd22a65d9703475bc0147357a6b0d"
404+
integrity sha512-toUI84YS5YmxW219erniWD0CIVOo46xGKColeNQRgOzDorgBi1v4D71/OFzgD9GO2UGKIv1C3Sp8DAn0+j5w7A==
419405

420406
encodeurl@~1.0.2:
421407
version "1.0.2"
@@ -624,6 +610,11 @@ get-caller-file@^2.0.5:
624610
resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-2.0.5.tgz#4f94412a82db32f36e3b0b9741f8a97feb031f7e"
625611
integrity sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==
626612

613+
get-east-asian-width@^1.0.0:
614+
version "1.4.0"
615+
resolved "https://registry.yarnpkg.com/get-east-asian-width/-/get-east-asian-width-1.4.0.tgz#9bc4caa131702b4b61729cb7e42735bc550c9ee6"
616+
integrity sha512-QZjmEOC+IT1uk6Rx0sX22V6uHWVwbdbxf1faPqJ1QhLdGgsRGCZoyaQBm/piRdJy/D2um6hM1UP7ZEeQ4EkP+Q==
617+
627618
get-intrinsic@^1.2.4, get-intrinsic@^1.2.5, get-intrinsic@^1.2.6, get-intrinsic@^1.3.0:
628619
version "1.3.0"
629620
resolved "https://registry.yarnpkg.com/get-intrinsic/-/get-intrinsic-1.3.0.tgz#743f0e3b6964a93a5491ed1bffaae054d7f98d01"
@@ -789,11 +780,6 @@ is-callable@^1.2.7:
789780
resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.2.7.tgz#3bc2a85ea742d9e36205dcacdd72ca1fdc51b055"
790781
integrity sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==
791782

792-
is-fullwidth-code-point@^3.0.0:
793-
version "3.0.0"
794-
resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz#f116f8064fe90b3f7844a38997c0b75051269f1d"
795-
integrity sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==
796-
797783
is-generator-function@^1.0.7:
798784
version "1.1.0"
799785
resolved "https://registry.yarnpkg.com/is-generator-function/-/is-generator-function-1.1.0.tgz#bf3eeda931201394f57b5dba2800f91a238309ca"
@@ -1220,11 +1206,6 @@ request@^2.88.2:
12201206
tunnel-agent "^0.6.0"
12211207
uuid "^3.3.2"
12221208

1223-
require-directory@^2.1.1:
1224-
version "2.1.1"
1225-
resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42"
1226-
integrity sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==
1227-
12281209
safe-buffer@5.1.2:
12291210
version "5.1.2"
12301211
resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d"
@@ -1375,21 +1356,21 @@ strict-event-emitter@^0.5.1:
13751356
resolved "https://registry.yarnpkg.com/strict-event-emitter/-/strict-event-emitter-0.5.1.tgz#1602ece81c51574ca39c6815e09f1a3e8550bd93"
13761357
integrity sha512-vMgjE/GGEPEFnhFub6pa4FmJBRBVOLpIII2hvCZ8Kzb7K0hlHo7mQv6xYrBvCL2LtAIBwFUK8wvuJgTVSQ5MFQ==
13771358

1378-
string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3:
1379-
version "4.2.3"
1380-
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
1381-
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
1359+
string-width@^7.0.0, string-width@^7.2.0:
1360+
version "7.2.0"
1361+
resolved "https://registry.yarnpkg.com/string-width/-/string-width-7.2.0.tgz#b5bb8e2165ce275d4d43476dd2700ad9091db6dc"
1362+
integrity sha512-tsaTIkKW9b4N+AEj+SVA+WhJzV7/zMhcSu78mLKWSk7cXMOSHsBKFWUs0fWwq8QyK3MgJBQRX6Gbi4kYbdvGkQ==
13821363
dependencies:
1383-
emoji-regex "^8.0.0"
1384-
is-fullwidth-code-point "^3.0.0"
1385-
strip-ansi "^6.0.1"
1364+
emoji-regex "^10.3.0"
1365+
get-east-asian-width "^1.0.0"
1366+
strip-ansi "^7.1.0"
13861367

1387-
strip-ansi@^6.0.0, strip-ansi@^6.0.1:
1388-
version "6.0.1"
1389-
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
1390-
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
1368+
strip-ansi@^7.1.0:
1369+
version "7.1.2"
1370+
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-7.1.2.tgz#132875abde678c7ea8d691533f2e7e22bb744dba"
1371+
integrity sha512-gmBGslpoQJtgnMAvOVqGZpEz9dyoKTCzy2nfz/n8aIFhN/jCE/rCmcxabB6jOOHV+0WNnylOxaxBQPSvcWklhA==
13911372
dependencies:
1392-
ansi-regex "^5.0.1"
1373+
ansi-regex "^6.0.1"
13931374

13941375
superagent@^10.2.1:
13951376
version "10.2.1"
@@ -1525,14 +1506,14 @@ wkt-parser@^1.5.1:
15251506
resolved "https://registry.yarnpkg.com/wkt-parser/-/wkt-parser-1.5.2.tgz#a8eaf86ac2cc1d0a2e6a8082a930f5c7ebdb5771"
15261507
integrity sha512-1ZUiV1FTwSiSrgWzV9KXJuOF2BVW91KY/mau04BhnmgOdroRQea7Q0s5TVqwGLm0D2tZwObd/tBYXW49sSxp3Q==
15271508

1528-
wrap-ansi@^7.0.0:
1529-
version "7.0.0"
1530-
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43"
1531-
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
1509+
wrap-ansi@^9.0.0:
1510+
version "9.0.2"
1511+
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-9.0.2.tgz#956832dea9494306e6d209eb871643bb873d7c98"
1512+
integrity sha512-42AtmgqjV+X1VpdOfyTGOYRi0/zsoLqtXQckTmqTeybT+BDIbM/Guxo7x3pE2vtpr1ok6xRqM9OpBe+Jyoqyww==
15321513
dependencies:
1533-
ansi-styles "^4.0.0"
1534-
string-width "^4.1.0"
1535-
strip-ansi "^6.0.0"
1514+
ansi-styles "^6.2.1"
1515+
string-width "^7.0.0"
1516+
strip-ansi "^7.1.0"
15361517

15371518
wrappy@1:
15381519
version "1.0.2"
@@ -1557,20 +1538,19 @@ y18n@^5.0.5:
15571538
resolved "https://registry.yarnpkg.com/y18n/-/y18n-5.0.8.tgz#7f4934d0f7ca8c56f95314939ddcd2dd91ce1d55"
15581539
integrity sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==
15591540

1560-
yargs-parser@^21.1.1:
1561-
version "21.1.1"
1562-
resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-21.1.1.tgz#9096bceebf990d21bb31fa9516e0ede294a77d35"
1563-
integrity sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==
1541+
yargs-parser@^22.0.0:
1542+
version "22.0.0"
1543+
resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-22.0.0.tgz#87b82094051b0567717346ecd00fd14804b357c8"
1544+
integrity sha512-rwu/ClNdSMpkSrUb+d6BRsSkLUq1fmfsY6TOpYzTwvwkg1/NRG85KBy3kq++A8LKQwX6lsu+aWad+2khvuXrqw==
15641545

1565-
yargs@^17.7.2:
1566-
version "17.7.2"
1567-
resolved "https://registry.yarnpkg.com/yargs/-/yargs-17.7.2.tgz#991df39aca675a192b816e1e0363f9d75d2aa269"
1568-
integrity sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==
1546+
yargs@^18.0.0:
1547+
version "18.0.0"
1548+
resolved "https://registry.yarnpkg.com/yargs/-/yargs-18.0.0.tgz#6c84259806273a746b09f579087b68a3c2d25bd1"
1549+
integrity sha512-4UEqdc2RYGHZc7Doyqkrqiln3p9X2DZVxaGbwhn2pi7MrRagKaOcIKe8L3OxYcbhXLgLFUS3zAYuQjKBQgmuNg==
15691550
dependencies:
1570-
cliui "^8.0.1"
1551+
cliui "^9.0.1"
15711552
escalade "^3.1.1"
15721553
get-caller-file "^2.0.5"
1573-
require-directory "^2.1.1"
1574-
string-width "^4.2.3"
1554+
string-width "^7.2.0"
15751555
y18n "^5.0.5"
1576-
yargs-parser "^21.1.1"
1556+
yargs-parser "^22.0.0"

0 commit comments

Comments
 (0)