Skip to content

Instantly share code, notes, and snippets.

@adamsimonini
Last active October 26, 2023 14:45
Show Gist options
  • Save adamsimonini/c9fdd29faadf74faf540dc5f6c758c41 to your computer and use it in GitHub Desktop.
Save adamsimonini/c9fdd29faadf74faf540dc5f6c758c41 to your computer and use it in GitHub Desktop.
Husky Git Hooks
# ./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