mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-14 07:24:52 +09:00
Correctly handle installs with no plugins or dependencies
This commit is contained in:
1 parent
2e729b9e47
commit
9b0a06815b
1 file changed
+6
-6
@@ -96,17 +96,17 @@ async function findNpmPlugins(pluginList: Map<string, string>, pluginListPath: s
|
||||
throw err;
|
||||
}
|
||||
|
||||
if (!dependencies) {
|
||||
return;
|
||||
}
|
||||
|
||||
let changed = 0;
|
||||
for (const [packageName, packageVersion] of Object.entries(dependencies)) {
|
||||
if ([...pluginList.values()].includes(packageName)) {
|
||||
continue; // This npm module is already in the plugin list
|
||||
}
|
||||
// Find the package in node_modules and read the package.json
|
||||
const packageJsonPath = path.resolve("node_modules", packageName, "package.json");
|
||||
const packageJson = JSON.parse(await fs.readFile(packageJsonPath, { encoding: "utf8" }));
|
||||
// Check if the package has the "clusterio-plugin" keyword
|
||||
if (packageJson.keywords?.includes("clusterio-plugin")) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
||||
// Find the package in node_modules and read the package.json to check if it's a clusterio-plugin
|
||||
if (await checkPackageJson(path.resolve("node_modules", packageName))) {
|
||||
const pluginName = getPluginName(path.resolve("node_modules", packageName));
|
||||
if (pluginList.has(pluginName)) {
|
||||
logger.warn(
|
||||
|
||||
Reference in new issue
Block a user