Skip to content

Instantly share code, notes, and snippets.

@antoniopresto
Created February 20, 2023 02:54
Show Gist options
  • Save antoniopresto/74d3b644fa58fcd848901c48ad452f76 to your computer and use it in GitHub Desktop.
Save antoniopresto/74d3b644fa58fcd848901c48ad452f76 to your computer and use it in GitHub Desktop.
Creates a .nosync file in all directories that start with a dot or are named node_modules on npm install
# will run after npm install
function npm() {
if [[ $1 == "install" ]]; then
command npm "$@"
# Creates a .nosync file in all directories that start with a dot or are named node_modules
find . -mindepth 1 -maxdepth 1 -type d \( -name ".*" -o -name "node_modules" \) ! -name ".git" -exec touch {}/.nosync \; -exec echo "File .nosync created in {}" \;
else
command npm "$@"
fi
}
#!/bin/bash
# Creates a .nosync file in all directories that start with a dot or are named node_modules
find . -mindepth 1 -maxdepth 1 -type d \( -name ".*" -o -name "node_modules" \) ! -name ".git" -exec touch {}/.nosync \; -exec echo "File .nosync created in {}" \;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment