Skip to content

RingoTangs/tsdown-template

Repository files navigation

tsdown-template

A minimal TypeScript library template powered by tsdown.

TypeScript Node.js pnpm tsdown Vitest ESLint Prettier

Build TypeScript libraries with dual ESM/CJS output, typed declarations, and a ready-to-use quality toolchain.

English | 简体中文

Requirements

  • Node.js >=18
  • pnpm 10

Development

  • pnpm i installs dependencies
  • pnpm build creates a local development build with sourcemaps
  • pnpm build:watch rebuilds the library on source changes
  • pnpm test starts Vitest in watch mode
  • pnpm test:run runs the Vitest suite once
  • pnpm lint runs ESLint over the repository
  • pnpm lint:fix applies safe ESLint fixes
  • pnpm format checks formatting with Prettier
  • pnpm format:fix formats supported files with Prettier
  • pnpm typecheck runs TypeScript project references with tsc -b
  • pnpm check runs lint, format check, typecheck, and tests
  • pnpm fix runs lint and format fixes

Release Validation

  • pnpm release:check runs all release validation, including a publish build and package dry-run

Usage

  1. Create a new repository from this template.
  2. Update package.json metadata for your package.
  3. Run pnpm i.
  4. Use pnpm build during development.
  5. Verify changes with pnpm check.

Publishing

Before publishing a real npm package:

  1. Remove private: true from package.json or set it to false.
  2. Update name, version, description, author, repository, bugs, and homepage.
  3. Run pnpm release:check to verify linting, formatting, types, tests, the publish build, and npm package contents.
  4. Run npm publish when the dry-run output looks correct.

npm publish automatically runs prepublishOnly, which executes pnpm release:check. Release artifacts are produced by release:build.

Output

The published package includes the ESM and CJS runtime files and declarations from dist/, along with npm metadata, README, and LICENSE.

About

A TypeScript npm library template powered by tsdown

Resources

License

Stars

1 star

Watchers

0 watching

Forks

Packages

 
 
 

Contributors