Skip to content

Instantly share code, notes, and snippets.

@gearonix
Created September 27, 2023 07:52
Show Gist options
  • Save gearonix/1c2037e900b631beab1c62bbee71e4a2 to your computer and use it in GitHub Desktop.
Save gearonix/1c2037e900b631beab1c62bbee71e4a2 to your computer and use it in GitHub Desktop.
Something like npkill, will delete all unnecessary files from your nodejs projects
#!/bin/bash
# will delete all unnecessary files
# from your nodejs projects
EXECUTE_DIR=$1
PURPLE='\033[1;36m'
NC='\033[0m'
dirsToRemove=("node_modules" ".cache" "dist" ".next" "build" "tmp")
for dir in "${dirsToRemove[@]}"
do
echo -e "${PURPLE}removing folders:${NC} ${dir}"
find ${EXECUTE_DIR=$HOME/dsk} -name $dir -type d -prune -exec rm -rf {} \;
done
find . -name .git -type d -size +40M -exec rm -rf {} \;
echo "done."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment