Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 24 additions & 4 deletions .husky/_/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,39 @@ exists() { [ -e "$1" ]; }
echo "[pre-commit] lint-staged"
npx --no-install lint-staged

# Preventing prettier errors
npm run format
echo "[pre-commit] prettier check (root)"
if ! npm run -s format:check; then
echo "[pre-commit] applying prettier fixes (root)"
npm run -s format
git add -A
echo "[pre-commit] formatting applied. commit again."
exit 1
fi

if exists apps/frontend/package.json; then
echo "[pre-commit] frontend"
npm run -s precommit:frontend || exit 1
if ! npm --prefix apps/frontend run -s precommit; then
echo "[pre-commit] frontend precommit failed → running format"
npm --prefix apps/frontend run -s format || true
git add -A
echo "[pre-commit] frontend fixed. commit again."
exit 1
fi
else
echo "[pre-commit] skip frontend (missing)"
fi

if exists apps/backend/composer.json; then
echo "[pre-commit] backend"
npm run -s precommit:backend || exit 1
if ! (cd apps/backend && composer run -q precommit); then
echo "[pre-commit] backend precommit failed → running pint"
(cd apps/backend && php artisan pint) || true
git add -A
echo "[pre-commit] backend fixed. commit again."
exit 1
fi
else
echo "[pre-commit] skip backend (missing)"
fi

echo "[pre-commit] OK"
9 changes: 9 additions & 0 deletions .husky/_/pre-push
Original file line number Diff line number Diff line change
@@ -1,2 +1,11 @@
#!/usr/bin/env sh
set -euo pipefail

echo "[pre-push] format check (root)"
if ! npm run -s format:check; then
echo "[pre-push] applying prettier fixes"
npm run -s format
git add -A
echo "[pre-push] formatting applied. commit and push again."
exit 1
fi
3 changes: 2 additions & 1 deletion apps/backend/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@
"@php artisan test"
],
"precommit": [
"@php artisan config:clear --ansi"
"@php artisan config:clear --ansi",
"@php artisan test"
]
},
"extra": {
Expand Down
5 changes: 5 additions & 0 deletions apps/frontend/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package-lock.json
node_modules
dist
build
coverage
Loading