mirror of
https://github.com/github/awesome-copilot.git
synced 2026-05-27 17:11:44 +00:00
Fix path for Chrome DevTools external plugin (#1784)
* Fixing path on chrome devtools external pluginPath is to the folder in the repo where the plugin structure starts, not where the plugin.json file lives. * Updating validation scripts and guidance to avoid this mistake again
This commit is contained in:
@@ -44,8 +44,8 @@ body:
|
|||||||
id: plugin-path
|
id: plugin-path
|
||||||
attributes:
|
attributes:
|
||||||
label: Plugin path inside the repository
|
label: Plugin path inside the repository
|
||||||
description: Optional if the plugin lives at the repository root.
|
description: Optional if the plugin lives at the repository root. Otherwise, enter the folder where the plugin structure starts, not the plugin.json file.
|
||||||
placeholder: .github/plugins/my-plugin
|
placeholder: plugins/my-plugin
|
||||||
validations:
|
validations:
|
||||||
required: false
|
required: false
|
||||||
- type: input
|
- type: input
|
||||||
|
|||||||
@@ -126,7 +126,6 @@
|
|||||||
"source": {
|
"source": {
|
||||||
"source": "github",
|
"source": "github",
|
||||||
"repo": "ChromeDevTools/chrome-devtools-mcp",
|
"repo": "ChromeDevTools/chrome-devtools-mcp",
|
||||||
"path": ".github/plugin/plugin.json",
|
|
||||||
"ref": "chrome-devtools-mcp-v1.0.1"
|
"ref": "chrome-devtools-mcp-v1.0.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
+1
-1
@@ -221,7 +221,7 @@ For entries committed to `plugins/external.json`, the current marketplace valida
|
|||||||
- `repository` as an HTTPS GitHub URL
|
- `repository` as an HTTPS GitHub URL
|
||||||
- `keywords` as lowercase hyphenated tags
|
- `keywords` as lowercase hyphenated tags
|
||||||
- `source.source: "github"` plus `source.repo` in `owner/repo` format
|
- `source.source: "github"` plus `source.repo` in `owner/repo` format
|
||||||
- optional `source.path` values to stay relative to the repository root
|
- optional `source.path` values of `/` for repository root, or a repository-relative folder where the plugin structure starts (do not point to `plugin.json` directly)
|
||||||
|
|
||||||
The public-submission policy builds on those rules and also requires `license` plus an immutable `source.ref`.
|
The public-submission policy builds on those rules and also requires `license` plus an immutable `source.ref`.
|
||||||
|
|
||||||
|
|||||||
@@ -23,6 +23,12 @@ export const EXTERNAL_PLUGIN_POLICIES = Object.freeze({
|
|||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const EXTERNAL_PLUGIN_ROOT_MANIFEST_PATHS = Object.freeze([
|
||||||
|
"plugin.json",
|
||||||
|
".github/plugin/plugin.json",
|
||||||
|
".plugin/plugin.json",
|
||||||
|
]);
|
||||||
|
|
||||||
function resolvePolicy(policy) {
|
function resolvePolicy(policy) {
|
||||||
if (!policy) {
|
if (!policy) {
|
||||||
return EXTERNAL_PLUGIN_POLICIES.marketplace;
|
return EXTERNAL_PLUGIN_POLICIES.marketplace;
|
||||||
@@ -203,12 +209,20 @@ function validateHomepage(homepage, prefix, errors) {
|
|||||||
validateHttpsUrl(homepage, "homepage", prefix, errors);
|
validateHttpsUrl(homepage, "homepage", prefix, errors);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function formatExpectedPluginRootMessage() {
|
||||||
|
return EXTERNAL_PLUGIN_ROOT_MANIFEST_PATHS.map((manifestPath) => `"${manifestPath}"`).join(", ");
|
||||||
|
}
|
||||||
|
|
||||||
function validateRelativePath(pathValue, prefix, errors) {
|
function validateRelativePath(pathValue, prefix, errors) {
|
||||||
if (!isNonEmptyString(pathValue)) {
|
if (!isNonEmptyString(pathValue)) {
|
||||||
errors.push(`${prefix}: "source.path" must be a non-empty string when provided`);
|
errors.push(`${prefix}: "source.path" must be a non-empty string when provided`);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (pathValue === "/") {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const normalized = path.posix.normalize(pathValue);
|
const normalized = path.posix.normalize(pathValue);
|
||||||
const segments = pathValue.split("/");
|
const segments = pathValue.split("/");
|
||||||
|
|
||||||
@@ -219,6 +233,16 @@ function validateRelativePath(pathValue, prefix, errors) {
|
|||||||
if (pathValue.includes("\\")) {
|
if (pathValue.includes("\\")) {
|
||||||
errors.push(`${prefix}: "source.path" must use forward slashes`);
|
errors.push(`${prefix}: "source.path" must use forward slashes`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (normalized === ".") {
|
||||||
|
errors.push(`${prefix}: "source.path" must be "/" for the repository root or a plugin root directory relative to the repository root`);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (path.posix.basename(normalized) === "plugin.json") {
|
||||||
|
errors.push(
|
||||||
|
`${prefix}: "source.path" must point to the plugin root directory, not the manifest file; relative to "source.path", expected one of ${formatExpectedPluginRootMessage()}`
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function validateImmutableRef(ref, prefix, errors) {
|
function validateImmutableRef(ref, prefix, errors) {
|
||||||
|
|||||||
+3
-22
@@ -73,7 +73,6 @@
|
|||||||
"source": {
|
"source": {
|
||||||
"source": "github",
|
"source": "github",
|
||||||
"repo": "ChromeDevTools/chrome-devtools-mcp",
|
"repo": "ChromeDevTools/chrome-devtools-mcp",
|
||||||
"path": ".github/plugin/plugin.json",
|
|
||||||
"ref": "chrome-devtools-mcp-v1.0.1"
|
"ref": "chrome-devtools-mcp-v1.0.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -194,13 +193,7 @@
|
|||||||
"url": "https://www.figma.com"
|
"url": "https://www.figma.com"
|
||||||
},
|
},
|
||||||
"homepage": "https://github.com/figma/mcp-server-guide",
|
"homepage": "https://github.com/figma/mcp-server-guide",
|
||||||
"keywords": [
|
"keywords": ["figma", "design", "mcp", "ui", "code-connect"],
|
||||||
"figma",
|
|
||||||
"design",
|
|
||||||
"mcp",
|
|
||||||
"ui",
|
|
||||||
"code-connect"
|
|
||||||
],
|
|
||||||
"repository": "https://github.com/figma/mcp-server-guide",
|
"repository": "https://github.com/figma/mcp-server-guide",
|
||||||
"source": {
|
"source": {
|
||||||
"source": "github",
|
"source": "github",
|
||||||
@@ -272,14 +265,7 @@
|
|||||||
"url": "https://www.microsoft.com"
|
"url": "https://www.microsoft.com"
|
||||||
},
|
},
|
||||||
"homepage": "https://github.com/microsoft/Build-CLI",
|
"homepage": "https://github.com/microsoft/Build-CLI",
|
||||||
"keywords": [
|
"keywords": ["microsoft", "build", "ignite", "events", "sessions", "learn"],
|
||||||
"microsoft",
|
|
||||||
"build",
|
|
||||||
"ignite",
|
|
||||||
"events",
|
|
||||||
"sessions",
|
|
||||||
"learn"
|
|
||||||
],
|
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"repository": "https://github.com/microsoft/Build-CLI",
|
"repository": "https://github.com/microsoft/Build-CLI",
|
||||||
"source": {
|
"source": {
|
||||||
@@ -296,12 +282,7 @@
|
|||||||
"url": "https://www.microsoft.com"
|
"url": "https://www.microsoft.com"
|
||||||
},
|
},
|
||||||
"homepage": "https://github.com/dotnet/modernize-dotnet",
|
"homepage": "https://github.com/dotnet/modernize-dotnet",
|
||||||
"keywords": [
|
"keywords": ["modernization", "upgrade", "migration", "dotnet"],
|
||||||
"modernization",
|
|
||||||
"upgrade",
|
|
||||||
"migration",
|
|
||||||
"dotnet"
|
|
||||||
],
|
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"repository": "https://github.com/dotnet/modernize-dotnet",
|
"repository": "https://github.com/dotnet/modernize-dotnet",
|
||||||
"source": {
|
"source": {
|
||||||
|
|||||||
@@ -1055,7 +1055,7 @@ async function openPluginModal(
|
|||||||
function getExternalPluginUrl(plugin: Plugin): string {
|
function getExternalPluginUrl(plugin: Plugin): string {
|
||||||
if (plugin.source?.source === "github" && plugin.source.repo) {
|
if (plugin.source?.source === "github" && plugin.source.repo) {
|
||||||
const base = `https://github.com/${plugin.source.repo}`;
|
const base = `https://github.com/${plugin.source.repo}`;
|
||||||
return plugin.source.path
|
return plugin.source.path && plugin.source.path !== "/"
|
||||||
? `${base}/tree/main/${plugin.source.path}`
|
? `${base}/tree/main/${plugin.source.path}`
|
||||||
: base;
|
: base;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ export function sortPlugins<T extends RenderablePlugin>(
|
|||||||
function getExternalPluginUrl(plugin: RenderablePlugin): string {
|
function getExternalPluginUrl(plugin: RenderablePlugin): string {
|
||||||
if (plugin.source?.source === 'github' && plugin.source.repo) {
|
if (plugin.source?.source === 'github' && plugin.source.repo) {
|
||||||
const base = `https://github.com/${plugin.source.repo}`;
|
const base = `https://github.com/${plugin.source.repo}`;
|
||||||
return plugin.source.path ? `${base}/tree/main/${plugin.source.path}` : base;
|
return plugin.source.path && plugin.source.path !== '/' ? `${base}/tree/main/${plugin.source.path}` : base;
|
||||||
}
|
}
|
||||||
|
|
||||||
return sanitizeUrl(plugin.repository || plugin.homepage);
|
return sanitizeUrl(plugin.repository || plugin.homepage);
|
||||||
|
|||||||
Reference in New Issue
Block a user