mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-23 16:23:12 +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;
|
throw err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!dependencies) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
let changed = 0;
|
let changed = 0;
|
||||||
for (const [packageName, packageVersion] of Object.entries(dependencies)) {
|
for (const [packageName, packageVersion] of Object.entries(dependencies)) {
|
||||||
if ([...pluginList.values()].includes(packageName)) {
|
if ([...pluginList.values()].includes(packageName)) {
|
||||||
continue; // This npm module is already in the plugin list
|
continue; // This npm module is already in the plugin list
|
||||||
}
|
}
|
||||||
// Find the package in node_modules and read the package.json
|
// Find the package in node_modules and read the package.json to check if it's a clusterio-plugin
|
||||||
const packageJsonPath = path.resolve("node_modules", packageName, "package.json");
|
if (await checkPackageJson(path.resolve("node_modules", packageName))) {
|
||||||
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
|
|
||||||
const pluginName = getPluginName(path.resolve("node_modules", packageName));
|
const pluginName = getPluginName(path.resolve("node_modules", packageName));
|
||||||
if (pluginList.has(pluginName)) {
|
if (pluginList.has(pluginName)) {
|
||||||
logger.warn(
|
logger.warn(
|
||||||
|
|||||||
Reference in new issue
Block a user