π¦ Node.js library template with TypeScript, testing setup, and modern build tooling.
- TypeScript - Full type safety with modern TS features
- tsup - Fast, zero-config bundler powered by esbuild
- Vitest - Fast unit testing with coverage reports
- tsx - Fast TypeScript execution for development
- Changesets - Automated version management and changelog generation
- GitHub Actions - Automated CI/CD workflows for testing and publishing
- Pre-publish safety - Automatic checks before publishing to prevent broken releases
pnpm install
pnpm dev
- Add library code in
src/
- Add tests in
tests/
- Update
package.json
metadata (name, description, keywords, repository)
Command | Description |
---|---|
pnpm dev |
Run with tsx in watch mode |
pnpm build |
Build library with tsup |
pnpm test |
Run tests with vitest |
pnpm test:coverage |
Run tests with coverage report |
pnpm check-types |
Run TypeScript type checking |
pnpm check |
Run linter checks |
pnpm fix |
Auto-fix linting issues |
pnpm changeset |
Create a new changeset |
pnpm version |
Update versions based on changesets |
pnpm release |
Build and publish to npm |
src/
βββ index.ts # Main entry point
tests/
βββ index.test.ts # Test files
.github/
βββ workflows/
β βββ ci.yml # CI workflow (lint, test, build)
β βββ release.yml # Automated release workflow
βββ ISSUE_TEMPLATE/
β βββ bug_report.yml # Bug report template
β βββ feature_request.yml # Feature request template
βββ PULL_REQUEST_TEMPLATE.md # PR template
This template includes automated GitHub Actions workflows:
-
CI Workflow - Runs on every PR and push to main
- Linting with Biome
- Type checking with TypeScript
- Unit tests with Vitest
- Build verification
-
Release Workflow - Automated publishing with Changesets
- Creates version bump PRs automatically
- Publishes to npm when merged
To enable automated npm publishing, add an NPM_TOKEN
secret to your GitHub repository:
- Create an npm access token at npmjs.com
- Go to your GitHub repository settings β Secrets and variables β Actions
- Add a new secret named
NPM_TOKEN
with your npm token
This template uses Changesets for version management.
-
Create a changeset when you make changes:
pnpm changeset
Follow the prompts to describe your changes (patch, minor, or major).
-
Commit and push your changes including the changeset file
-
Automated workflow will:
- Create a "Version Packages" PR with version bumps and changelog
- When you merge that PR, automatically publish to npm
You can also publish manually:
pnpm version # Update versions from changesets
pnpm release # Build and publish to npm
Note: The
prepublishOnly
script ensures all checks pass before publishing.
MIT License - see the LICENSE file for details.