Merge pull request #98 from mcataford/build/pre-commit-check
build(git): add pre-commit to selective format, typecheck
This commit is contained in:
commit
d91d587eae
2 changed files with 20 additions and 0 deletions
|
@ -15,4 +15,8 @@ if [[ -z $BIN_MATCH ]]; then
|
|||
export PATH=$PATH:$BIN_PATH
|
||||
fi
|
||||
|
||||
echo "Adding pre-commit hook"
|
||||
cp ./script/pre-commit ./.git/hooks
|
||||
chmod +x ./.git/hooks/pre-commit
|
||||
|
||||
echo "All done!"
|
||||
|
|
16
script/pre-commit
Executable file
16
script/pre-commit
Executable file
|
@ -0,0 +1,16 @@
|
|||
#!/bin/sh
|
||||
|
||||
TASKS=""
|
||||
|
||||
if [ -n "$(git diff --cached --name-only origin/main -- ./frontend)" ]; then
|
||||
TASKS="$TASKS fe:lint fe:typecheck"
|
||||
fi
|
||||
|
||||
if [ -n "$(git diff --cached --name-only origin/main -- ./backend)" ]; then
|
||||
TASKS="$TASKS be:lint"
|
||||
fi
|
||||
|
||||
if [ -n "$TASKS" ]; then
|
||||
echo "Running $TASKS"
|
||||
task $TASKS
|
||||
fi
|
Reference in a new issue