]>
Commit | Line | Data |
---|---|---|
2aaa1a3f C |
1 | import { registerTSPaths } from '../../server/helpers/register-ts-paths' |
2 | registerTSPaths() | |
3 | ||
b5f919ac | 4 | import { initDatabaseModels } from '../../server/initializers/database' |
8cc61201 | 5 | import { program } from 'commander' |
b5f919ac C |
6 | import { PluginManager } from '../../server/lib/plugins/plugin-manager' |
7 | ||
8 | program | |
9 | .option('-n, --npm-name [npmName]', 'Package name to install') | |
10 | .parse(process.argv) | |
11 | ||
ba5a8d89 C |
12 | const options = program.opts() |
13 | ||
14 | if (!options.npmName) { | |
b5f919ac C |
15 | console.error('You need to specify the plugin name.') |
16 | process.exit(-1) | |
17 | } | |
18 | ||
19 | run() | |
20 | .then(() => process.exit(0)) | |
21 | .catch(err => { | |
22 | console.error(err) | |
23 | process.exit(-1) | |
24 | }) | |
25 | ||
26 | async function run () { | |
2aaa1a3f | 27 | |
b5f919ac C |
28 | await initDatabaseModels(true) |
29 | ||
ba5a8d89 | 30 | const toUninstall = options.npmName |
b5f919ac C |
31 | await PluginManager.Instance.uninstall(toUninstall) |
32 | } |