vite-react-library-starter
v1.1.3
Published
Boilerplate for creating React component libraries, bundled with vite js to ESM and/or CJS Modules, Storybook, Typescript
Readme
Vite React Library Starter
About
Vite React Library Starter is a boilerplate for building and publishing React component libraries. It leverages modern tooling, including Vite for bundling, TypeScript for type safety, Tailwind CSS for styling, and Storybook for documentation. This starter kit provides a streamlined development experience with built-in linting, formatting, and unit testing.
Features
- Vite - Fast bundling and development
- React & TypeScript - Strict type safety for better development
- Tailwind CSS - Utility-first styling approach
- Tailwind Merge & CVA - Class name manipulation
- CLSX - Conditional class name handling
- ESLint & Prettier - Code linting and formatting
- Vitest & React Testing Library - Unit testing setup
- Storybook - Interactive documentation for components
Getting Started
Installation
Clone the repository and install dependencies:
git clone https://github.com/your-repo/vite-react-library-starter.git
cd vite-react-library-starter
npm installRunning Storybook
To start Storybook for interactive component documentation:
npm run storybookBuilding the Library
Build the component library for distribution:
npm run buildRunning Tests
Run unit tests with Vitest:
npm testTo watch tests:
npm run test:watchLinting & Formatting
Lint and format code using ESLint and Prettier:
npm run lint
npm run formatCleaning the Project
To remove generated files:
npm run cleanFolder Structure
├── src/ # Component source code
│ ├── components/ # React components
│ ├── hooks/ # Custom hooks (if any)
│ ├── utils/ # Utility functions
│ ├── index.ts # Library entry point
├── .storybook/ # Storybook configuration
├── tests/ # Unit tests
├── dist/ # Compiled library output
├── package.json # Project metadata and scripts
└── README.md # DocumentationPublishing to NPM
Ensure the package is built before publishing:
npm run build
npm publishLicense
This project is licensed under the MIT License.
