diff --git a/.changeset/metal-mugs-join.md b/.changeset/metal-mugs-join.md new file mode 100644 index 00000000000..6c3dccaf4f1 --- /dev/null +++ b/.changeset/metal-mugs-join.md @@ -0,0 +1,5 @@ +--- +"@utrecht/icon": minor +--- + +Add `iconset.mjs` and `iconset.d.mts` files. diff --git a/components/icon/src/build.js b/components/icon/src/build.js index 6f77f0656a9..23574b839b0 100644 --- a/components/icon/src/build.js +++ b/components/icon/src/build.js @@ -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();