pnpm

Manage Node.js monorepos with pnpm workspace-aware dependency management.

28|6|Updated Aug 25, 2022
One-click install
npx skills add https://github.com/sanity-io/pkg-utils --skill pnpm-sanity-io
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: pnpm
Source: https://github.com/sanity-io/pkg-utils/tree/main/.agents/skills/pnpm
Command: npx skills add https://github.com/sanity-io/pkg-utils --skill pnpm-sanity-io

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Solves the complexity of managing Node.js monorepos with pnpm.

Core Features & Use Cases

  • Workspace-aware dependency management using pnpm-workspace.yaml
  • Catalogs, overrides, and patches to enforce consistent versions across packages
  • Reference workflows and best practices for CI, Docker, and publishing

Quick Start

Install pnpm in the root of your monorepo, initialize a workspace if needed, then run common commands such as pnpm install, pnpm run build, and pnpm patch for local changes.

Frequently Asked Questions about pnpm

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I manage dependencies in a Node.js monorepo using pnpm workspaces?

To manage dependencies in a Node.js monorepo, pnpm uses pnpm-workspace.yaml to define workspace-aware packages. This ensures deterministic installs and orchestrates dependencies across all workspace projects.

What is the best way to enforce consistent package versions across a pnpm monorepo?

The best way to enforce consistent package versions is using pnpm catalogs, overrides, and patches. These features synchronize dependency versions across all packages in the workspace to maintain reliability.

How do I apply patches to node_modules in a pnpm workspace?

To apply patches in a pnpm workspace, use the pnpm patch command. This allows you to make local changes to dependencies and persist them reliably across deterministic installs.

Can I use pnpm for CI and Docker workflows in a multi-package repository?

Yes, pnpm supports multi-package repositories in CI and Docker workflows. It provides reference workflows and best practices to ensure reliable, workspace-aware installations and builds in these environments.

When do I need to use pnpm catalogs for dependency management?

You need pnpm catalogs when managing a monorepo with multiple packages requiring the same dependency versions. Catalogs centralize version definitions to enforce consistency across the entire workspace.

Why use pnpm over other tools for managing a Node.js monorepo?

Use pnpm for its workspace-aware dependency management, deterministic installs, and built-in patches. It solves monorepo complexity by orchestrating workspaces and enforcing consistent versions across packages.