aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/scripts/plugin/uninstall.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/scripts/plugin/uninstall.ts')
-rwxr-xr-xserver/scripts/plugin/uninstall.ts29
1 files changed, 29 insertions, 0 deletions
diff --git a/server/scripts/plugin/uninstall.ts b/server/scripts/plugin/uninstall.ts
new file mode 100755
index 000000000..baf0422c4
--- /dev/null
+++ b/server/scripts/plugin/uninstall.ts
@@ -0,0 +1,29 @@
1import { program } from 'commander'
2import { initDatabaseModels } from '@server/initializers/database.js'
3import { PluginManager } from '@server/lib/plugins/plugin-manager.js'
4
5program
6 .option('-n, --npm-name [npmName]', 'Package name to install')
7 .parse(process.argv)
8
9const options = program.opts()
10
11if (!options.npmName) {
12 console.error('You need to specify the plugin name.')
13 process.exit(-1)
14}
15
16run()
17 .then(() => process.exit(0))
18 .catch(err => {
19 console.error(err)
20 process.exit(-1)
21 })
22
23async function run () {
24
25 await initDatabaseModels(true)
26
27 const toUninstall = options.npmName
28 await PluginManager.Instance.uninstall({ npmName: toUninstall, unregister: false })
29}