forked from aws-amplify/amplify-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpre-commit
More file actions
executable file
·21 lines (19 loc) · 753 Bytes
/
pre-commit
File metadata and controls
executable file
·21 lines (19 loc) · 753 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"
# Define color variables
GREEN='\033[0;32m'
CYAN='\033[0;36m'
NC='\033[0m' # No color
echo "${GREEN}Running pre-commit hook${NC}"
echo "${CYAN}Running yarn prettier staged files${NC}"
git diff --name-only --cached --diff-filter=ACM | grep -E '\.(js|jsx|ts|tsx)$' | xargs --no-run-if-empty yarn prettier --write
echo "${CYAN}Running yarn lint-staged${NC}"
yarn lint-fix
echo "${CYAN}Running yarn stage prettified files${NC}"
git diff --name-only --cached --diff-filter=ACM | xargs git add
echo "${CYAN}Running yarn lint-fix${NC}"
yarn lint-fix
echo "${CYAN}Running ./scripts/package-json-check.sh${NC}"
./scripts/package-json-check.sh
echo "${CYAN}Running yarn verify-commit${NC}"
yarn verify-commit