Skip to content

Commit

Permalink
feat: add git hooks to project
Browse files Browse the repository at this point in the history
Adds pre-push and pre-commit hooks
Closes #11
  • Loading branch information
rfgvieira committed Jun 26, 2024
1 parent 2c440ab commit 395b40e
Show file tree
Hide file tree
Showing 6 changed files with 6,024 additions and 4,809 deletions.
3 changes: 3 additions & 0 deletions backend/pre-push
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env sh

#TODO: pre-pushes python test
2 changes: 2 additions & 0 deletions dashboard/.husky/_/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
h
husky.sh
3 changes: 3 additions & 0 deletions dashboard/.husky/_/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env sh
cd dashboard && pnpm lint
pnpm pycommit
17 changes: 17 additions & 0 deletions dashboard/.husky/_/pre-push
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/env sh
set -e

REMOTE="$1"
MASTER_REF=${MASTER_REF:-$REMOTE/main}

if ! read LOCAL_REF LOCAL_SHA REMOTE_REF REMOTE_SHA; then
echo "NOTE: nothing to push, nothing to check"
exit 0
fi

if [ "$LOCAL_REF" = "(delete)" ]; then
echo "NOTE: deleting branch, nothing to check"
exit 0
fi

cd dashboard && pnpm pypush
6 changes: 5 additions & 1 deletion dashboard/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@
"storybook": "storybook dev -p 6006",
"build-storybook": "storybook build",
"lint": "eslint **/*.tsx **/*.ts --report-unused-disable-directives --max-warnings 0",
"preview": "vite preview"
"preview": "vite preview",
"prepare": "cd .. && husky dashboard/.husky",
"pycommit": "cd .. && cd backend && sh pre-commit",
"pypush": "cd .. && cd backend && sh pre-push"
},
"dependencies": {
"@emotion/react": "^11.11.4",
Expand Down Expand Up @@ -46,6 +49,7 @@
"eslint-plugin-react-hooks": "^4.6.2",
"eslint-plugin-react-refresh": "^0.4.7",
"eslint-plugin-storybook": "^0.8.0",
"husky": "^9.0.11",
"postcss": "^8.4.38",
"storybook": "^8.1.10",
"tailwindcss": "^3.4.4",
Expand Down
Loading

0 comments on commit 395b40e

Please sign in to comment.