A starter template for TypeScript libraries with all modern tooling included.
Start coding in seconds with zero configuration! π
Inspired by alexjoverm/typescript-library-starter
- π¦ Rollup for optimized bundles (ESM + CommonJS)
- π TypeScript 5.7 with strict mode
- π₯ Node.js 22 LTS support
- π§ͺ Jest for fast unit testing
- π TypeDoc for API documentation with versioning
- π ESLint + Prettier + SonarJS for code quality
- π€ GitHub Actions for CI/CD
- π·οΈ Semantic Release for automated versioning
- π Codecov for coverage reports
- π― Commitlint with conventional commits
- Click the "Use this template" button on GitHub
- Clone your new repository
- Install dependencies:
npm ci- Start developing:
- Getting Started Guide - Quick start guide
- Contributing Guide - How to contribute to this project
- Create a new repository from this template
- Enable Renovate (choose one option):
- Option A (Recommended): Install Renovate GitHub App for your repository
- Option B: Use self-hosted Renovate workflow (requires
RENOVATE_TOKENsecret)
- Enable GitHub Pages (Settings β Pages β Source: GitHub Actions)
- Add repository secrets (Settings β Secrets and variables β Actions):
NPM_TOKEN- Your npm automation token (create one here)CODECOV_TOKEN- Your Codecov token (get it here)RENOVATE_TOKEN- GitHub PAT for self-hosted Renovate (only if using Option B)
Edit package.json:
{
"name": "@your-scope/your-library",
"description": "Your library description",
"repository": "your-username/your-repo",
"author": "Your Name"
}# Install dependencies
npm install
# Run tests in watch mode
npm run test:watch
# Build the library
npm run build
# Run linter
npm run lint
# Generate docs
npm run docs| Script | Description |
|---|---|
npm run build |
Build library (ESM + CommonJS) |
npm run prebuild |
Clean dist directory before build |
npm test |
Run tests |
npm run test:watch |
Run tests in watch mode |
npm run lint |
Lint and fix code |
npm run format |
Format code with Prettier |
npm run prepare |
Install Husky hooks |
npm run publish |
Publish with Semantic Release |
npm run docs |
Generate API docs (not implemented) |
npm run docs:serve |
Serve documentation (not implemented) |
npm run docs:clean |
Clean generated docs (not implemented) |
Note: API documentation generation is not yet implemented.
Strict mode is enabled by default. Edit tsconfig.json to customize compiler options.
Tests are located in test/ directory. Edit jest.config.js for custom configuration.
This project uses a strict ESLint configuration with:
- TypeScript rules
- SonarJS for code quality
- Prettier for formatting
Edit eslint.config.js to customize rules.
Follow conventional commits:
feat:New featurefix:Bug fixdocs:Documentationtest:Testsrefactor:Code refactoring
Support for task codes: feat: [TASK-123] add feature
This template uses Semantic Release for automated versioning and publishing.
Release trigger: Pushes to protected branches only.
Supported release branches:
main/masterβ Production releasenextβ Pre-release (@nexttag)next-majorβ Major pre-release (@next-majortag)alpha/betaβ Testing releases (@alpha/@betatags)- Maintenance branches (
1.x,2.15.x) β Patch releases for specific versions
Setup: Mark your release branches as protected in GitHub repository settings (Settings β Branches β Add rule).
Releases are automated when you push to protected branches:
- Version bumps based on commit messages
- Changelog generation
- npm publishing
- GitHub releases
# Build the library
npm run build
# Publish to npm
npm publish- Fork the repository
- Create a feature branch
- Make your changes
- Run tests:
npm test - Commit using conventional commits
- Push and create a Pull Request
We use conventional commits with support for task codes:
# Features
git commit -m "feat: add new feature"
git commit -m "feat(scope): [TASK-123] add feature with scope"
# Fixes
git commit -m "fix: resolve issue"
git commit -m "fix: [BUG-456] fix critical bug"
# Breaking changes
git commit -m "feat!: breaking change"The CI/CD pipeline runs on every push and PR:
- β Linting (ESLint + Prettier)
- β Type checking (TypeScript)
- β Testing (Jest)
- β Coverage (Codecov)
- β Build validation
- β Bundle size check
.
βββ src/ # Source files
β βββ index.ts # Library entry point
βββ test/ # Test files
β βββ *.test.ts # Test suites
βββ dist/ # Built files (generated)
β βββ esm/ # ES modules
β βββ cjs/ # CommonJS
β βββ index.d.ts # TypeScript declarations
βββ docs/ # Documentation
β βββ guides/ # User guides (Markdown)
β βββ contributing.md # Contributing guidelines
βββ .github/
β βββ workflows/ # GitHub Actions
βββ package.json
βββ tsconfig.json # TypeScript config
βββ jest.config.js # Jest config
βββ rollup.config.js # Rollup config
βββ eslint.config.js # ESLint config
βββ renovate.json # Renovate config
MIT Β© Timur Popov
Made with β€οΈ using TypeScript