]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - scripts/plugin/uninstall.ts
1e14cc18f535f5b7062ab5dc990362c7a3b2fa78
[github/Chocobozzz/PeerTube.git] / scripts / plugin / uninstall.ts
1 import { registerTSPaths } from '../../server/helpers/register-ts-paths'
2 registerTSPaths()
3
4 import { initDatabaseModels } from '../../server/initializers/database'
5 import { program } from 'commander'
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
12 const options = program.opts()
13
14 if (!options.npmName) {
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 () {
27
28 await initDatabaseModels(true)
29
30 const toUninstall = options.npmName
31 await PluginManager.Instance.uninstall(toUninstall)
32 }