A minimal demonstration of managing a TypeScript monorepo with pnpm workspaces.
This repository shows a practical setup that combines pnpm, TypeScript, Turbo and a set of common developer-experience tools.
Tool | Purpose |
---|---|
pnpm | Fast, space-efficient package manager & workspace resolver |
Turbo | Task runner to orchestrate builds and caching across workspaces |
TypeScript | Shared type-safe codebase configuration |
tsdown | Simple build pipeline wrapper used in this demo |
ESLint & Prettier | Static analysis and consistent code style |
Husky & lint-staged | Git hooks to auto-format / lint staged files |
Commitlint | Enforces Conventional Commits for readable history |
/ ── Root workspace
│
├── packages/ ── Independent workspaces (libraries, apps, etc.)
│ └── core/ ── Example package exported by this demo
│ └── src/
│ └── package.json
│
├── tsconfig.base.json ── Shared TS config extended by every package
├── pnpm-workspace.yaml ── Declares all workspaces to pnpm
└── turbo.json ── Pipelines for build & dev commands
-
Install dependencies (only once):
pnpm install
-
Start development watcher (transpiles on save):
pnpm dev
-
Build all packages:
pnpm build
• Run pnpm commit
to create Conventional Commits via interactive prompt.
• Lint & format staged files automatically with Husky + lint-staged when committing.
• Custom scripts for individual packages can be added inside their own package.json
.
- Node.js ≥ 20.x
- pnpm ≥ 10.x (install globally with
npm i -g pnpm
)
MIT © 2024