From ba5a8d89bbf049e4afc41543bcc072cccdb02669 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 3 Feb 2021 09:33:05 +0100 Subject: Update server dependencies --- scripts/plugin/install.ts | 10 ++++++---- scripts/plugin/uninstall.ts | 6 ++++-- 2 files changed, 10 insertions(+), 6 deletions(-) (limited to 'scripts/plugin') diff --git a/scripts/plugin/install.ts b/scripts/plugin/install.ts index 54738f50f..2ea8a658b 100755 --- a/scripts/plugin/install.ts +++ b/scripts/plugin/install.ts @@ -12,12 +12,14 @@ program .option('-p, --plugin-path [pluginPath]', 'Path of the plugin you want to install') .parse(process.argv) -if (!program['npmName'] && !program['pluginPath']) { +const options = program.opts() + +if (!options.npmName && !options.pluginPath) { console.error('You need to specify a plugin name with the desired version, or a plugin path.') process.exit(-1) } -if (program['pluginPath'] && !isAbsolute(program['pluginPath'])) { +if (options.pluginPath && !isAbsolute(options.pluginPath)) { console.error('Plugin path should be absolute.') process.exit(-1) } @@ -32,6 +34,6 @@ run() async function run () { await initDatabaseModels(true) - const toInstall = program['npmName'] || program['pluginPath'] - await PluginManager.Instance.install(toInstall, program['pluginVersion'], !!program['pluginPath']) + const toInstall = options.npmName || options.pluginPath + await PluginManager.Instance.install(toInstall, options.pluginVersion, !!options.pluginPath) } diff --git a/scripts/plugin/uninstall.ts b/scripts/plugin/uninstall.ts index c56f18466..8710b1750 100755 --- a/scripts/plugin/uninstall.ts +++ b/scripts/plugin/uninstall.ts @@ -9,7 +9,9 @@ program .option('-n, --npm-name [npmName]', 'Package name to install') .parse(process.argv) -if (!program['npmName']) { +const options = program.opts() + +if (!options.npmName) { console.error('You need to specify the plugin name.') process.exit(-1) } @@ -25,6 +27,6 @@ async function run () { await initDatabaseModels(true) - const toUninstall = program['npmName'] + const toUninstall = options.npmName await PluginManager.Instance.uninstall(toUninstall) } -- cgit v1.2.3