Skip to content

Commit 3b165be

Browse files
committed
fix(git hooks): fixed git hooks for husky
1 parent 351004b commit 3b165be

File tree

3 files changed

+20
-1
lines changed

3 files changed

+20
-1
lines changed

.husky/pre-commit

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/usr/bin/env sh
2+
. "$(dirname -- "$0")/_/husky.sh"
3+
4+
# Run the custom pre-commit script
5+
./.githooks/pre-commit

.husky/pre-push

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/usr/bin/env sh
2+
. "$(dirname -- "$0")/_/husky.sh"
3+
4+
# Run the custom pre-push script
5+
./.githooks/pre-push

Makefile

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,15 @@ setup-git-hooks:
55
chmod +x .git/hooks/pre-commit && chmod +x .git/hooks/pre-push && chmod +x .git/hooks/prepare-commit-msg && chmod +x .git/hooks/commit-msg
66
@echo "SUCCESS: Git hooks installed!"
77

8+
# Setup Husky hooks (called automatically by npm install)
9+
setup-husky-hooks:
10+
@echo "SETUP: Setting up Husky integration..."
11+
@mkdir -p .husky
12+
@echo '#!/usr/bin/env sh\n. "$$(dirname -- "$$0")/_/husky.sh"\n\n# Run the custom pre-commit script\n./.githooks/pre-commit' > .husky/pre-commit
13+
@echo '#!/usr/bin/env sh\n. "$$(dirname -- "$$0")/_/husky.sh"\n\n# Run the custom pre-push script\n./.githooks/pre-push' > .husky/pre-push
14+
@chmod +x .husky/pre-commit .husky/pre-push
15+
@echo "SUCCESS: Husky hooks configured!"
16+
817
# Install Node.js dependencies for commit tools
918
install-commit-tools:
1019
@echo "SETUP: Installing commit tools..."
@@ -22,7 +31,7 @@ validate-commit:
2231
npm run lint:commit
2332

2433
# Setup complete development environment
25-
setup-dev: install-commit-tools setup-git-hooks
34+
setup-dev: install-commit-tools setup-husky-hooks
2635
@echo "SUCCESS: Development environment setup complete!"
2736
@echo ""
2837
@echo "🎉 You're all set! Use the following commands:"

0 commit comments

Comments
 (0)