-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlefthook.yml
More file actions
55 lines (53 loc) · 1.91 KB
/
lefthook.yml
File metadata and controls
55 lines (53 loc) · 1.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
pre-commit:
parallel: true
commands:
lint:
glob: "*.{ts,vue}"
run: pnpm lint:fix {staged_files}
stage_fixed: true
fmt:
glob: "*.{ts,vue,css,json}"
run: pnpm fmt {staged_files}
stage_fixed: true
pre-push:
parallel: true
commands:
test:
run: pnpm test:unit
build:
run: pnpm build
post-checkout:
commands:
worktree-env:
run: |
# Skip if not a worktree
if [ ! -f ".git" ]; then exit 0; fi
# Skip if in a rebase
GIT_DIR=$(git rev-parse --git-dir 2>/dev/null)
if [ -d "$GIT_DIR/rebase-merge" ] || [ -d "$GIT_DIR/rebase-apply" ]; then exit 0; fi
MAIN_REPO=$(git rev-parse --path-format=absolute --git-common-dir 2>/dev/null | sed 's|/\.git$||')
if [ -f "$MAIN_REPO/.env" ]; then
cp "$MAIN_REPO/.env" .env
echo "✓ .env copied from main repo"
elif [ -f "$MAIN_REPO/.env.local" ]; then
cp "$MAIN_REPO/.env.local" .env.local
echo "✓ .env.local copied from main repo"
fi
worktree-setup:
run: |
# Skip if not a worktree
if [ ! -f ".git" ]; then exit 0; fi
# Skip if in a rebase
GIT_DIR=$(git rev-parse --git-dir 2>/dev/null)
if [ -d "$GIT_DIR/rebase-merge" ] || [ -d "$GIT_DIR/rebase-apply" ]; then exit 0; fi
# Ensure node is in PATH (nvm doesn't load in non-interactive shells)
NVM_DIR="${NVM_DIR:-$HOME/.nvm}"
if [ -d "$NVM_DIR/versions/node" ]; then
NODE_PATH=$(ls -d "$NVM_DIR/versions/node"/v* 2>/dev/null | sort -V | tail -1)
[ -n "$NODE_PATH" ] && export PATH="$NODE_PATH/bin:$PATH"
fi
export PATH="$HOME/Library/pnpm:$HOME/.local/share/pnpm:$HOME/.corepack/bin:$PATH"
echo "Running pnpm install..."
pnpm install --frozen-lockfile 2>/dev/null || pnpm install || true
echo "Running db:migrate..."
pnpm db:migrate || true