-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathjustfile
More file actions
164 lines (141 loc) · 4.25 KB
/
justfile
File metadata and controls
164 lines (141 loc) · 4.25 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
workspace_packages := "cipher-kit compress-kit generate-certs get-client-ip modern-cookies @internal/helpers"
public_packages := "cipher-kit compress-kit generate-certs get-client-ip modern-cookies"
example_packages := "express4 express5 nestjs typescript"
_default:
just --list
# ── Workspace ────────────────────────────────────
[group('workspace')]
install:
pnpm install
[group('workspace')]
build target="all":
#!/usr/bin/env bash
set -euo pipefail
if [ "{{ target }}" = "all" ]; then
pnpm turbo run build
else
pnpm --filter {{ target }} build
fi
# ── Verify ───────────────────────────────────────
[group('verify')]
fmt target="all":
#!/usr/bin/env bash
set -euo pipefail
if [ "{{ target }}" = "all" ]; then
pnpm biome format --write .
pnpm exec prettier --write "packages/*/README.md" README.md
else
pnpm --filter {{ target }} exec biome format --write .
fi
[group('verify')]
lint target="all":
#!/usr/bin/env bash
set -euo pipefail
if [ "{{ target }}" = "all" ]; then
pnpm biome lint --fix
else
pnpm --filter {{ target }} exec biome lint --fix .
fi
[group('verify')]
typecheck target="all":
#!/usr/bin/env bash
set -euo pipefail
if [ "{{ target }}" = "all" ]; then
pnpm turbo run typecheck
else
pnpm --filter {{ target }} typecheck
fi
[group('verify')]
test target="all":
#!/usr/bin/env bash
set -euo pipefail
if [ "{{ target }}" = "all" ]; then
pnpm turbo run test
else
pnpm --filter {{ target }} test
fi
[group('verify')]
smoke target="all":
#!/usr/bin/env bash
set -euo pipefail
if [ "{{ target }}" = "all" ]; then
bash scripts/run.sh
else
bash scripts/run.sh {{ target }}
fi
[group('verify')]
attw target="all":
#!/usr/bin/env bash
set -euo pipefail
if [ "{{ target }}" = "all" ]; then
for pkg in {{ public_packages }}; do
pnpm --filter "$pkg" exec attw --pack . --ignore-rules no-resolution
done
exit 0
fi
if [ "{{ target }}" = "@internal/helpers" ]; then
echo "attw is not supported for private package: @internal/helpers"
exit 1
fi
valid=false
for pkg in {{ public_packages }}; do
if [ "$pkg" = "{{ target }}" ]; then
valid=true
break
fi
done
if [ "$valid" != "true" ]; then
echo "Unknown public package: {{ target }}"
echo "Available packages: {{ public_packages }}"
exit 1
fi
pnpm --filter {{ target }} exec attw --pack . --ignore-rules no-resolution
[group('verify')]
verify target="all":
just fmt {{ target }}
just lint {{ target }}
just typecheck {{ target }}
[group('verify')]
full-verify target="all":
just verify {{ target }}
just test {{ target }}
if [ "{{ target }}" != "@internal/helpers" ]; then just attw {{ target }}; fi
if [ "{{ target }}" != "@internal/helpers" ]; then just smoke {{ target }}; fi
# ── Examples ─────────────────────────────────────
[group('examples')]
dev target:
#!/usr/bin/env bash
set -euo pipefail
valid=false
for pkg in {{ example_packages }}; do
if [ "$pkg" = "{{ target }}" ]; then valid=true; break; fi
done
if [ "$valid" != "true" ]; then
echo "Unknown example: {{ target }}"
echo "Available examples: {{ example_packages }}"
exit 1
fi
pnpm --filter "example-{{ target }}" start
# ── Maintenance ──────────────────────────────────
[group('maintenance')]
update target="all":
#!/usr/bin/env bash
set -euo pipefail
if [ "{{ target }}" = "all" ]; then
for pkg in {{ workspace_packages }}; do
echo "Updating packages/$pkg..."
pnpm --filter "$pkg" update --latest
done
echo "Updating root..."
pnpm update --latest
elif [ "{{ target }}" = "root" ]; then
pnpm update --latest
else
pnpm --filter {{ target }} update --latest
fi
pnpm install
[group('maintenance')]
clean:
rm -rf node_modules .turbo
for dir in packages/*; do rm -rf "$dir/dist" "$dir/node_modules" "$dir/.turbo"; done
for dir in examples/*; do rm -rf "$dir/dist" "$dir/node_modules" "$dir/.turbo"; done