// Icon list tooling. // // npm run icons print the work list // npm run icons -- --write write it to ICONS.txt // npm run icons -- --manifest print a theme.json "assets" skeleton (every key -> img/.svg) import { writeFileSync } from 'node:fs'; import { fileURLToPath } from 'node:url'; import { loadContext } from './context.js'; import { assetsSkeleton, renderText } from './icon-keys.js'; export const ICONS_FILE = fileURLToPath(new URL('../ICONS.txt', import.meta.url)); if (process.argv[1] === fileURLToPath(import.meta.url)) { const ctx = loadContext(); const args = process.argv.slice(2); if (args.includes('--write')) { writeFileSync(ICONS_FILE, renderText(ctx)); console.log('ICONS.txt updated'); } else if (args.includes('--manifest')) { console.log(JSON.stringify({ assets: assetsSkeleton(ctx) }, null, 2)); } else { process.stdout.write(renderText(ctx)); } }