diff options
author | Chocobozzz <me@florianbigard.com> | 2019-07-11 17:23:24 +0200 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2019-07-24 10:58:16 +0200 |
commit | 8d2be0ed7bb87283a1ec98609df6b82d83db706a (patch) | |
tree | 31a36b252df32be83ceb77658a53b57f9d15e8ac /scripts | |
parent | dba85a1e9e9f603ba52e1ea42deaf3fdd799b1d8 (diff) | |
download | PeerTube-8d2be0ed7bb87283a1ec98609df6b82d83db706a.tar.gz PeerTube-8d2be0ed7bb87283a1ec98609df6b82d83db706a.tar.zst PeerTube-8d2be0ed7bb87283a1ec98609df6b82d83db706a.zip |
WIP plugins: move plugin CLI in peertube script
Install/uninstall/list plugins remotely
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/dev/cli.sh | 15 | ||||
-rwxr-xr-x | scripts/plugin/install.ts | 39 | ||||
-rwxr-xr-x | scripts/plugin/uninstall.ts | 27 |
3 files changed, 15 insertions, 66 deletions
diff --git a/scripts/dev/cli.sh b/scripts/dev/cli.sh new file mode 100755 index 000000000..4b6fe5508 --- /dev/null +++ b/scripts/dev/cli.sh | |||
@@ -0,0 +1,15 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | set -eu | ||
4 | |||
5 | rm -rf ./dist/server/tools/ | ||
6 | |||
7 | ( | ||
8 | cd ./server/tools | ||
9 | yarn install --pure-lockfile | ||
10 | ) | ||
11 | |||
12 | mkdir -p "./dist/server/tools" | ||
13 | cp -r "./server/tools/node_modules" "./dist/server/tools" | ||
14 | |||
15 | npm run tsc -- --watch --project ./server/tools/tsconfig.json | ||
diff --git a/scripts/plugin/install.ts b/scripts/plugin/install.ts deleted file mode 100755 index 1725cbeb6..000000000 --- a/scripts/plugin/install.ts +++ /dev/null | |||
@@ -1,39 +0,0 @@ | |||
1 | import { initDatabaseModels } from '../../server/initializers/database' | ||
2 | import * as program from 'commander' | ||
3 | import { PluginManager } from '../../server/lib/plugins/plugin-manager' | ||
4 | import { isAbsolute } from 'path' | ||
5 | |||
6 | program | ||
7 | .option('-n, --plugin-name [pluginName]', 'Plugin name 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 | if (!program['pluginName'] && !program['pluginPath']) { | ||
13 | console.error('You need to specify a plugin name with the desired version, or a plugin path.') | ||
14 | process.exit(-1) | ||
15 | } | ||
16 | |||
17 | if (program['pluginName'] && !program['pluginVersion']) { | ||
18 | console.error('You need to specify a the version of the plugin you want to install.') | ||
19 | process.exit(-1) | ||
20 | } | ||
21 | |||
22 | if (program['pluginPath'] && !isAbsolute(program['pluginPath'])) { | ||
23 | console.error('Plugin path should be absolute.') | ||
24 | process.exit(-1) | ||
25 | } | ||
26 | |||
27 | run() | ||
28 | .then(() => process.exit(0)) | ||
29 | .catch(err => { | ||
30 | console.error(err) | ||
31 | process.exit(-1) | ||
32 | }) | ||
33 | |||
34 | async function run () { | ||
35 | await initDatabaseModels(true) | ||
36 | |||
37 | const toInstall = program['pluginName'] || program['pluginPath'] | ||
38 | await PluginManager.Instance.install(toInstall, program['pluginVersion'], !!program['pluginPath']) | ||
39 | } | ||
diff --git a/scripts/plugin/uninstall.ts b/scripts/plugin/uninstall.ts deleted file mode 100755 index 7dcc234db..000000000 --- a/scripts/plugin/uninstall.ts +++ /dev/null | |||
@@ -1,27 +0,0 @@ | |||
1 | import { initDatabaseModels } from '../../server/initializers/database' | ||
2 | import * as program from 'commander' | ||
3 | import { PluginManager } from '../../server/lib/plugins/plugin-manager' | ||
4 | import { isAbsolute } from 'path' | ||
5 | |||
6 | program | ||
7 | .option('-n, --package-name [packageName]', 'Package name to install') | ||
8 | .parse(process.argv) | ||
9 | |||
10 | if (!program['packageName']) { | ||
11 | console.error('You need to specify the plugin name.') | ||
12 | process.exit(-1) | ||
13 | } | ||
14 | |||
15 | run() | ||
16 | .then(() => process.exit(0)) | ||
17 | .catch(err => { | ||
18 | console.error(err) | ||
19 | process.exit(-1) | ||
20 | }) | ||
21 | |||
22 | async function run () { | ||
23 | await initDatabaseModels(true) | ||
24 | |||
25 | const toUninstall = program['packageName'] | ||
26 | await PluginManager.Instance.uninstall(toUninstall) | ||
27 | } | ||