|
1 |
| -# vite-lib-setup |
| 1 | +# vite-setup |
2 | 2 |
|
3 |
| -Boilerplate setup for scaffolding a new typescript and vite library with must have already setup |
| 3 | +A robust TypeScript library boilerplate built with Vite, featuring comprehensive development tooling and automated workflows. |
4 | 4 |
|
5 |
| -## What's Included |
| 5 | +## How To Use? |
6 | 6 |
|
7 |
| -- vitest |
8 |
| -- changesets |
9 |
| -- size limit |
10 |
| -- prettier |
11 |
| -- version hooks |
12 |
| -- github action for ci and cd |
13 |
| -- check exports |
14 |
| -- eslint |
| 7 | +To use this template or setup make sure to do some house cleaning first, update the following files with the right info: |
15 | 8 |
|
16 |
| -etc... |
| 9 | +- package.json -- the github links, package name etc. |
| 10 | +- License file -- to whatever type of license you want. |
| 11 | +- Readme file -- yes this very one you reading, correct instructions as per your lib |
| 12 | +- index.html file if any, perhaps the head part and meta tags! |
17 | 13 |
|
18 |
| -see scripts section in package json for available commands |
| 14 | +> Note: don't touch the scripts section unless you really should. |
| 15 | +
|
| 16 | +## Features |
| 17 | + |
| 18 | +- 🏗️ **Built with Vite & TypeScript** - Modern build tooling with type safety |
| 19 | +- 🧪 **Testing** - Configured with Vitest for unit testing and coverage reports |
| 20 | +- 📦 **Size Limits** - Enforced bundle size limits with `size-limit` |
| 21 | +- 🔄 **Automated Versioning** - Using `changesets` for version management |
| 22 | +- 🎨 **Code Quality** |
| 23 | + - ESLint for code linting |
| 24 | + - Prettier for consistent code formatting |
| 25 | + - TypeScript strict mode enabled |
| 26 | +- ✅ **Quality Checks** |
| 27 | + - Export validation with `@arethetypeswrong/cli` |
| 28 | + - Automated CI/CD with GitHub Actions |
| 29 | + - Pre-commit and version hooks |
| 30 | +- 📊 **Bundle Analysis** - Size analysis with detailed reports |
| 31 | + |
| 32 | +## Installation |
| 33 | + |
| 34 | +```bash |
| 35 | +npm install vite-setup |
| 36 | +# or |
| 37 | +yarn add vite-setup |
| 38 | +# or |
| 39 | +pnpm add vite-setup |
| 40 | +``` |
| 41 | + |
| 42 | +## Usage |
| 43 | + |
| 44 | +```typescript |
| 45 | +import { yourFunction } from 'vite-setup'; |
| 46 | + |
| 47 | +// Your usage example here |
| 48 | +``` |
| 49 | + |
| 50 | +## Development Scripts |
| 51 | + |
| 52 | +| Script | Description | |
| 53 | +| -------------------- | ----------------------------- | |
| 54 | +| `pnpm build` | Build the library | |
| 55 | +| `pnpm test` | Run tests | |
| 56 | +| `pnpm test:watch` | Run tests in watch mode | |
| 57 | +| `pnpm test:coverage` | Generate test coverage report | |
| 58 | +| `pnpm type-check` | Run TypeScript type checking | |
| 59 | +| `pnpm lint` | Lint the codebase | |
| 60 | +| `pnpm format` | Format code with Prettier | |
| 61 | +| `pnpm size` | Check bundle size | |
| 62 | +| `pnpm size:analyze` | Analyze bundle size in detail | |
| 63 | +| `pnpm check-exports` | Validate package exports | |
| 64 | +| `pnpm ci` | Run all CI checks | |
| 65 | + |
| 66 | +## Development Workflow |
| 67 | + |
| 68 | +1. Make your changes |
| 69 | +2. Run quality checks: |
| 70 | + |
| 71 | + ```bash |
| 72 | + pnpm type-check |
| 73 | + pnpm lint |
| 74 | + pnpm test |
| 75 | + ``` |
| 76 | + |
| 77 | +3. Create a changeset (for version management): |
| 78 | + |
| 79 | + ```bash |
| 80 | + pnpm changeset |
| 81 | + ``` |
| 82 | + |
| 83 | +4. Commit changes and push |
| 84 | + |
| 85 | +## Bundle Size Limits |
| 86 | + |
| 87 | +Current limits are set to: |
| 88 | + |
| 89 | +- ES Module: 10kb |
| 90 | +- UMD Bundle: 10kb |
| 91 | + |
| 92 | +Configure limits in `package.json` under `size-limit` section. |
| 93 | + |
| 94 | +## Environment Requirements |
| 95 | + |
| 96 | +- Node.js >=18 |
| 97 | +- pnpm 8.0.0 or higher |
| 98 | + |
| 99 | +## Contributing |
| 100 | + |
| 101 | +1. Fork the repository |
| 102 | +2. Create your feature branch: `git checkout -b feature/new-feature` |
| 103 | +3. Commit your changes: `git commit -am 'Add new feature'` |
| 104 | +4. Push to the branch: `git push origin feature/new-feature` |
| 105 | +5. Submit a pull request |
| 106 | + |
| 107 | +## Quality Checks |
| 108 | + |
| 109 | +Before each release, the following checks are automatically run: |
| 110 | + |
| 111 | +- TypeScript type checking |
| 112 | +- ESLint validation |
| 113 | +- Unit tests |
| 114 | +- Export validation |
| 115 | +- Bundle size checks |
| 116 | + |
| 117 | +## License |
| 118 | + |
| 119 | +MIT License - see the [LICENSE](LICENSE) file for details |
| 120 | + |
| 121 | +## Support |
| 122 | + |
| 123 | +- Issues: [GitHub Issues](https://github.com/yourusername/vite-setup/issues) |
| 124 | +- Discussions: [GitHub Discussions](https://github.com/yourusername/vite-setup/discussions) |
| 125 | + |
| 126 | +## Acknowledgments |
| 127 | + |
| 128 | +This template includes configurations and tooling inspired by modern JavaScript library development best practices. |
19 | 129 |
|
20 | 130 | ---
|
21 |
| -work in progress, reach out to better this! |
| 131 | + |
| 132 | +Built with ❤️ using Vite, TypeScript And A Bunch Of Cool Lovely Little Tools. Looking to improve? PRs and suggestions are welcome! |
0 commit comments