mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-05-04 22:27:10 -04:00
46 lines
1.1 KiB
TypeScript
46 lines
1.1 KiB
TypeScript
'use strict';
|
|
|
|
import {linkInstaller, installedPluginsPath} from "ep_etherpad-lite/static/js/pluginfw/installer";
|
|
import {persistInstalledPlugins} from "./commonPlugins";
|
|
|
|
if (process.argv.length === 2) {
|
|
console.error('Expected at least one argument!');
|
|
process.exit(1);
|
|
}
|
|
|
|
let args = process.argv.slice(2)
|
|
|
|
let registryPlugins: string[] = [];
|
|
let localPlugins: string[] = [];
|
|
|
|
if (args.indexOf('--path') !== -1) {
|
|
const indexToSplit = args.indexOf('--path');
|
|
registryPlugins = args.slice(0, indexToSplit);
|
|
localPlugins = args.slice(indexToSplit + 1);
|
|
} else {
|
|
registryPlugins = args;
|
|
}
|
|
|
|
|
|
|
|
async function run() {
|
|
for (const plugin of registryPlugins) {
|
|
console.log(`Installing plugin from registry: ${plugin}`)
|
|
if (plugin.includes('@')) {
|
|
const [name, version] = plugin.split('@');
|
|
await linkInstaller.installPlugin(name, version);
|
|
continue;
|
|
}
|
|
await linkInstaller.installPlugin(plugin);
|
|
}
|
|
|
|
for (const plugin of localPlugins) {
|
|
console.log(`Installing plugin from path: ${plugin}`);
|
|
await linkInstaller.installFromPath(plugin);
|
|
}
|
|
}
|
|
|
|
(async () => {
|
|
await run();
|
|
await persistInstalledPlugins();
|
|
})();
|