From 9b0a06815bbd8d92b0d38176d7660641680af822 Mon Sep 17 00:00:00 2001 From: Danielv123 Date: Thu, 28 Nov 2024 20:27:31 +0000 Subject: [PATCH] Correctly handle installs with no plugins or dependencies --- packages/lib/src/load_plugin_list.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/lib/src/load_plugin_list.ts b/packages/lib/src/load_plugin_list.ts index 826a667d..2e62dda3 100644 --- a/packages/lib/src/load_plugin_list.ts +++ b/packages/lib/src/load_plugin_list.ts @@ -96,17 +96,17 @@ async function findNpmPlugins(pluginList: Map, 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(