Skip to content

Commit

Permalink
fix generate icons script (#159)
Browse files Browse the repository at this point in the history
- it was duplicating AvailableIcons, making the export AvailableIcons fail because it was trying to export itself. Now it filters the AvailableIcons to avoid exporting itself
  • Loading branch information
caroluchoa authored Mar 13, 2024
1 parent d3dc61a commit d022fd9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions static/generate-icons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ async function generateIconsFile() {
// Remove the existing AvailableIcons constant from the content
existingContent = existingContent.replace(/export const AvailableIcons = { [^}]* };/g, '');
// Adds all existing icons plus the new ones to the AvailableIcons constant
const allIcons = [...existingIcons, ...newIcons];
const availableIconsString = `export const AvailableIcons = { ${allIcons.join(', ')} };`;
const allIconsFiltered = [...existingIcons, ...newIcons].filter(icon => icon !== "AvailableIcons");
const availableIconsString = `export const AvailableIcons = { ${allIconsFiltered.join(', ')} };`;
existingContent += `\n${availableIconsString}`;

await Deno.writeTextFile(outputFilePath, existingContent, { create: true });
Expand Down

0 comments on commit d022fd9

Please sign in to comment.