-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjustfile
More file actions
210 lines (167 loc) · 7.49 KB
/
justfile
File metadata and controls
210 lines (167 loc) · 7.49 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
# justfile for positivehelp
# Run `just` to see available commands
# Load .env file for environment variables
set dotenv-load := true
# Use POSIX-compatible shell
set shell := ["sh", "-c"]
# Default recipe: show help
default:
@just --list --unsorted
# ─────────────────────────────────────────────────────────────────────────────
# Development
# ─────────────────────────────────────────────────────────────────────────────
# Install dependencies
install:
pnpm install
# Alias for install
bootstrap: install
# Start development server with Turbopack
dev:
pnpm run dev
# Build for production
build:
pnpm run build
# Start production server (runs migrations first)
start:
pnpm run start
# ─────────────────────────────────────────────────────────────────────────────
# Code Quality
# ─────────────────────────────────────────────────────────────────────────────
# Run linter (Next.js ESLint)
lint:
pnpm run lint
# Format code with Biome
format:
@echo "Formatting code with Biome..."
pnpm exec biome format --write .
# Check formatting without modifying files
format-check:
pnpm exec biome format .
# Lint with Biome (stricter than Next.js lint)
biome-lint:
pnpm exec biome lint .
# Run all Biome checks (lint + format)
biome-check:
pnpm exec biome check .
# Run all Biome checks and apply safe fixes
biome-fix:
pnpm exec biome check --write .
# Type-check a specific file (using Bun for speed)
typecheck file:
pnpm run bun-tsc {{ file }}
# Type-check a specific file (using Node)
typecheck-node file:
pnpm run node-tsc {{ file }}
# ─────────────────────────────────────────────────────────────────────────────
# Testing
# ─────────────────────────────────────────────────────────────────────────────
# Run tests
test:
pnpm run test
# Run tests in watch mode
test-watch:
pnpm run test:watch
# Run tests with coverage
test-coverage:
pnpm exec jest --coverage
# ─────────────────────────────────────────────────────────────────────────────
# Database (Drizzle + Turso)
# ─────────────────────────────────────────────────────────────────────────────
# Generate new migration after schema changes
db-generate:
pnpm run db:generate
# Apply migrations to database
db-migrate:
pnpm run db:migrate
# Reset database to latest migration (DESTRUCTIVE)
db-reset:
@echo "⚠️ This will reset the database. Press Ctrl+C to cancel."
@sleep 2
pnpm run db:reset
# ─────────────────────────────────────────────────────────────────────────────
# Docker
# ─────────────────────────────────────────────────────────────────────────────
# Docker compose file
compose_file := "docker-compose.yml"
# Build Docker image
docker-build:
docker compose -f {{ compose_file }} build
# Start containers in foreground
docker-up:
docker compose -f {{ compose_file }} up
# Start containers in background
docker-up-detached:
docker compose -f {{ compose_file }} up -d
# Stop and remove containers
docker-down:
docker compose -f {{ compose_file }} down
# View container logs
docker-logs:
docker compose -f {{ compose_file }} logs -f
# Rebuild and start containers
docker-rebuild:
docker compose -f {{ compose_file }} up --build
# ─────────────────────────────────────────────────────────────────────────────
# Utilities
# ─────────────────────────────────────────────────────────────────────────────
# Remove build artifacts and caches
clean:
@echo "Cleaning build artifacts..."
rm -rf .next
rm -rf node_modules/.cache
@echo "✓ Clean complete"
# Deep clean (removes node_modules too)
clean-all: clean
@echo "Removing node_modules..."
rm -rf node_modules
@echo "✓ Deep clean complete. Run 'just install' to reinstall."
# Delete a message by ID
delete-message id:
pnpm run delete-message {{ id }}
# Run a quality check before committing (lint + test)
pre-commit: lint test
@echo "✓ Pre-commit checks passed"
# Full CI check (format-check + lint + test + build)
ci: format-check lint test build
@echo "✓ All CI checks passed"
# Canonical aggregate quality gate used by maintenance workflows
check: ci
# Ship current branch after checks, optional tracker close/sync, and push
# Usage:
# just ship "chore(deps): update direct dependencies"
# TASK_ID=positivehelp-123 just ship "chore(repo): apply maintenance updates"
ship message:
@branch=$$(git rev-parse --abbrev-ref HEAD); \
if [ "$$branch" = "main" ] || [ "$$branch" = "master" ]; then \
echo "Refusing to ship from $$branch. Create a feature branch first."; \
exit 1; \
fi
@just check
@if command -v bd >/dev/null 2>&1; then \
if [ -n "$$TASK_ID" ]; then \
bd close "$$TASK_ID"; \
fi; \
bd sync; \
fi
@git add -A
@if git diff --cached --quiet; then \
echo "No staged changes to commit."; \
exit 1; \
fi
@git commit -m "{{ message }}"
@git push -u origin "$$(git rev-parse --abbrev-ref HEAD)"
@echo "✓ Shipped"
# Print exactly one recommended conventional commit ship command
suggest-commit:
@files="$$(git diff --name-only --cached; git diff --name-only)"; \
if [ -z "$$files" ]; then \
echo 'just ship "chore(repo): no changes to commit"'; \
elif echo "$$files" | rg -q '(^|/)(package\.json|pnpm-lock\.yaml|package-lock\.json|yarn\.lock)$$'; then \
echo 'just ship "chore(deps): update direct dependencies"'; \
elif echo "$$files" | rg -q '(^|/)(README\.md|docs/)'; then \
echo 'just ship "docs(repo): update project documentation"'; \
elif echo "$$files" | rg -q '(^|/)(__tests__/|.*\.(test|spec)\.[tj]sx?)'; then \
echo 'just ship "test(repo): improve test coverage"'; \
else \
echo 'just ship "chore(repo): apply maintenance updates"'; \
fi