~kris/dots

srice

ref: 65bd807cfdd6651a480f8fc70ed41ef82abaf64b srice/.local/bin/depsize -rwxr-xr-x 388 bytes
65bd807c — Kris Yotam mksh: skip stale history log on first prompt render 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)"