diff options
Diffstat (limited to 'scripts/plugin/install.ts')
-rwxr-xr-x | scripts/plugin/install.ts | 41 |
1 files changed, 0 insertions, 41 deletions
diff --git a/scripts/plugin/install.ts b/scripts/plugin/install.ts deleted file mode 100755 index 138f34446..000000000 --- a/scripts/plugin/install.ts +++ /dev/null | |||
@@ -1,41 +0,0 @@ | |||
1 | import { program } from 'commander' | ||
2 | import { isAbsolute } from 'path' | ||
3 | import { initDatabaseModels } from '../../server/initializers/database' | ||
4 | import { PluginManager } from '../../server/lib/plugins/plugin-manager' | ||
5 | |||
6 | program | ||
7 | .option('-n, --npm-name [npmName]', 'Plugin to install') | ||
8 | .option('-v, --plugin-version [pluginVersion]', 'Plugin version to install') | ||
9 | .option('-p, --plugin-path [pluginPath]', 'Path of the plugin you want to install') | ||
10 | .parse(process.argv) | ||
11 | |||
12 | const options = program.opts() | ||
13 | |||
14 | if (!options.npmName && !options.pluginPath) { | ||
15 | console.error('You need to specify a plugin name with the desired version, or a plugin path.') | ||
16 | process.exit(-1) | ||
17 | } | ||
18 | |||
19 | if (options.pluginPath && !isAbsolute(options.pluginPath)) { | ||
20 | console.error('Plugin path should be absolute.') | ||
21 | process.exit(-1) | ||
22 | } | ||
23 | |||
24 | run() | ||
25 | .then(() => process.exit(0)) | ||
26 | .catch(err => { | ||
27 | console.error(err) | ||
28 | process.exit(-1) | ||
29 | }) | ||
30 | |||
31 | async function run () { | ||
32 | await initDatabaseModels(true) | ||
33 | |||
34 | const toInstall = options.npmName || options.pluginPath | ||
35 | await PluginManager.Instance.install({ | ||
36 | toInstall, | ||
37 | version: options.pluginVersion, | ||
38 | fromDisk: !!options.pluginPath, | ||
39 | register: false | ||
40 | }) | ||
41 | } | ||