mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-10-29 00:42:30 +00:00
feat: add pre-commit hook setup script
- Add `scripts/setup-pre-commit.sh` to install a git pre-commit hook. - The hook runs `npm run lint` and `npm run build:css` to enforce quality and build consistency. - Update `CONTRIBUTING.md` to document the new hook setup under Development Setup.
This commit is contained in:
1 parent
2f8a4b44f5
commit
ce5ca30a03
2 files changed
+44
No files matched your search
Executable
+38
@@ -0,0 +1,38 @@
|
||||
#!/bin/bash
|
||||
|
||||
HOOK_FILE=".git/hooks/pre-commit"
|
||||
|
||||
if [ ! -d ".git" ]; then
|
||||
echo "Error: .git directory not found. This script must be run from the repository root."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Setting up pre-commit hook at $HOOK_FILE..."
|
||||
|
||||
cat > "$HOOK_FILE" << 'EOF'
|
||||
#!/bin/sh
|
||||
# pre-commit hook to run lint and build checks
|
||||
|
||||
echo "Running pre-commit checks..."
|
||||
|
||||
# Run lint
|
||||
echo "Running lint..."
|
||||
npm run lint
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Lint failed. Please fix errors before committing."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Run CSS build to ensure consistency
|
||||
echo "Running CSS build..."
|
||||
npm run build:css
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "CSS build failed. Please fix errors before committing."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Pre-commit checks passed."
|
||||
EOF
|
||||
|
||||
chmod +x "$HOOK_FILE"
|
||||
echo "Pre-commit hook installed successfully."
|
||||
Reference in new issue
Block a user