uninstall.ts 737 B

123456789101112131415161718192021222324252627282930
  1. import { registerTSPaths } from '../../server/helpers/register-ts-paths'
  2. registerTSPaths()
  3. import { initDatabaseModels } from '../../server/initializers/database'
  4. import * as program from 'commander'
  5. import { PluginManager } from '../../server/lib/plugins/plugin-manager'
  6. program
  7. .option('-n, --npm-name [npmName]', 'Package name to install')
  8. .parse(process.argv)
  9. if (!program['npmName']) {
  10. console.error('You need to specify the plugin name.')
  11. process.exit(-1)
  12. }
  13. run()
  14. .then(() => process.exit(0))
  15. .catch(err => {
  16. console.error(err)
  17. process.exit(-1)
  18. })
  19. async function run () {
  20. await initDatabaseModels(true)
  21. const toUninstall = program['npmName']
  22. await PluginManager.Instance.uninstall(toUninstall)
  23. }