Files

15 lines
579 B
TypeScript
Raw Permalink Normal View History

import { writeFile } from '@lucide/helpers';
2026-07-31 09:11:20 +02:00
import { type SVGFile } from './readSvgs.mts';
2026-07-31 09:11:20 +02:00
export default async function generateIconNodes(parsedSvgs: SVGFile[], packageDir: string) {
const iconNodes = parsedSvgs.reduce((acc, { name, parsedSvg }) => {
acc[name] = parsedSvg.children.map(({ name, attributes }) => [name, attributes]);
return acc;
2026-07-31 09:11:20 +02:00
}, {} as Record<string, [string, Record<string, unknown> | undefined][]>);
const iconNodesStringified = JSON.stringify(iconNodes, null, 2);
await writeFile(iconNodesStringified, 'icon-nodes.json', packageDir);
}