https://github.com/runespoor-engineering/ts-lib-template
A modern TypeScript library template with production-ready tooling and best practices.
https://github.com/runespoor-engineering/ts-lib-template
biomejs library package template tsup typescript vitest
Last synced: about 2 months ago
JSON representation
A modern TypeScript library template with production-ready tooling and best practices.
- Host: GitHub
- URL: https://github.com/runespoor-engineering/ts-lib-template
- Owner: runespoor-engineering
- License: mit
- Created: 2025-07-09T09:09:34.000Z (12 months ago)
- Default Branch: main
- Last Pushed: 2025-07-09T14:26:33.000Z (12 months ago)
- Last Synced: 2025-07-09T15:40:06.974Z (12 months ago)
- Topics: biomejs, library, package, template, tsup, typescript, vitest
- Language: JavaScript
- Homepage:
- Size: 16.6 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Codeowners: .github/CODEOWNERS
- Security: SECURITY.md
Awesome Lists containing this project
README
@runespoorstack/{lib-name}
A modern TypeScript library template with production-ready tooling and best practices.
## ๐ TS Library Template
This is a comprehensive **TypeScript library template** designed to jumpstart your npm package development with modern tooling, best practices, and production-ready configurations.
## โจ Features
### ๐ง **Modern Build System**
- **TypeScript** - Full TypeScript support with strict mode and ESNext target
- **tsup** - Fast bundler with CommonJS and ESM output formats
- **Declaration files** - Automatic `.d.ts` generation for TypeScript consumers
### ๐งช **Testing & Quality**
- **Vitest** - Lightning-fast unit testing with coverage reporting
- **Biome** - Ultra-fast linting, formatting, and import organization
- **Coverage reporting** - V8 provider with HTML, LCOV, and JSON outputs
- **Codecov integration** - Automated coverage tracking and reporting
### ๐ **Development Workflow**
- **Husky** - Git hooks for code quality enforcement
- **lint-staged** - Run linters on staged files only
- **GitHub Actions** - Complete CI/CD workflows for testing and publishing
- **Changelog management** - Automated changelog generation with Runespoor tools
### ๐ฆ **Package Management**
- **pnpm** - Fast, disk space efficient package manager
- **Node.js 20+** - Modern Node.js runtime support
- **ESM/CJS dual exports** - Support for both module systems
## ๐ Quick Start
### 1. **Use this template**
Click "Use this template" button or clone this repository:
```bash
git clone https://github.com/runespoor-engineering/ts-lib-template.git my-awesome-lib
cd my-awesome-lib
```
### 2. **Replace placeholders**
Replace the following placeholders throughout the project:
- `{lib-name}` - Your library name (e.g., `my-awesome-lib`)
- `{repo-name}` - Your repository name (e.g., `my-awesome-lib`)
**Files to update:**
- `package.json` - Package name, repository URLs
- `README.md` - Title, badges, and links
- `SECURITY.md` - Security policy references
- `CONTRIBUTING.md` - Clone command
- `.github/workflows/reusable-test.yml` - Codecov slug
### 3. **Install dependencies**
```bash
pnpm install
```
### 4. **Create your library**
Create a `src` directory and start building your library:
```bash
mkdir src
echo "export const hello = () => 'Hello, World!';" > src/index.ts
```
### 5. **Start developing**
```bash
# Run tests
pnpm test
# Build your library
pnpm build
# Lint and format
pnpm lint:fix
pnpm format:fix
```
## ๐ Project Structure
```
your-library/
โโโ src/ # Your library source code
โโโ dist/ # Built output (auto-generated)
โโโ .github/ # GitHub workflows and templates
โ โโโ workflows/ # CI/CD workflows
โ โโโ ISSUE_TEMPLATE/ # Issue templates
โโโ .husky/ # Git hooks
โโโ package.json # Package configuration
โโโ tsconfig.json # TypeScript configuration
โโโ tsup.config.ts # Build configuration
โโโ vitest.config.mjs # Test configuration
โโโ biome.json # Linting and formatting config
โโโ Documentation files # README, CONTRIBUTING, etc.
```
## ๐ ๏ธ Available Scripts
| Script | Description |
| ----------------------- | -------------------------------- |
| `pnpm build` | Build the library for production |
| `pnpm test` | Run all tests |
| `pnpm test --ui` | Run tests with UI |
| `pnpm lint` | Check code for linting issues |
| `pnpm lint:fix` | Fix linting issues automatically |
| `pnpm format` | Check code formatting |
| `pnpm format:fix` | Fix formatting issues |
| `pnpm changelog:change` | Add a new changelog entry |
| `pnpm unimported` | Find unused dependencies |
## ๐ง Configuration
### **TypeScript**
- Strict mode enabled
- ESNext target and module
- Declaration files generated
- Source maps included
### **Build Output**
- CommonJS (`dist/index.js`)
- ES Modules (`dist/index.mjs`)
- TypeScript declarations (`dist/index.d.ts`)
- Minified for production
### **Testing**
- Global test environment
- Node.js environment
- Coverage thresholds configured
- HTML and LCOV reports
## ๐ Publishing
The template includes automated publishing workflows:
1. **Manual publish** - Trigger releases manually
2. **Version management** - Automated version bumping
3. **NPM publishing** - Secure token-based publishing
4. **GitHub releases** - Automatic release notes
## ๐๏ธ What's Included
- โ
TypeScript configuration
- โ
Modern build system (tsup)
- โ
Testing framework (Vitest)
- โ
Code quality tools (Biome)
- โ
Git hooks (Husky + lint-staged)
- โ
GitHub Actions workflows
- โ
Code coverage reporting
- โ
Dependency management
- โ
Security policies
- โ
Contributing guidelines
- โ
Issue templates
- โ
Funding configuration
## ๐ ๏ธ Contributing
See the [CONTRIBUTING.md](https://github.com/runespoor-engineering/runespoorstack/blob/main/CONTRIBUTING.md) document.
## ๐ Special Thanks
- I want to say thank you to the best woman in the world, **my wife Diana** for her love, daily support, motivation and inspiration.
## โค๏ธ Support or Donate
If you are enjoying this work and feel extra appreciative, you could [buy me a book](https://bmc.link/borisshulyak)
๐ or 3 ๐๐๐.