Skip to content

Commit

Permalink
Sets husky pre-push hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
sedatbasar committed Jul 4, 2024
1 parent 3aa6cf8 commit 12a36e4
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 1 deletion.
1 change: 1 addition & 0 deletions {{cookiecutter.project_slug}}/frontend/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
IS_PRE_PUSH_HOOKS_ENABLED=true
1 change: 1 addition & 0 deletions {{cookiecutter.project_slug}}/frontend/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ yarn-error.log*

# local env files
.env*.local
.env

# vercel
.vercel
Expand Down
9 changes: 9 additions & 0 deletions {{cookiecutter.project_slug}}/frontend/.husky/pre-push
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
cd frontend
if test -f ./.env; then
source ./.env
if [ "$IS_PRE_PUSH_HOOKS_ENABLED" = "true" ] || [ "$IS_PRE_PUSH_HOOKS_ENABLED" = "1" ]; then
npm run format-check
npm run lint-src
npm run typecheck
fi
fi
6 changes: 6 additions & 0 deletions {{cookiecutter.project_slug}}/frontend/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,9 @@ To learn more about Next.js, take a look at the following resources:
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!

Check out the official [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.

## Environment Variables

| Variable Name | Explanation |
|-----------------------------|--------------------------------------------------|
| IS_PRE_PUSH_HOOKS_ENABLED | Controls husky pre-push hooks for frontend folder|
16 changes: 16 additions & 0 deletions {{cookiecutter.project_slug}}/frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion {{cookiecutter.project_slug}}/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
"format-check": "prettier --check .",
"test": "vitest --run",
"test-watch": "vitest",
"typecheck": "tsc --noEmit"
"typecheck": "tsc --noEmit",
"prepare": "cd .. && husky frontend/.husky"
},
"dependencies": {
"@typescript-eslint/eslint-plugin": "^7.14.1",
Expand All @@ -32,6 +33,7 @@
"eslint-config-next": "14.2.4",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-jsx-a11y": "^6.9.0",
"husky": "^9.0.11",
"jsdom": "^24.1.0",
"postcss": "^8",
"prettier": "^3.3.2",
Expand Down

0 comments on commit 12a36e4

Please sign in to comment.