Last active
September 7, 2017 15:25
-
-
Save brock/0419aa6bba45bffcdb4c to your computer and use it in GitHub Desktop.
ModuleSize - shows the percentage of storage your node_modules are taking up
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
ALL=$(du -s | awk '{print $1}'); | |
NODEMODULES=$(find . -type d -depth 1 -name node_modules | xargs du -s | awk '{print $1}' | awk '{sum+=$1} END {print sum}'); | |
DECIMAL=$(awk "BEGIN {printf \"%.2f\", $NODEMODULES/$ALL}") | |
PERCENT=$(echo "$DECIMAL*100" | bc) | |
echo "node_modules are using $PERCENT% of space in the current directory." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment