Skip to content

Commit

Permalink
feat: add iconset.mjs and iconset.d.mts files
Browse files Browse the repository at this point in the history
  • Loading branch information
Robbert committed Nov 26, 2024
1 parent 67ed0e8 commit a63d0ef
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/metal-mugs-join.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@utrecht/icon": minor
---

Add `iconset.mjs` and `iconset.d.mts` files.
17 changes: 16 additions & 1 deletion components/icon/src/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,22 @@ writeComponentFile();
const generateIconsNameFile = async () => {
const data = await getIconData();
await mkdir('dist', { recursive: true });
await writeFile(path.resolve(process.cwd(), 'dist/index.json'), generateIconsName(data), 'utf-8');
const json = generateIconsName(data);
await writeFile(path.resolve(process.cwd(), 'dist/index.json'), json, 'utf-8');
await writeFile(path.resolve(process.cwd(), 'dist/iconset.mjs'), `export default ${json};\n`, 'utf-8');
await writeFile(
path.resolve(process.cwd(), 'dist/iconset.d.mts'),
`export default iconset;
declare interface Icon {
id: string;
src: string;
unicodeBidi?: boolean;
}
declare const iconset: Icon[];\n`,
'utf-8',
);
};
generateIconsNameFile();

Expand Down

0 comments on commit a63d0ef

Please sign in to comment.