~kris/dots

srice

ref: 2582f0c4173a4ad6a31e0cb759473c893cdc4e93 srice/.local/bin/depsize -rwxr-xr-x 388 bytes
2582f0c4 — Kris Yotam sb-cpu: portable temp source (Intel Core 0, AMD Tdie/Tctl, Asahi NVMe Composite fallback) 3 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
#!/bin/sh
# depsize -- show size of node_modules dependencies sorted by size
# Usage: depsize [path-to-node_modules]

nmdir="${1:-node_modules}"
[ ! -d "$nmdir" ] && { echo "No $nmdir directory found"; exit 1; }

echo "Top 20 largest dependencies in $nmdir:"
echo "---"
du -sh "$nmdir"/* 2>/dev/null | sort -hr | head -20
echo "---"
echo "Total: $(du -sh "$nmdir" 2>/dev/null | cut -f1)"