All checks were successful
Deploy production / deploy (push) Successful in 1m7s
17 lines
773 B
TypeScript
17 lines
773 B
TypeScript
// Trims the simple-icons marks used by src/lib/link-icons.ts into src/lib/link-icons.json,
|
|
// so /start ships a few KB of SVG paths instead of the whole icon set. Run after editing RULES.
|
|
import { writeFileSync } from 'node:fs';
|
|
import all from '@iconify-json/simple-icons/icons.json' with { type: 'json' };
|
|
import { RULES } from '../src/lib/link-icons.ts';
|
|
|
|
const icons = (all as { icons: Record<string, { body: string }> }).icons;
|
|
const out: Record<string, string> = {};
|
|
for (const r of RULES) {
|
|
if (!r.si) continue;
|
|
const icon = icons[r.si];
|
|
if (!icon) throw new Error(`simple-icons has no "${r.si}"`);
|
|
out[r.si] = icon.body;
|
|
}
|
|
writeFileSync('src/lib/link-icons.json', JSON.stringify(out, null, '\t') + '\n');
|
|
console.log(`wrote ${Object.keys(out).length} marks`);
|