mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-14 07:24:52 +09:00
Only report a missing plugin web build when one is expected (#1013)
Plugins with only host, instance or ctl code have no reason to ship a webpack build, yet the plugin list showed "Missing dist/web/manifest.json" as an error for them and the controller logged a warning on every start. Decide whether a build is expected from the plugin declaration, using the same rule the create tool uses to decide when to generate one: a web or controller entrypoint, or any config fields. Plugins outside that rule get no bundle path and no error, the web UI skips loading them, and the plugin pages show them as having no web module instead of an error or a prompt to reload. Fixes #1004 Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
1 parent
9c97eeb597
commit
1a10b38743
9 files changed
+76
-6
No files matched your search
@@ -102,7 +102,7 @@ describe("controller/src/routes", function() {
|
||||
});
|
||||
it("should report missing manifest and entrypoint", async function() {
|
||||
controller.pluginInfos = [
|
||||
{ name: "foo", version: "1.0.0", npmPackage: "foo" },
|
||||
{ name: "foo", version: "1.0.0", npmPackage: "foo", webEntrypoint: "dist/web/index.js" },
|
||||
{ name: "bar", version: "1.0.0", npmPackage: "bar", manifest: {} },
|
||||
{ name: "baz", version: "1.0.0", npmPackage: "baz", manifest: { "baz.js": "remoteEntry.js" } },
|
||||
];
|
||||
@@ -115,6 +115,19 @@ describe("controller/src/routes", function() {
|
||||
assert.equal(data[1].loaded, false);
|
||||
assert.equal(data[1].enabled, false);
|
||||
});
|
||||
it("should not report a missing manifest for plugins without a web build", async function() {
|
||||
controller.pluginInfos = [
|
||||
{ name: "foo", version: "1.0.0", npmPackage: "foo", hostEntrypoint: "dist/node/host.js" },
|
||||
{ name: "bar", version: "1.0.0", npmPackage: "bar", controllerEntrypoint: "dist/node/controller.js" },
|
||||
{ name: "baz", version: "1.0.0", npmPackage: "baz", instanceConfigFields: {} },
|
||||
];
|
||||
let response = await fetch(endpoint);
|
||||
assert.equal(response.status, 200);
|
||||
let data = await response.json();
|
||||
assert.deepEqual(data[0].web, {});
|
||||
assert.equal(data[1].web.error, "Missing dist/web/manifest.json");
|
||||
assert.equal(data[2].web.error, "Missing dist/web/manifest.json");
|
||||
});
|
||||
});
|
||||
describe("/api/cluster-name", function() {
|
||||
let endpoint;
|
||||
|
||||
Reference in new issue
Block a user