mirror of
https://github.com/github/awesome-copilot.git
synced 2026-02-24 04:15:14 +00:00
fix: update plugin source paths in marketplace.json generation
This commit is contained in:
@@ -14,12 +14,12 @@ const MARKETPLACE_FILE = path.join(ROOT_FOLDER, ".github/plugin", "marketplace.j
|
||||
*/
|
||||
function readPluginMetadata(pluginDir) {
|
||||
const pluginJsonPath = path.join(pluginDir, ".github/plugin", "plugin.json");
|
||||
|
||||
|
||||
if (!fs.existsSync(pluginJsonPath)) {
|
||||
console.warn(`Warning: No plugin.json found for ${path.basename(pluginDir)}`);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
const content = fs.readFileSync(pluginJsonPath, "utf8");
|
||||
return JSON.parse(content);
|
||||
@@ -34,30 +34,30 @@ function readPluginMetadata(pluginDir) {
|
||||
*/
|
||||
function generateMarketplace() {
|
||||
console.log("Generating marketplace.json...");
|
||||
|
||||
|
||||
if (!fs.existsSync(PLUGINS_DIR)) {
|
||||
console.error(`Error: Plugins directory not found at ${PLUGINS_DIR}`);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
|
||||
// Read all plugin directories
|
||||
const pluginDirs = fs.readdirSync(PLUGINS_DIR, { withFileTypes: true })
|
||||
.filter(entry => entry.isDirectory())
|
||||
.map(entry => entry.name)
|
||||
.sort();
|
||||
|
||||
|
||||
console.log(`Found ${pluginDirs.length} plugin directories`);
|
||||
|
||||
|
||||
// Read metadata for each plugin
|
||||
const plugins = [];
|
||||
for (const dirName of pluginDirs) {
|
||||
const pluginPath = path.join(PLUGINS_DIR, dirName);
|
||||
const metadata = readPluginMetadata(pluginPath);
|
||||
|
||||
|
||||
if (metadata) {
|
||||
plugins.push({
|
||||
name: metadata.name,
|
||||
source: `./plugins/${dirName}`,
|
||||
source: dirName,
|
||||
description: metadata.description,
|
||||
version: metadata.version || "1.0.0"
|
||||
});
|
||||
@@ -66,7 +66,7 @@ function generateMarketplace() {
|
||||
console.log(`✗ Skipped: ${dirName} (no valid plugin.json)`);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Create marketplace.json structure
|
||||
const marketplace = {
|
||||
name: "awesome-copilot",
|
||||
@@ -81,16 +81,16 @@ function generateMarketplace() {
|
||||
},
|
||||
plugins: plugins
|
||||
};
|
||||
|
||||
|
||||
// Ensure directory exists
|
||||
const marketplaceDir = path.dirname(MARKETPLACE_FILE);
|
||||
if (!fs.existsSync(marketplaceDir)) {
|
||||
fs.mkdirSync(marketplaceDir, { recursive: true });
|
||||
}
|
||||
|
||||
|
||||
// Write marketplace.json
|
||||
fs.writeFileSync(MARKETPLACE_FILE, JSON.stringify(marketplace, null, 2) + "\n");
|
||||
|
||||
|
||||
console.log(`\n✓ Successfully generated marketplace.json with ${plugins.length} plugins`);
|
||||
console.log(` Location: ${MARKETPLACE_FILE}`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user