A minimal TypeScript library template powered by tsdown.
Build TypeScript libraries with dual ESM/CJS output, typed declarations, and a ready-to-use quality toolchain.
English | 简体中文
- Node.js
>=18 - pnpm
10
pnpm iinstalls dependenciespnpm buildcreates a local development build with sourcemapspnpm build:watchrebuilds the library on source changespnpm teststarts Vitest in watch modepnpm test:runruns the Vitest suite oncepnpm lintruns ESLint over the repositorypnpm lint:fixapplies safe ESLint fixespnpm formatchecks formatting with Prettierpnpm format:fixformats supported files with Prettierpnpm typecheckruns TypeScript project references withtsc -bpnpm checkruns lint, format check, typecheck, and testspnpm fixruns lint and format fixes
pnpm release:checkruns all release validation, including a publish build and package dry-run
- Create a new repository from this template.
- Update
package.jsonmetadata for your package. - Run
pnpm i. - Use
pnpm buildduring development. - Verify changes with
pnpm check.
Before publishing a real npm package:
- Remove
private: truefrompackage.jsonor set it tofalse. - Update
name,version,description,author,repository,bugs, andhomepage. - Run
pnpm release:checkto verify linting, formatting, types, tests, the publish build, and npm package contents. - Run
npm publishwhen the dry-run output looks correct.
npm publish automatically runs prepublishOnly, which executes pnpm release:check. Release artifacts are produced by release:build.
The published package includes the ESM and CJS runtime files and declarations from dist/, along with npm metadata, README, and LICENSE.