import * as fs from 'node:fs/promises' console.info('Reading icons from "./src/assets/icons.svg"...') const icons = await fs.readFile('./src/assets/icons.svg', { encoding: 'utf-8' }) const iconNames = icons.match(/(?<=^ {4} ` | '${name}'`).join('\n')} export { iconNames } const iconNamesSet = new Set(iconNames) export function isIconName(value: string): value is Icon { return iconNamesSet.has(value) } `, ) console.info('Done.')