mirror of
https://github.com/github/awesome-copilot.git
synced 2026-02-20 18:35:14 +00:00
Refactor plugin detection for better clarity
Split plugin detection into separate checks for plugin directories and plugin.json files to improve code readability and maintainability. Co-authored-by: aaronpowell <434140+aaronpowell@users.noreply.github.com>
This commit is contained in:
@@ -233,9 +233,10 @@ export function getResourceType(filePath: string): string {
|
||||
return "skill";
|
||||
if (/(^|\/)hooks\//.test(filePath) && filePath.endsWith("README.md"))
|
||||
return "hook";
|
||||
// Check for plugin directories (e.g., plugins/<id>) or plugin.json files
|
||||
if (/(^|\/)plugins\/[^/]+\/?$/.test(filePath) || filePath.endsWith("/.github/plugin/plugin.json"))
|
||||
return "plugin";
|
||||
// Check for plugin directories (e.g., plugins/<id>, plugins/<id>/)
|
||||
if (/(^|\/)plugins\/[^/]+\/?$/.test(filePath)) return "plugin";
|
||||
// Check for plugin.json files (e.g., plugins/<id>/.github/plugin/plugin.json)
|
||||
if (filePath.endsWith("/.github/plugin/plugin.json")) return "plugin";
|
||||
return "unknown";
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user