2
1

uninstall.ts 762 B

1234567891011121314151617181920212223242526272829303132
  1. import { registerTSPaths } from '../../server/helpers/register-ts-paths'
  2. registerTSPaths()
  3. import { initDatabaseModels } from '../../server/initializers/database'
  4. import { 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. const options = program.opts()
  10. if (!options.npmName) {
  11. console.error('You need to specify the plugin name.')
  12. process.exit(-1)
  13. }
  14. run()
  15. .then(() => process.exit(0))
  16. .catch(err => {
  17. console.error(err)
  18. process.exit(-1)
  19. })
  20. async function run () {
  21. await initDatabaseModels(true)
  22. const toUninstall = options.npmName
  23. await PluginManager.Instance.uninstall(toUninstall)
  24. }