chore: publish from main

This commit is contained in:
github-actions[bot]
2026-07-29 04:05:59 +00:00
parent b03284e90e
commit 8fd72adebe
4 changed files with 560 additions and 34 deletions
@@ -100,6 +100,90 @@ test("runCanvasStructureGate fails when extension entrypoint path is a directory
assert.match(result.output, /"extensions\/extension\.mjs" must be a file/);
});
test("runCanvasStructureGate passes when extension lives in a nested subfolder", () => {
const repoDir = createTempRepo();
fs.mkdirSync(path.join(repoDir, "extensions", "modernize-dashboard"), { recursive: true });
fs.writeFileSync(
path.join(repoDir, "extensions", "modernize-dashboard", "extension.mjs"),
"export default {};\n",
);
const sha = commitAll(repoDir, "Add nested canvas extension");
const plugin = {
name: "canvas-plugin",
keywords: ["canvas"],
source: {
source: "github",
repo: "owner/repo",
sha,
},
};
const result = runCanvasStructureGate(repoDir, plugin, sha);
assert.equal(result.status, "pass");
assert.match(result.output, /entry point "extensions\/modernize-dashboard\/extension\.mjs"/);
});
test("runCanvasStructureGate fails when no extension.mjs exists flat or nested", () => {
const repoDir = createTempRepo();
fs.mkdirSync(path.join(repoDir, "extensions", "modernize-dashboard"), { recursive: true });
fs.writeFileSync(
path.join(repoDir, "extensions", "modernize-dashboard", "index.mjs"),
"export default {};\n",
);
const sha = commitAll(repoDir, "Add extensions directory without entry point");
const plugin = {
name: "canvas-plugin",
keywords: ["canvas"],
source: {
source: "github",
repo: "owner/repo",
sha,
},
};
const result = runCanvasStructureGate(repoDir, plugin, sha);
assert.equal(result.status, "fail");
assert.match(result.output, /missing required canvas extension entry point/);
});
test("runCanvasStructureGate finds a nested extension listed past the legacy output cap", () => {
const repoDir = createTempRepo();
// Many sibling directories push the real extension past the ~12 KB stdout cap that the
// previous truncating implementation applied, which would silently drop it from the listing.
// Long names inflate each git ls-tree record so fewer directories are needed to exceed the cap.
for (let index = 0; index < 160; index += 1) {
const filler = path.join(
repoDir,
"extensions",
`filler-directory-that-pads-the-tree-listing-${String(index).padStart(4, "0")}`,
);
fs.mkdirSync(filler, { recursive: true });
fs.writeFileSync(path.join(filler, "readme.txt"), "filler\n");
}
fs.mkdirSync(path.join(repoDir, "extensions", "zzz-real-extension"), { recursive: true });
fs.writeFileSync(
path.join(repoDir, "extensions", "zzz-real-extension", "extension.mjs"),
"export default {};\n",
);
const sha = commitAll(repoDir, "Add nested extension after many siblings");
const plugin = {
name: "canvas-plugin",
keywords: ["canvas"],
source: {
source: "github",
repo: "owner/repo",
sha,
},
};
const result = runCanvasStructureGate(repoDir, plugin, sha);
assert.equal(result.status, "pass");
assert.match(result.output, /entry point "extensions\/zzz-real-extension\/extension\.mjs"/);
});
// Regression tests for issue #2397: a tag-name locator (e.g. "v1.0.0") must be
// readable by the version-match and canvas-structure gates. `git fetch origin <tag>`
// only updates FETCH_HEAD and never creates a local `refs/tags/<tag>`, so reading via