Skip to content

Commit 99be976

Browse files
committed
feat(tools): complete and ready for use
1 parent 937762b commit 99be976

File tree

6 files changed

+164
-33
lines changed

6 files changed

+164
-33
lines changed

.npmignore

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# First ignore everything
2+
*
3+
4+
# Then whitelist specific files/directories
5+
!dist/
6+
!README.md
7+
!package.json
8+
!LICENSE
9+
10+
# Even if a directory is whitelisted, ignore some files within it
11+
dist/**/*.test.*
12+
dist/**/*.spec.*
13+
dist/**/*.map
14+
dist/**/*.svg

LICENSE

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
MIT LICENSE
2+
3+
Copyright (c) 2024 Name
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
6+
documentation files (the "Software"), to deal in the Software without restriction, including without limitation
7+
the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
8+
to permit persons to whom the Software is furnished to do so, subject to the following conditions:
9+
10+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
11+
12+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
13+
THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
14+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
15+
CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
16+
IN THE SOFTWARE.

README.md

Lines changed: 125 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,132 @@
1-
# vite-lib-setup
1+
# vite-setup
22

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.
44

5-
## What's Included
5+
## How To Use?
66

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:
158

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!
1713

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.
19129

20130
---
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!

tsconfig.json

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
],
1111
"skipLibCheck": true,
1212
"declaration": true,
13-
"declarationMap": true,
13+
"declarationMap": false,
1414
"emitDeclarationOnly": true,
1515
"declarationDir": "./dist",
1616
"outDir": "./dist",
@@ -27,9 +27,7 @@
2727
"removeComments": false
2828
},
2929
"include": [
30-
"src",
31-
"tests",
32-
"vite.config.ts"
30+
"src"
3331
],
3432
"exclude": [
3533
"node_modules",

vite.config copy.ts

Lines changed: 0 additions & 15 deletions
This file was deleted.

vite.config.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,12 @@ export default defineConfig({
3131
});
3232
},
3333
},
34+
{
35+
name: 'cleanup-assets',
36+
closeBundle() {
37+
// Remove any non-essential files from dist
38+
execSync('rm -f ./dist/*.svg ./dist/*.map', { stdio: 'inherit' });
39+
},
40+
},
3441
],
3542
});

0 commit comments

Comments
 (0)