A robust TypeScript library boilerplate built with Vite, featuring comprehensive development tooling and automated workflows.
To use this template or setup make sure to do some house cleaning first, update the following files with the right info:
- package.json -- the github links, package name etc.
- License file -- to whatever type of license you want.
- Readme file -- yes this very one you reading, correct instructions as per your lib
- index.html file if any, perhaps the head part and meta tags!
Note: don't touch the scripts section unless you really should.
- 🏗️ Built with Vite & TypeScript - Modern build tooling with type safety
- 🧪 Testing - Configured with Vitest for unit testing and coverage reports
- 📦 Size Limits - Enforced bundle size limits with
size-limit
- 🔄 Automated Versioning - Using
changesets
for version management - 🎨 Code Quality
- ESLint for code linting
- Prettier for consistent code formatting
- TypeScript strict mode enabled
- ✅ Quality Checks
- Export validation with
@arethetypeswrong/cli
- Automated CI/CD with GitHub Actions
- Pre-commit and version hooks
- Export validation with
- 📊 Bundle Analysis - Size analysis with detailed reports
npm install vite-setup
# or
yarn add vite-setup
# or
pnpm add vite-setup
import { yourFunction } from 'vite-setup';
// Your usage example here
Script | Description |
---|---|
pnpm build |
Build the library |
pnpm test |
Run tests |
pnpm test:watch |
Run tests in watch mode |
pnpm test:coverage |
Generate test coverage report |
pnpm type-check |
Run TypeScript type checking |
pnpm lint |
Lint the codebase |
pnpm format |
Format code with Prettier |
pnpm size |
Check bundle size |
pnpm size:analyze |
Analyze bundle size in detail |
pnpm check-exports |
Validate package exports |
pnpm ci |
Run all CI checks |
-
Make your changes
-
Run quality checks:
pnpm type-check pnpm lint pnpm test
-
Create a changeset (for version management):
pnpm changeset
-
Commit changes and push
Current limits are set to:
- ES Module: 10kb
- UMD Bundle: 10kb
Configure limits in package.json
under size-limit
section.
- Node.js >=18
- pnpm 8.0.0 or higher
- Fork the repository
- Create your feature branch:
git checkout -b feature/new-feature
- Commit your changes:
git commit -am 'Add new feature'
- Push to the branch:
git push origin feature/new-feature
- Submit a pull request
Before each release, the following checks are automatically run:
- TypeScript type checking
- ESLint validation
- Unit tests
- Export validation
- Bundle size checks
MIT License - see the LICENSE file for details
- Issues: GitHub Issues
- Discussions: GitHub Discussions
This template includes configurations and tooling inspired by modern JavaScript library development best practices.
Built with ❤️ using Vite, TypeScript And A Bunch Of Cool Lovely Little Tools. Looking to improve? PRs and suggestions are welcome!