Skip to content

jsnobug/pnpm-monorepo-demo

Repository files navigation

pnpm-monorepo-demo

简体中文

A minimal demonstration of managing a TypeScript monorepo with pnpm workspaces.

Overview

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

Repository Layout

/               ── 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

Quick Start

  1. Install dependencies (only once):

    pnpm install
  2. Start development watcher (transpiles on save):

    pnpm dev
  3. Build all packages:

    pnpm build

Workflow Tips

• 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.

Requirements

  • Node.js ≥ 20.x
  • pnpm ≥ 10.x (install globally with npm i -g pnpm)

License

MIT © 2024

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published