Last active
October 26, 2023 14:45
-
-
Save adamsimonini/c9fdd29faadf74faf540dc5f6c758c41 to your computer and use it in GitHub Desktop.
Husky Git Hooks
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
# ./husky/pre-commit | |
#!/bin/sh | |
# Define ANSI color codes | |
MAGENTA='\033[35m' | |
RESET_COLOR='\033[0m' | |
# Check if the message has been displayed | |
if [ -z "$LINTER_MESSAGE_DISPLAYED" ]; then | |
# Print "Linting!" in light blue text | |
echo "${MAGENTA}-- Running Linter --${RESET_COLOR}" | |
# Set the environment variable to indicate the message has been displayed | |
export LINTER_MESSAGE_DISPLAYED=true | |
fi | |
. "$(dirname -- "$0")/_/husky.sh" | |
npm run lint | |
# ./husky/pre-push | |
#!/bin/sh | |
# Define ANSI color codes | |
LIGHT_GREEN='\033[1;32m' | |
RESET_COLOR='\033[0m' | |
# Print "Linting!" in light blue text | |
echo "${LIGHT_GREEN}-- Running Unit Tests --${RESET_COLOR}" | |
npm test |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment