mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-01-31 19:02:59 +01:00
Fixed installing of local packages.
This commit is contained in:
parent
31dd3a6690
commit
a7f81e824a
1 changed files with 12 additions and 6 deletions
|
@ -9,6 +9,7 @@ const axios = require('axios');
|
|||
const {PluginManager} = require("live-plugin-manager");
|
||||
const {promises: fs} = require("fs");
|
||||
const path = require("path");
|
||||
const {findEtherpadRoot} = require("../../../node/utils/AbsolutePaths");
|
||||
const logger = log4js.getLogger('plugins');
|
||||
|
||||
exports.manager = new PluginManager();
|
||||
|
@ -50,17 +51,22 @@ const migratePluginsFromNodeModules = async () => {
|
|||
const {dependencies = {}} = JSON.parse(await runCmd(cmd, {stdio: [null, 'string']}));
|
||||
await Promise.all(Object.entries(dependencies).map(async ([pkg, info]) => {
|
||||
if (pkg.startsWith(plugins.prefix) && pkg !== 'ep_etherpad-lite') {
|
||||
await exports.manager.install(pkg)
|
||||
if (!info._resolved) {
|
||||
// Install from node_modules directory
|
||||
await exports.manager.installFromPath(`${findEtherpadRoot()}/src/node_modules/${pkg}`);
|
||||
} else {
|
||||
await exports.manager.install(pkg);
|
||||
}
|
||||
}
|
||||
}));
|
||||
await persistInstalledPlugins();
|
||||
}
|
||||
};
|
||||
|
||||
exports.checkForMigration = async () => {
|
||||
logger.info('check installed plugins for migration')
|
||||
logger.info('check installed plugins for migration');
|
||||
|
||||
try {
|
||||
await fs.access(installedPluginsPath, fs.constants.F_OK)
|
||||
await fs.access(installedPluginsPath, fs.constants.F_OK);
|
||||
} catch (err) {
|
||||
await migratePluginsFromNodeModules();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue