diff options
Diffstat (limited to 'scripts/plugin')
-rwxr-xr-x | scripts/plugin/install.ts | 6 | ||||
-rwxr-xr-x | scripts/plugin/uninstall.ts | 27 |
2 files changed, 30 insertions, 3 deletions
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' | |||
4 | import { isAbsolute } from 'path' | 4 | import { isAbsolute } from 'path' |
5 | 5 | ||
6 | program | 6 | program |
7 | .option('-n, --pluginName [pluginName]', 'Plugin name to install') | 7 | .option('-n, --plugin-name [pluginName]', 'Plugin name to install') |
8 | .option('-v, --pluginVersion [pluginVersion]', 'Plugin version to install') | 8 | .option('-v, --plugin-version [pluginVersion]', 'Plugin version to install') |
9 | .option('-p, --pluginPath [pluginPath]', 'Path of the plugin you want to install') | 9 | .option('-p, --plugin-path [pluginPath]', 'Path of the plugin you want to install') |
10 | .parse(process.argv) | 10 | .parse(process.argv) |
11 | 11 | ||
12 | if (!program['pluginName'] && !program['pluginPath']) { | 12 | 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 @@ | |||
1 | import { initDatabaseModels } from '../../server/initializers/database' | ||
2 | import * as program from 'commander' | ||
3 | import { PluginManager } from '../../server/lib/plugins/plugin-manager' | ||
4 | import { isAbsolute } from 'path' | ||
5 | |||
6 | program | ||
7 | .option('-n, --package-name [packageName]', 'Package name to install') | ||
8 | .parse(process.argv) | ||
9 | |||
10 | if (!program['packageName']) { | ||
11 | console.error('You need to specify the plugin name.') | ||
12 | process.exit(-1) | ||
13 | } | ||
14 | |||
15 | run() | ||
16 | .then(() => process.exit(0)) | ||
17 | .catch(err => { | ||
18 | console.error(err) | ||
19 | process.exit(-1) | ||
20 | }) | ||
21 | |||
22 | async function run () { | ||
23 | await initDatabaseModels(true) | ||
24 | |||
25 | const toUninstall = program['packageName'] | ||
26 | await PluginManager.Instance.uninstall(toUninstall) | ||
27 | } | ||