mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-22 16:13:12 +09:00
Only log not-a-plugin for non-core packages
This commit is contained in:
1 parent
5586b1640b
commit
f95e1d2998
1 file changed
+13
-7
@@ -78,22 +78,28 @@ async function findNpmPlugins(pluginList: Map<string, string>, pluginListPath: s
|
|||||||
}
|
}
|
||||||
|
|
||||||
let changed = 0;
|
let changed = 0;
|
||||||
for (const [pluginName, pluginVersion] of Object.entries(dependencies)) {
|
for (const [packageName, packageVersion] of Object.entries(dependencies)) {
|
||||||
if (pluginList.has(pluginName)) {
|
if (pluginList.has(packageName)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// Find the package in node_modules and read the package.json
|
// Find the package in node_modules and read the package.json
|
||||||
const packageJsonPath = path.resolve("node_modules", pluginName, "package.json");
|
const packageJsonPath = path.resolve("node_modules", packageName, "package.json");
|
||||||
const packageJson = JSON.parse(await fs.readFile(packageJsonPath, { encoding: "utf8" }));
|
const packageJson = JSON.parse(await fs.readFile(packageJsonPath, { encoding: "utf8" }));
|
||||||
// Check if the package has the "clusterio-plugin" keyword
|
// Check if the package has the "clusterio-plugin" keyword
|
||||||
if (packageJson.keywords?.includes("clusterio-plugin")) {
|
if (packageJson.keywords?.includes("clusterio-plugin")) {
|
||||||
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
||||||
const pluginInfo = require(path.resolve("node_modules", pluginName)).plugin;
|
const pluginInfo = require(path.resolve("node_modules", packageName)).plugin;
|
||||||
pluginList.set(pluginInfo.name, pluginName);
|
pluginList.set(pluginInfo.name, packageName);
|
||||||
logger.info(`Added ${pluginInfo.name} from NPM`);
|
logger.info(`Added ${pluginInfo.name} from NPM`);
|
||||||
changed += 1;
|
changed += 1;
|
||||||
} else {
|
} else if (![
|
||||||
logger.info(`${pluginName}@${pluginVersion} is not a clusterio-plugin`);
|
"@clusterio/controller",
|
||||||
|
"@clusterio/ctl",
|
||||||
|
"@clusterio/host",
|
||||||
|
"@clusterio/lib",
|
||||||
|
"@clusterio/web_ui",
|
||||||
|
].includes(packageName)) {
|
||||||
|
logger.warn(`${packageName}@${packageVersion} is not a clusterio-plugin`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (changed > 0) {
|
if (changed > 0) {
|
||||||
|
|||||||
Reference in new issue
Block a user