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
36 changes: 35 additions & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1 +1,35 @@
# 커밋 메시지는 commit-msg 훅에서 검증됩니다
echo "🔍 Running CI parity checks before commit..."

CHANGED_FILES=$(git diff --cached --name-only)
RUN_WEB=0
RUN_ADMIN=0

for FILE in $CHANGED_FILES; do
case "$FILE" in
apps/web/*)
RUN_WEB=1
;;
apps/admin/*)
RUN_ADMIN=1
;;
package.json|pnpm-lock.yaml|pnpm-workspace.yaml|turbo.json|.github/workflows/*)
RUN_WEB=1
RUN_ADMIN=1
;;
esac
done

if [ "$RUN_WEB" -eq 1 ]; then
pnpm --filter @solid-connect/web run ci:check
fi

if [ "$RUN_ADMIN" -eq 1 ]; then
pnpm --filter @solid-connect/admin run lint
pnpm --filter @solid-connect/admin run format
fi

if [ "$RUN_WEB" -eq 0 ] && [ "$RUN_ADMIN" -eq 0 ]; then
echo "ℹ️ No CI-targeted changes detected; skipping parity checks."
fi

echo "✅ CI parity checks passed!"
49 changes: 46 additions & 3 deletions .husky/pre-push
Original file line number Diff line number Diff line change
@@ -1,4 +1,47 @@
echo "🔍 Running type check before push..."
pnpm run typecheck
echo "🏗️ Running CI parity builds before push..."

echo "✅ All checks passed!"
UPSTREAM=$(git rev-parse --abbrev-ref --symbolic-full-name "@{upstream}" 2>/dev/null || true)

if [ -n "$UPSTREAM" ]; then
CHANGED_FILES=$(git diff --name-only "$UPSTREAM"...HEAD)
else
BASE_BRANCH="origin/main"
MERGE_BASE=$(git merge-base HEAD "$BASE_BRANCH" 2>/dev/null || true)
if [ -n "$MERGE_BASE" ]; then
CHANGED_FILES=$(git diff --name-only "$MERGE_BASE"...HEAD)
else
CHANGED_FILES=$(git diff --name-only HEAD~1..HEAD)
fi
fi

RUN_WEB=0
RUN_ADMIN=0

for FILE in $CHANGED_FILES; do
case "$FILE" in
apps/web/*)
RUN_WEB=1
;;
apps/admin/*)
RUN_ADMIN=1
;;
package.json|pnpm-lock.yaml|pnpm-workspace.yaml|turbo.json|.github/workflows/*)
RUN_WEB=1
RUN_ADMIN=1
;;
esac
done

if [ "$RUN_WEB" -eq 1 ]; then
NODE_ENV=production pnpm --filter @solid-connect/web run build
fi

if [ "$RUN_ADMIN" -eq 1 ]; then
NODE_ENV=production pnpm --filter @solid-connect/admin run build
fi

if [ "$RUN_WEB" -eq 0 ] && [ "$RUN_ADMIN" -eq 0 ]; then
echo "ℹ️ No CI-targeted changes detected; skipping parity builds."
fi

echo "✅ CI parity builds passed!"
13 changes: 12 additions & 1 deletion docs/development-workflow.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,18 @@ feat : 로그인 업데이트 # ❌ 콜론 앞에 공백

#### pre-commit

현재는 비활성화 상태입니다. 필요시 린트 검사 등을 추가할 수 있습니다.
- 커밋 전 GitHub CI 품질 검사와 동일한 체크를 실행합니다.
- 실행 명령:
- `pnpm --filter @solid-connect/web run ci:check`
- `pnpm --filter @solid-connect/admin run lint`
- `pnpm --filter @solid-connect/admin run format`

#### pre-push

- 푸시 전 GitHub CI 빌드 단계와 동일한 빌드를 실행합니다.
- 실행 명령:
- `pnpm --filter @solid-connect/web run build`
- `pnpm --filter @solid-connect/admin run build`

### Hooks가 동작하지 않는 경우

Expand Down