generated from block/oss-project-template
-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathjustfile
More file actions
132 lines (111 loc) · 3.61 KB
/
justfile
File metadata and controls
132 lines (111 loc) · 3.61 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
# Builderbot Monorepo
# Run `just setup` once after cloning.
#
# Common flows:
# just dev # Start Staged
# just dev differ # Start Differ
# just app staged ci # Run any app recipe
# just check # Full non-modifying checks
# Default: list available recipes
default:
@just --list
# ============================================================================
# Setup
# ============================================================================
# First-time setup
setup:
lefthook install
pnpm install
# ============================================================================
# App Delegation
# ============================================================================
# List app workspaces that expose a justfile
apps:
#!/usr/bin/env bash
set -euo pipefail
for dir in apps/*/; do
[[ -f "$dir/justfile" ]] || continue
basename "$dir"
done
# Run a recipe in a specific app (e.g. `just app staged dev`)
app name recipe="dev" *args:
#!/usr/bin/env bash
set -euo pipefail
app_justfile="apps/{{name}}/justfile"
if [[ ! -f "$app_justfile" ]]; then
echo "Unknown app '{{name}}'. Available apps:"
for dir in apps/*/; do
[[ -f "$dir/justfile" ]] || continue
echo " - $(basename "$dir")"
done
exit 1
fi
just -f "$app_justfile" {{recipe}} {{args}}
# Human-friendly shortcuts (supports `just dev differ` style)
dev app="staged" *args:
just app {{app}} dev {{args}}
# Convenience aliases
staged recipe="dev" *args:
just app staged {{recipe}} {{args}}
differ recipe="dev" *args:
just app differ {{recipe}} {{args}}
# ============================================================================
# Cross-Cutting
# ============================================================================
# Format all apps + crates
fmt:
#!/usr/bin/env bash
set -euo pipefail
cargo fmt --all
for dir in apps/*/; do
[[ -f "$dir/justfile" ]] || continue
recipes="$(just -f "$dir/justfile" --summary)"
if echo "$recipes" | tr ' ' '\n' | grep -qx "fmt"; then
just -f "$dir/justfile" fmt
fi
done
# Lint everything
lint:
#!/usr/bin/env bash
set -euo pipefail
cargo clippy --workspace -- -D warnings
for dir in apps/*/; do
[[ -f "$dir/justfile" ]] || continue
recipes="$(just -f "$dir/justfile" --summary)"
if echo "$recipes" | tr ' ' '\n' | grep -qx "lint"; then
just -f "$dir/justfile" lint
fi
done
# Verify everything without modifying files (CI-friendly)
check:
#!/usr/bin/env bash
set -euo pipefail
cargo fmt --all --check
cargo clippy --workspace -- -D warnings
for dir in apps/*/; do
[[ -f "$dir/justfile" ]] || continue
recipes="$(just -f "$dir/justfile" --summary)"
if echo "$recipes" | tr ' ' '\n' | grep -qx "ci"; then
just -f "$dir/justfile" ci
elif echo "$recipes" | tr ' ' '\n' | grep -qx "check"; then
just -f "$dir/justfile" check
fi
done
cargo test --workspace
# Alias: many people expect `just ci`
ci: check
# ============================================================================
# Crates
# ============================================================================
# Build shared crates
build:
cargo build
# Run all tests
test:
cargo test --workspace
# Install the summarize binary
install-summarize:
cargo install --path crates/summarize
# Run summarize directly (e.g. `just summarize --prompt "What?" src/`)
summarize *args:
cargo run --release -p summarize -- {{args}}