Added compatibility with install-plugins script

This commit is contained in:
SamTV12345 2024-06-01 11:19:24 +02:00
parent c67be391f2
commit f6f6ea9d4c
2 changed files with 20 additions and 4 deletions

View file

@ -12,11 +12,15 @@ if (process.argv.length === 2) {
let args = process.argv.slice(2)
// 3d arg is ls, install or rm
let action = args[0];
const possibleActions = [
"i",
"install",
"rm",
"remove",
"ls",
"list"
]
const install = ()=> {
@ -33,6 +37,9 @@ const install = ()=> {
async function run() {
for (const plugin of registryPlugins) {
if (possibleActions.includes(plugin)){
continue
}
console.log(`Installing plugin from registry: ${plugin}`)
if (plugin.includes('@')) {
const [name, version] = plugin.split('@');
@ -81,6 +88,14 @@ const remove = (plugins: string[])=>{
})();
}
let action = args[0];
if (!possibleActions.includes(action)) {
// This is the old plugin install via install-plugins
console.warn("Using legacy plugin install. Please update to the new command `pnpm run plugins install <your-plugin>`")
install()
process.exit(0)
}
switch (action) {
case "install":

View file

@ -25,6 +25,7 @@
"test-admin": "pnpm --filter ep_etherpad-lite run test-admin",
"test-admin:ui": "pnpm --filter ep_etherpad-lite run test-admin:ui",
"plugins": "pnpm --filter bin run plugins",
"install-plugins": "pnpm --filter bin run plugins",
"remove-plugins": "pnpm --filter bin run remove-plugins",
"list-plugins": "pnpm --filter bin run list-plugins"
},