macos-setup
🐱 Source ☕️ Java SampleGo Sample Angular Sample
  • Mac Setup
  • Getting Started
    • Xcode
    • Homebrew
    • System Preferences
    • Essentials
    • Dotfiles
  • Applications
    • Ghostty
    • Sublime-text
    • JetBrains
    • VSCode
    • Xcode
    • Marta
    • Benthos
    • OrbStack
    • Traefik
    • n8n
  • Platforms
    • Java
    • Node
      • Bub
      • NPM
      • PNPM
      • Turborepo
    • GoLang
    • Rust
    • Python
      • Agno AI
  • DevOps
    • Development Workflow
      • Git
        • GitHub CLL
      • GitOps
      • Documentation
      • mkcert
      • YubiKey
    • Monorepo
    • dnsmasq
    • Docker
    • Skaffold
    • Kubernetes
    • Helm
    • Kustomize
    • kustomizer
    • Terraform
    • Security
    • Cloud
      • gcloud
      • azure
      • aws
  • Tips
    • Git
    • MacOS
Powered by GitBook
On this page
  • Install
  • Project Setup
  • Commands
  • Patching a node module
  • create SvelteKit workspace
  • Reference

Was this helpful?

Edit on GitHub
  1. Platforms
  2. Node

PNPM

PreviousNPMNextTurborepo

Last updated 9 minutes ago

Was this helpful?

Install

[!NOTE] Since v16.13, Node.js is shipping Corepack for managing package managers.

brew install node
# This will automatically install pnpm on your system.
corepack enable pnpm
# You can pin the version of pnpm used on your project using the following command:
corepack use pnpm@latest-10

To upgrade in the future:

corepack up

Add following lines to

# pnpm
export PNPM_HOME=$HOME/Library/pnpm
export PATH=$PNPM_HOME:$PATH

Project Setup

[!NOTE] You can pin the version of pnpm used on your project using the following command

# for example to pin pnpm version for spectacular
cd ~/Developer/Work/web/spectacular
corepack use pnpm@latest-10 

Commands

# add package to monorepo's root
pnpm add debug -W
# add package to global
pnpm add debug --global

# update package versions in a repo
pnpm up
pnpm up --latest
pnpm up --latest --global

pnpm ls prune
pnpm ls
pnpm ls --global

pnpm audit
# find why a specific package installed 
pnpm why vite
# for monorepo use -r to search all sub projects
pnpm why vite -r

# Publish all packages in topological order from the workspace.
pnpm publish -r

Patching a node module

In your project repo directory, run:

pnpm patch @auth/core@0.2.4

Output:

You can now edit the following folder: /private/var/folders/t_/2rzsqx111439_19vxd5f_p800000gp/T/f6f8c74999a108b642b97ab160392cd8 Once you're done with your changes, run "pnpm patch-commit /private/var/folders/t_/2rzsqx111439_19vxd5f_p800000gp/T/f6f8c74999a108b642b97ab160392cd8"'

Edit the files you need to patch then run: pnpm patch-commit "path-to-edited-module" as stated above.

create SvelteKit workspace

pnpm create svelte@latest svelte-starter-kit
# select `yes` for TypeScript, ESLint, Prettier, Playwright and Vitest

Reference

~/my/paths.zsh
https://medium.com/pixel-and-ink/switching-an-nx-repo-to-pnpm-5b1cbd5c3797