Template for a TypeScript package-first pnpm monorepo.
This template keeps the full setup from the source repository:
- pnpm workspace with
apps/*andpackages/* - publishable TypeScript package built with
tsdown package.jsonexports with@repo/sourcecustom condition- playground app for local package development
- Nx task pipeline
- Vitest workspace
- Changesets release setup
- GitHub Actions workflows
- oxlint, oxfmt, Sheriff, and Knip checks
apps/
playground/ TanStack Start playground app
packages/
package/ Publishable library package
pnpm install
pnpm build
pnpm dev
pnpm test
pnpm typecheck
pnpm lint
pnpm format
pnpm format:check
pnpm sheriff
pnpm knip
pnpm check
pnpm --filter @repo/package run build
pnpm --filter @repo/package run test:attw
pnpm --filter @repo/package run test:publintThe package export map includes an internal source condition:
{
"exports": {
".": {
"@repo/source": "./src/index.ts",
"import": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
}
}
}
}The root TypeScript config enables that condition:
{
"compilerOptions": {
"customConditions": ["@repo/source"]
}
}Inside the workspace, TypeScript and IDE navigation can resolve package imports
to src/ instead of stale dist/ output. Published consumers still use the
normal dist/ entries.
MIT