Skip to content

Commit e4c2d80

Browse files
authored
Update parse-badges.js
1 parent 62c1f6c commit e4c2d80

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

parse-badges.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,17 @@ const fs = require('fs');
33
// Read and parse badges.json
44
const badges = JSON.parse(fs.readFileSync('badges.json', 'utf8'));
55

6-
// Extract plugin names, derived repo, and latest release URLs
7-
const parsedData = badges.plugins.map((plugin) => {
6+
// Extract plugin names, repo (from URL), and latest release URLs
7+
const parsedData = badges.plugins.map(plugin => {
88
const repoMatch = plugin.url.match(/github\.com\/([^/]+\/[^/]+)/);
9-
const repo = repoMatch ? repoMatch[1] : null;
109
return {
1110
name: plugin.name,
12-
repo: repo,
13-
latestReleaseUrl: plugin.latestReleaseUrl,
11+
repo: repoMatch ? repoMatch[1] : null, // Extract repo as owner/repo
12+
latestReleaseUrl: plugin.latestReleaseUrl
1413
};
1514
});
1615

16+
// Save parsed data to parsed-badges.json
1717
fs.writeFileSync('parsed-badges.json', JSON.stringify(parsedData, null, 2));
18+
1819
console.log('Parsed badges.json and saved to parsed-badges.json');

0 commit comments

Comments
 (0)