Switch to more common minimist

This commit is contained in:
Travis Shivers 2020-06-22 21:13:58 -05:00
parent 28d64042a4
commit 6fdbdcc84f
3 changed files with 7 additions and 13 deletions

View File

@ -1,4 +1,4 @@
const args = require('args-parser')(process.argv);
const argv = require('minimist')(process.argv.slice(2));
const { coalesce } = require('./src/utils/helpers');
@ -191,12 +191,12 @@ module.exports = {
for (let i = 0; i < fields.length; i++) {
const setting = fields[i];
// console.log('Processing setting', setting);
// console.log(`Args: '${args[setting.env]}'; '${args[setting.local]}'`);
// console.log(`Args: '${argv[setting.env]}'; '${argv[setting.local]}'`);
// console.log(`ENV: '${process.env[setting.env]}'; '${process.env[setting.local]}'`);
// console.log(`Settings: '${settings[setting.local]}'; '${setting.default}'`);
const value = coalesce(
args[setting.env],
args[setting.local],
argv[setting.env],
argv[setting.local],
process.env[setting.env],
process.env[setting.local],
settings[setting.env],
@ -207,7 +207,7 @@ module.exports = {
// Backwards compatibilty for PORT ENV setting
if (setting.local === 'webapp_port' && output[setting.local] === 8088) {
const port = args.PORT || process.env.PORT || settings.PORT;
const port = argv.PORT || process.env.PORT || settings.PORT;
if (port && port !== 8088) {
console.log(`Please change 'PORT' to 'WEB_PORT'. Setting WEB_PORT to '${port}'`);
output[setting.local] = port;

8
package-lock.json generated
View File

@ -2854,11 +2854,6 @@
"sprintf-js": "~1.0.2"
}
},
"args-parser": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/args-parser/-/args-parser-1.1.0.tgz",
"integrity": "sha1-YlO/zWlNJ5/mPqr9eNYo0UoF/6k="
},
"arr-diff": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-4.0.0.tgz",
@ -8301,8 +8296,7 @@
"minimist": {
"version": "1.2.5",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz",
"integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==",
"dev": true
"integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw=="
},
"minipass": {
"version": "3.1.3",

View File

@ -12,10 +12,10 @@
"start": "node server.js"
},
"dependencies": {
"args-parser": "^1.1.0",
"core-js": "^3.6.5",
"cors": "^2.8.5",
"express": "^4.17.1",
"minimist": "^1.2.5",
"socket.io": "^2.3.0",
"vue": "^2.6.11",
"vue-router": "^3.3.4",