import { MAP, KEEP_MDI } from './icon-map.mjs'; import fs from 'node:fs'; import path from 'node:path'; import { fileURLToPath } from 'node:url'; const ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..'); const lucide = JSON.parse( fs.readFileSync(path.join(ROOT, 'node_modules/@iconify-json/lucide/icons.json'), 'utf8'), ); const has = (n) => Boolean(lucide.icons[n] || (lucide.aliases && lucide.aliases[n])); const all = fs .readFileSync(process.env.TMPDIR + '/mdi_all.txt', 'utf8') .trim() .split('\n') .map((s) => s.replace('mdi:', '')); const cms = ['cloud', 'email', 'facebook', 'map', 'video', 'whatsapp', 'youtube']; const set = [...new Set([...all, ...cms])].sort(); const bad = []; const unmapped = []; for (const m of set) { if (KEEP_MDI.has(m)) continue; const l = MAP[m]; if (l === undefined) { unmapped.push(m); continue; } if (has(l) === false) bad.push(`${m} -> lucide:${l}`); } console.log('total mdi:', set.length, '| keep-mdi:', [...KEEP_MDI].filter((k) => set.includes(k)).length); console.log('UNMAPPED:', unmapped.length ? unmapped.join(', ') : 'none'); console.log('INVALID lucide names:', bad.length ? '\n ' + bad.join('\n ') : 'none');