mirror of
https://gitee.com/nocobase/nocobase.git
synced 2025-05-07 14:39:25 +08:00
fix: continent on error (#5740)
This commit is contained in:
parent
f56f49d3ca
commit
c825182f32
@ -128,7 +128,12 @@ export class PluginManagerRepository extends Repository {
|
||||
}
|
||||
const sorter = new Topo.Sorter<string>();
|
||||
for (const pluginName of pluginNames) {
|
||||
const packageJson = await PluginManager.getPackageJson(pluginName);
|
||||
let packageJson: any = {};
|
||||
try {
|
||||
packageJson = await PluginManager.getPackageJson(pluginName);
|
||||
} catch (error) {
|
||||
packageJson = {};
|
||||
}
|
||||
const peerDependencies = Object.keys(packageJson?.peerDependencies || {});
|
||||
sorter.add(pluginName, { after: peerDependencies, group: packageJson?.packageName || pluginName });
|
||||
}
|
||||
|
@ -130,9 +130,11 @@ export class PluginManager {
|
||||
*/
|
||||
static async getPackageJson(nameOrPkg: string) {
|
||||
const { packageName } = await this.parseName(nameOrPkg);
|
||||
const file = await fs.realpath(resolve(process.env.NODE_MODULES_PATH, packageName, 'package.json'));
|
||||
const data = await fs.readFile(file, { encoding: 'utf-8' });
|
||||
return JSON.parse(data);
|
||||
const packageFile = resolve(process.env.NODE_MODULES_PATH, packageName, 'package.json');
|
||||
if (!(await fs.exists(packageFile))) {
|
||||
throw new Error(`Cannot find plugin '${nameOrPkg}'`);
|
||||
}
|
||||
return fs.readJSON(packageFile);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user