Create your own customizable SVG-based React icon package with create-react-icon-package
. This package allows you to easily generate a custom SVG-based React icon package tailored to your needs, streamlining the process of creating, organizing, and distributing your own icon set for use in your React applications.
- Prerequisites
- Installation
- Usage
- Customizing Your Icon Set
- Semantic Versioning and Publishing with GitHub Actions
- Setting up NPM_TOKEN and GITHUB_TOKEN
- Using Semantic Release for Automatic Versioning and Publishing
- Contributing
Before using this package, ensure you have:
- A basic understanding of React
- Familiarity with npm and SVG icons
- Node.js and npm installed on your system
To use create-react-icon-package
as a template for your own React icon package, clone this GitHub repository to your local machine:
git clone https://github.com/halilatilla/create-react-icon-package.git my-icon-package
This command will create a new folder called my-icon-package with the necessary files and configurations.
After cloning the repository, follow these steps to set up and customize your React icon package:
Navigate to the newly created folder:
cd my-icon-package
Install the dependencies:
npm install
Now you can start customizing your React icon package.
Inside the my-icon-package
folder, you'll find a folder named icons
. Place your SVG icons within this folder, then run the following command to build your React icon components:
npm run build
This command will generate React components for each SVG file within the icons
folder and compile them into the dist
directory.
The generated React icon package is configured to use Semantic Release and GitHub Actions for automatic versioning and publishing to npm. To set this up, follow these steps:
- Push your icon package to a new GitHub repository.
- Create an npm account and obtain an npm access token.
- Add the
NPM_TOKEN
andGITHUB_TOKEN
as secrets to your GitHub repository.
- Log in to your npm account and navigate to the access tokens page.
- Create a new token with "Read and Publish" permissions.
- In your GitHub repository, navigate to the "Settings" tab and then to "Secrets".
- Add the
NPM_TOKEN
secret using the token you generated from npm. - The
GITHUB_TOKEN
is automatically generated by GitHub, and you don't need to set it up manually.
With GitHub Actions, the GITHUB_TOKEN
and NPM_TOKEN
environment variables are set up to automatically version and publish your project to npm. As a result, each push to the "main" branch will initiate the process of versioning and publishing your package to npm.
If you would like to contribute to the create-react-icon-package
project, feel free to submit issues and pull requests on the GitHub repository.
MIT License. See the LICENSE file for more information.