mirror of
https://github.com/simonwep/ocular.git
synced 2026-02-20 00:14:59 +08:00
10 lines
422 B
JavaScript
10 lines
422 B
JavaScript
import { readdir, writeFile } from 'fs/promises';
|
|
import { resolve } from 'path';
|
|
|
|
(async () => {
|
|
const icons = resolve(process.cwd(), 'src/icons');
|
|
const types = resolve(process.cwd(), 'src/app/components/base/icon/Icon.types.ts');
|
|
const names = (await readdir(icons)).map((v) => v.replace(/\.\w+/, ''));
|
|
await writeFile(types, `export type AppIcon =\n | ${names.map((v) => `'${v}'`).join('\n | ')};\n`);
|
|
})();
|