ts-builds-template
v1.0.0
Published
A basic template for creating a TypeScript Builds and Publishing it to NPM.
Downloads
93
Maintainers
Readme
ts-builds-template
A modern TypeScript library template with standardized build scripts and tooling.
Features
- Modern Build System: ts-builds + tsdown for fast bundling
- Testing: Vitest with coverage reporting
- Code Quality: ESLint + Prettier with automatic formatting and fixing
- Dual Format: Outputs both CommonJS and ES modules with proper TypeScript declarations
- Standardized Scripts: Consistent commands via ts-builds across all projects
Quick Start
- 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)
Development Commands
Pre-Checkin Command
pnpm validate # Main command: format, lint, test, and build everythingIndividual Commands
# 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 typesPublishing
The template automatically runs pnpm validate before publishing via the prepublishOnly script.
npm version patch|minor|major
npm publish --access publicProject Structure
src/
├── index.ts # Main library entry point
test/
├── *.spec.ts # Test files
dist/ # Built output (CommonJS + ES modules + types)Tooling
- 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
Claude Code Skill
This repository includes a Claude Code skill to help you apply these standards to other projects:
Location: .claude/skills/typescript-standards/
Usage: When using Claude Code, the skill automatically provides guidance for:
- Creating new libraries from this template
- Applying these standards to existing TypeScript projects
- Configuring tooling (ts-builds, Vitest, ESLint, Prettier)
- Setting up dual module format
Installation (for use in other projects):
# Copy the skill to your Claude Code skills directory
cp -r .claude/skills/typescript-standards ~/.claude/skills/References:
- CLAUDE.md - Development guidance for this project
- STANDARDIZATION_GUIDE.md - Guide for applying these patterns to existing projects
- .claude/skills/typescript-standards/ - 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.
