measurepnpm is a Zsh function that walks through your project’s node_modules/.pnpm directory, measures the on-disk size of every package (as stored by pnpm), and prints a sorted table of package sizes along with a live progress indicator.
- 🔍 Accurate: Reads actual disk usage from pnpm’s store
- ⚡ Fast: Uses
find+duin tandem for minimal overhead - 📊 Pretty: Live spinner & count, colourized output
- 📈 Human-readable: Prints sizes in K, M, or G as appropriate
- 🎯 Flexible:
- Show only the pnpm store path
- Point at an arbitrary project /
node_modules/.pnpmdirectory
- Zsh (tested on zsh 5.8+)
- pnpm (for getting the store path)
- Unix tools:
find,du,realpath,awk,sort
-
Copy
measurepnpm.zshinto your Zsh functions folder (e.g.~/.zsh-Functions/). -
Source it from your
.zshrc:fpath=(~/.zsh-Functions $fpath) autoload -Uz measurepnpm -
Reload your shell:
source ~/.zshrc
measurepnpm [ -h | --help ] [ -s | --store ] [ <path> ]-h,--helpShow help message and exit-s,--storePrint only your pnpm store path<path>Optional path to a project root,node_modulesfolder, or.pnpmdir
-
Measure current project
cd ~/Projects/my-app measurepnpm
-
Only show your pnpm store location
measurepnpm --store # Pnpm store path: /Users/you/Library/pnpm/store/v10 -
Point at a nested folder
measurepnpm ~/some/other/project
Click to expand
Scanning packages... DONE ✓ 519 / 797
SIZE PACKAGE
-------- ----------------------
48K safe-array-concat
16K is-extglob
44K ci-info
728K web-vitals
...
444.2M TOTAL
> Store path: /Users/you/Library/pnpm/store/v10
- Live line shows package name in white, spinner & counts in colour
- Table neatly aligns size & package columns
- TOTAL is formatted as K/M/G automatically
- Tweak colours by editing the ANSI variables at the top of
measurepnpm.zsh - Adjust maximum depth of search in the
findcommand if you have nonstandard layouts
This project is licensed under the GNU General Public License v3.0 (GPL-3.0). See LICENSE for full text.