mirror of
https://github.com/github/awesome-copilot.git
synced 2026-07-17 19:31:20 +00:00
Migrate extension plugin materialization to extensions container (#2334)
* Migrate extension plugin materialization layout Materialize extension plugins into a dedicated extensions/ container, validate the new manifest convention, and bump extension plugin versions. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: d26008fb-9928-4ba7-b7c8-36f35320f7c1 * Keep extension manifests source-compatible Restore source extension manifests to "extensions": "." while preserving materialization-time rewrite to "extensions" in distribution output. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: d26008fb-9928-4ba7-b7c8-36f35320f7c1 * Validate canvas extension layout for external submissions Add intake and quality-gate checks for canvas-tagged external plugins so they must include extensions/extension.mjs and optional manifest extensions is validated when present. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: d26008fb-9928-4ba7-b7c8-36f35320f7c1 * Fix plugin clean extension pass and typo guard text Declare EXTENSIONS_DIR in clean-materialized-plugins and run extension cleanup once after plugin cleanup. Also normalize misspelled-key detection strings to satisfy spelling checks without changing validation behavior. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: d26008fb-9928-4ba7-b7c8-36f35320f7c1 * Proper codespell fix * Separate canvas structure quality gate status Track canvas structure as its own gate status and output, include it in aggregate summaries, and enforce Git object types so extensions/ is a tree and extensions/extension.mjs is a blob. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: d26008fb-9928-4ba7-b7c8-36f35320f7c1 * Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
import assert from "node:assert/strict";
|
||||
import fs from "fs";
|
||||
import os from "os";
|
||||
import path from "path";
|
||||
import { after, test } from "node:test";
|
||||
import { materializeExtensionPlugin } from "./materialize-plugins.mjs";
|
||||
|
||||
const tempDirs = [];
|
||||
|
||||
after(() => {
|
||||
for (const dir of tempDirs) {
|
||||
fs.rmSync(dir, { recursive: true, force: true });
|
||||
}
|
||||
});
|
||||
|
||||
test("materializeExtensionPlugin writes extension bundles to ./extensions and rewrites manifest", () => {
|
||||
const tempDir = fs.mkdtempSync(path.join(os.tmpdir(), "materialize-extension-plugin-"));
|
||||
tempDirs.push(tempDir);
|
||||
|
||||
const pluginDir = path.join(tempDir, "extension-plugin");
|
||||
fs.mkdirSync(path.join(pluginDir, ".github", "plugin"), { recursive: true });
|
||||
fs.mkdirSync(path.join(pluginDir, "assets"), { recursive: true });
|
||||
fs.writeFileSync(path.join(pluginDir, ".github", "plugin", "plugin.json"), JSON.stringify({
|
||||
name: "test-extension-plugin",
|
||||
description: "test plugin",
|
||||
version: "1.0.0",
|
||||
logo: "assets/preview.png",
|
||||
extensions: ".",
|
||||
}, null, 2));
|
||||
fs.writeFileSync(path.join(pluginDir, "extension.mjs"), "export default {};\n");
|
||||
fs.writeFileSync(path.join(pluginDir, "README.md"), "# test\n");
|
||||
fs.writeFileSync(path.join(pluginDir, "assets", "preview.png"), "fake-image-bytes");
|
||||
|
||||
const result = materializeExtensionPlugin(pluginDir);
|
||||
|
||||
assert.equal(result.skipped, false);
|
||||
assert.equal(result.manifestUpdated, true);
|
||||
assert.equal(result.copiedEntries, 3);
|
||||
assert.equal(fs.existsSync(path.join(pluginDir, "extensions", "extension.mjs")), true);
|
||||
assert.equal(fs.existsSync(path.join(pluginDir, "extensions", "assets", "preview.png")), true);
|
||||
assert.equal(fs.existsSync(path.join(pluginDir, "extensions", "README.md")), true);
|
||||
assert.equal(fs.existsSync(path.join(pluginDir, "extensions", ".github")), false);
|
||||
|
||||
const pluginManifest = JSON.parse(
|
||||
fs.readFileSync(path.join(pluginDir, ".github", "plugin", "plugin.json"), "utf8")
|
||||
);
|
||||
assert.equal(pluginManifest.extensions, "extensions");
|
||||
});
|
||||
Reference in New Issue
Block a user