const fs = require('fs'); const path = require('path'); function walkDir(dir, callback) { fs.readdirSync(dir).forEach(f => { let dirPath = path.join(dir, f); let isDirectory = fs.statSync(dirPath).isDirectory(); if (isDirectory) { walkDir(dirPath, callback); } else { callback(dirPath); } }); } const icons = new Set(); walkDir(path.join(__dirname, '../src/app'), (filePath) => { if (filePath.endsWith('.html') || filePath.endsWith('.ts')) { const content = fs.readFileSync(filePath, 'utf8'); // Match name="icon-name" const nameMatches = content.matchAll(/name=["']([a-zA-Z0-9-]+)["']/g); for (const match of nameMatches) { icons.add(match[1]); } // Match [name]="... ? 'icon-a' : 'icon-b'" const ternaryMatches = content.matchAll(/'([a-zA-Z0-9-]+-outline|[a-zA-Z0-9-]+-sharp|[a-zA-Z0-9-]+)'/g); for (const match of ternaryMatches) { icons.add(match[1]); } } }); console.log(JSON.stringify(Array.from(icons).sort(), null, 2));