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