TypeScript + tooling component library modified to parse source SVGs using svgr and expose them as React components.
In this level, we want to export our existing SVG icons as an icon library. We will be using bare-ts-tooling as a base layer, but can remove everything related to ESLint, as we are only going to deal with SVG source files.
There are different approaches to bundling icons as a library - for example, you can manually create a bundle directly from SVG files by writing a custom parser, or you could directly bundle the SVG files and embed them properly at runtime.
We want to expose clean ES Modules that are nicely tree-shakable, so we are going to convert the SVG icons to React components.
Converting SVG to TSX
As will all other libraries, we want to expose an ES Module with TypeScript declarations alongside it. If we would be creating a vanilla JS library, we could directly convert the SVGs into JS without any JS-TS transpiling.
(--icon is needed to that svgr keeps viewboxes - we're using icons with a base size of 24px here, so we're passing --icon 24 to avoid having svgr override all sizes with 1em)
Adjust the tsup.config.ts to ingest the svgr output: