Created
February 20, 2023 02:54
-
-
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
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
# 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 | |
} |
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 | |
# 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