Contributing
git clone https://github.com/mohammadreza-zr/react-svg-icons.gitcd react-svg-iconsnpm installnpm test # builds, then runs every testLayout
Section titled “Layout”src/ index.ts public exports: generate, write, compare and the config helpers cli.ts the react-svg-icons command: argument parsing, --check, exit codes config.ts the config type, defaults, resolveConfig, findConfig, loadConfig build.ts reads the folder tree, builds every file, formats, compare and write component.ts one SVG to one component: SVGO, root attributes, the template jsx.ts the SVG tree to JSX: colour slots, opacity, attributes color.ts colour parsing and the numbering of the slots names.ts component, file and folder names registry.ts the registry and the Icon component templates format.ts prettier, the project's own first header.ts the banner that marks a generated fileexamples/ basic/ real SVGs, a config and the committed outputtest/ build.test.mjs the generator, with real files, the real TypeScript compiler and real React config.test.mjs the config files and the CLI docs.test.mjs checks the docs against the real fileswiki/ these pages-
No project names in
src/. A word to drop from names belongs in the user’s config. -
The output must not change by accident. The committed files in
examples/basic/generatedmust equal what the tool writes. After a deliberate change, regenerate them:Terminal window npm run buildcd examples/basic && node ../../dist/cli.js -
Tests use real files. No mocks, stubs or fake timers. The generated code is type-checked with the real compiler against
@types/react, bundled with esbuild and rendered withreact-dom/server. -
Docs are checked. A code block directly under
<!-- verbatim: path -->must consist of lines of that file, in order, and every wiki link written in double square brackets must point at a page.npm testfails when they do not. -
A change to behaviour needs the wiki and
CHANGELOG.mdupdated.
Releasing
Section titled “Releasing”- Update
CHANGELOG.md. npm version patch(orminor,major) andgit push --follow-tags.- The
releaseworkflow checks that the tag equals the version inpackage.json, runs the typecheck and the tests on Node 20, 22 and 24, checks the type resolution, publishes to npm with provenance (trusted publishing, no token) and creates the GitHub release.
Trusted publishing is set up once on npmjs.com for the package: Settings → Trusted Publisher → GitHub Actions, user mohammadreza-zr, repository react-svg-icons, workflow release.yml, and the direct npm publish allowed.
The wiki
Section titled “The wiki”wiki/ is the source. Publish it to the GitHub Wiki with:
npm run docs:syncGitHub creates the wiki repository only once a first page exists. Enable it in the repository settings (Features → Wikis) and create any page in the browser, then run the command; it replaces the pages.