1
0
Fork 0
peertube/server/scripts/plugin/uninstall.ts

30 lines
698 B
TypeScript
Raw Normal View History

2021-06-25 11:39:27 -04:00
import { program } from 'commander'
import { initDatabaseModels } from '@server/initializers/database.js'
import { PluginManager } from '@server/lib/plugins/plugin-manager.js'
2019-07-12 05:39:58 -04:00
program
.option('-n, --npm-name [npmName]', 'Package name to install')
.parse(process.argv)
2021-02-03 03:33:05 -05:00
const options = program.opts()
if (!options.npmName) {
2019-07-12 05:39:58 -04:00
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 () {
2019-07-12 05:39:58 -04:00
await initDatabaseModels(true)
2021-02-03 03:33:05 -05:00
const toUninstall = options.npmName
await PluginManager.Instance.uninstall({ npmName: toUninstall, unregister: false })
2019-07-12 05:39:58 -04:00
}