From 0057e4e75e7a7e51619fa4b2b4864ff7772d53f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alvaro=20Cabrera=20Dur=C3=A1n?= Date: Sun, 24 Mar 2019 05:08:39 -0600 Subject: [PATCH] Remove argv support; use user input --- cli/index.js | 18 ++++++------------ package-lock.json | 13 ------------- package.json | 3 +-- 3 files changed, 7 insertions(+), 27 deletions(-) diff --git a/cli/index.js b/cli/index.js index 787ec91..826212b 100644 --- a/cli/index.js +++ b/cli/index.js @@ -1,7 +1,3 @@ -const argv = require('wargs')(process.argv.slice(2)); - -const cmd = argv._.shift(); - const USAGE_INFO = ` Perform database changes @@ -35,20 +31,18 @@ Examples: {bin} backup --save path/to/seeds --only Product,Cart `; -const defaults = { - migrations: argv._.slice(), - options: argv.flags, -}; - function getHelp(binary) { return USAGE_INFO.replace(/{bin}/g, binary || process.argv.slice(1)[0]); } -function runHook(moduleName) { - return conn => require(`./${moduleName}`)(conn, defaults); +function runHook(argv, conn) { + return require(`./${argv._.shift()}`)(conn, { + migrations: argv._.slice(), + options: argv.flags, + }); } module.exports = { usage: getHelp, - execute: runHook(cmd), + execute: runHook, }; diff --git a/package-lock.json b/package-lock.json index 1b9ac13..e53ed03 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1519,11 +1519,6 @@ "integrity": "sha1-3BXKHGcjh8p2vTesCjlbogQqLCg=", "dev": true }, - "getopts": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/getopts/-/getopts-2.2.1.tgz", - "integrity": "sha512-ga4ofUeKxyViBrNaO1asJZSG4JEbzqfKyYhHzDQkVrjgYR8WD+2RBkziKlkcv9JvHRgmjbMQWP3bjlSkiH57sg==" - }, "getpass": { "version": "0.1.7", "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", @@ -5500,14 +5495,6 @@ "extsprintf": "^1.2.0" } }, - "wargs": { - "version": "0.8.1", - "resolved": "https://registry.npmjs.org/wargs/-/wargs-0.8.1.tgz", - "integrity": "sha512-KWD6zP8r0Q2G6CSBiVzrEpTs80G4yttALT86LKrSCnbNmgTn4SdbBS+1AK1fT3iOCoSlVrCWeGrow2m/CMjv7Q==", - "requires": { - "getopts": "^2.0.0" - } - }, "which": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/which/-/which-1.3.0.tgz", diff --git a/package.json b/package.json index aa54a63..54d7ec1 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,6 @@ "fs-extra": "^7.0.1", "glob": "^7.1.2", "sequelize": "^4.22.5", - "umzug": "^2.0.1", - "wargs": "^0.8.1" + "umzug": "^2.0.1" } }