~kris/dots

srice

ref: a4bfa48cdda924f7a77a81e8d8e93e326a01b8a0 srice/.local/bin/depsize -rwxr-xr-x 388 bytes
a4bfa48c — Kris Yotam mksh: reliable history hook via HISTFILE growth + binary record parse 2 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)"