From 2c0539420d77339e6afe8d7920b44af4c0dcb1e6 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 8 Jul 2019 14:02:03 +0200 Subject: WIP plugins: static files --- scripts/plugin/install.ts | 6 +++--- scripts/plugin/uninstall.ts | 27 +++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 3 deletions(-) create mode 100755 scripts/plugin/uninstall.ts (limited to 'scripts/plugin') diff --git a/scripts/plugin/install.ts b/scripts/plugin/install.ts index 8e9c9897f..1725cbeb6 100755 --- a/scripts/plugin/install.ts +++ b/scripts/plugin/install.ts @@ -4,9 +4,9 @@ import { PluginManager } from '../../server/lib/plugins/plugin-manager' import { isAbsolute } from 'path' program - .option('-n, --pluginName [pluginName]', 'Plugin name to install') - .option('-v, --pluginVersion [pluginVersion]', 'Plugin version to install') - .option('-p, --pluginPath [pluginPath]', 'Path of the plugin you want to install') + .option('-n, --plugin-name [pluginName]', 'Plugin name to install') + .option('-v, --plugin-version [pluginVersion]', 'Plugin version to install') + .option('-p, --plugin-path [pluginPath]', 'Path of the plugin you want to install') .parse(process.argv) if (!program['pluginName'] && !program['pluginPath']) { diff --git a/scripts/plugin/uninstall.ts b/scripts/plugin/uninstall.ts new file mode 100755 index 000000000..7dcc234db --- /dev/null +++ b/scripts/plugin/uninstall.ts @@ -0,0 +1,27 @@ +import { initDatabaseModels } from '../../server/initializers/database' +import * as program from 'commander' +import { PluginManager } from '../../server/lib/plugins/plugin-manager' +import { isAbsolute } from 'path' + +program + .option('-n, --package-name [packageName]', 'Package name to install') + .parse(process.argv) + +if (!program['packageName']) { + console.error('You need to specify the plugin name.') + process.exit(-1) +} + +run() + .then(() => process.exit(0)) + .catch(err => { + console.error(err) + process.exit(-1) + }) + +async function run () { + await initDatabaseModels(true) + + const toUninstall = program['packageName'] + await PluginManager.Instance.uninstall(toUninstall) +} -- cgit v1.2.3