1 import { registerTSPaths } from '../../server/helpers/register-ts-paths'
4 import { initDatabaseModels } from '../../server/initializers/database'
5 import * as program from 'commander'
6 import { PluginManager } from '../../server/lib/plugins/plugin-manager'
7 import { isAbsolute } from 'path'
10 .option('-n, --npm-name [npmName]', 'Plugin to install')
11 .option('-v, --plugin-version [pluginVersion]', 'Plugin version to install')
12 .option('-p, --plugin-path [pluginPath]', 'Path of the plugin you want to install')
15 if (!program['npmName'] && !program['pluginPath']) {
16 console.error('You need to specify a plugin name with the desired version, or a plugin path.')
20 if (program['pluginPath'] && !isAbsolute(program['pluginPath'])) {
21 console.error('Plugin path should be absolute.')
26 .then(() => process.exit(0))
32 async function run () {
33 await initDatabaseModels(true)
35 const toInstall = program['npmName'] || program['pluginPath']
36 await PluginManager.Instance.install(toInstall, program['pluginVersion'], !!program['pluginPath'])