A modern TypeScript library template with standardized build scripts and tooling.
- Modern Build System: ts-builds + tsdown for fast bundling
- Testing: Vitest with coverage reporting
- Code Quality: ESLint + Prettier with automatic formatting and fixing
- ESM Output: ES module output with proper TypeScript declarations
- Standardized Scripts: Consistent commands via ts-builds across all projects
- Node.js 24+ (exact version pinned in
.nvmrc; npm 11.5.1+ also fixes OIDC trusted publishing) - pnpm 12+ (pinned via the
packageManagerfield — runcorepack enableto use the exact version)
- Use this template to create a new repository
- Clone your new repository
- Install dependencies:
pnpm install - Start developing:
pnpm dev(builds with watch mode) - Before committing:
pnpm validate(format + lint + test + build)
pnpm validate # Main command: format, lint, test, and build everything pnpm run ci # What CI runs: the same steps, checking format and lint without fixing
Always type pnpm run ci. A bare pnpm ci is pnpm's own clean install, not this script.
# Formatting pnpm format # Format code with Prettier pnpm format:check # Check formatting without writing # Linting pnpm lint # Fix ESLint issues pnpm lint:check # Check ESLint issues without fixing # Testing pnpm test # Run tests once pnpm test:watch # Run tests in watch mode pnpm test:coverage # Run tests with coverage report # Building pnpm build # Production build pnpm dev # Development mode with watch # Type Checking pnpm typecheck # Check TypeScript types
The template automatically runs pnpm run ci before publishing via the prepublishOnly script. It checks format and lint without fixing them, so run pnpm validate first if it fails.
npm version patch|minor|major npm publish --access public
src/
├── index.ts # Main library entry point
test/
├── *.spec.ts # Test files
dist/ # Built output (ES module + types)
- Build: ts-builds - Centralized TypeScript toolchain
- Bundler: tsdown - Fast TypeScript bundler (successor to tsup)
- Test: Vitest - Fast unit test framework
- Lint: ESLint with TypeScript support
- Format: Prettier with ESLint integration
- Package Manager: pnpm for fast, efficient installs
This repository includes a Claude Code skill for bootstrapping new TypeScript libraries from this template:
Location: .claude/skills/ts-builds-template/
Usage: When using Claude Code, the skill provides guidance for:
- Cloning and customizing this template for a new library
- Understanding the project structure and dev workflow
- Publishing to npm
Installation (for use in other projects):
# Copy the skill to your Claude Code skills directory cp -r .claude/skills/ts-builds-template ~/.claude/skills/
Related Skills: For tooling configuration, migration guides, and standardizing existing projects, see the ts-builds skill.
References:
- AGENTS.md - Development guidance for AI coding agents
- .claude/skills/ts-builds-template/ - Complete skill documentation
This template is based on the earlier work of https://github.com/orabazu/tsup-library-template but updated with modern tooling and standardized scripts.