You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
laughing-hipster/src/.githooks/pre-commit

18 lines
610 B

#!/usr/bin/env bash
if [ -f "$PWD/makefile" ] && [ ! -z "$(cat $PWD/makefile | grep '^lint:')" ]; then
echo "lint rule found in $PWD/makefile..."
make lint
elif [ -f "$PWD/package.json" ] && [ ! -z "$(cat $PWD/package.json | grep '\"lint\"')" ]; then
echo "running npm run lint..."
npm run lint
fi
if [ -f "$PWD/makefile" ] && [ ! -z "$(cat $PWD/makefile | grep '^test:')" ]; then
echo "test rule found in $PWD/makefile..."
make test
elif [ -f "$PWD/package.json" ] && [ ! -z "$(cat $PWD/package.json | grep '\"test\"')" ]; then
echo "running npm run test..."
npm run test
fi