Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
104 lines (91 loc) · 3.73 KB
/
Copy pathMakefile
File metadata and controls
104 lines (91 loc) · 3.73 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
# Elsewise: cross-toolchain entry point (pnpm + flutter).
# Run `make` or `make help` for the target listing.
BLUE := \033[0;34m
GREEN := \033[0;32m
RED := \033[0;31m
BOLD := \033[1m
RESET := \033[0m
TOOLS := tools
# The starter plugin is its own pnpm workspace, which `pnpm -r` from the root does not see.
STARTER := plugins/starter
BUF := pnpm --filter @elsewise/transport exec buf
PROTO := ../../../proto
.DEFAULT_GOAL := help
.PHONY: help doctor bootstrap bs install i generate g icons lint l fix f test t
help:
@echo "$(BOLD)Elsewise$(RESET) - make targets"
@echo " $(BOLD)doctor$(RESET) check required toolchains are installed"
@echo " $(BOLD)bootstrap$(RESET) (bs) doctor + install every toolchain's deps + generate"
@echo " $(BOLD)install$(RESET) (i) pnpm + flutter pub get"
@echo " $(BOLD)generate$(RESET) (g) protobuf TS bindings (every package with a generate script)"
@echo " $(BOLD)icons$(RESET) resolve icon tints + emit the file-icon tables and assets into packages/components"
@echo " $(BOLD)lint$(RESET) (l) biome + tsc (every package) + buf + dart analyze"
@echo " $(BOLD)fix$(RESET) (f) auto-fix what lint checks (biome, buf format, dart format)"
@echo " $(BOLD)test$(RESET) (t) vitest (every package) + flutter test (golden sheets)"
@echo ""
doctor:
@ok=1; \
for tool in \
"pnpm|--version|corepack enable pnpm (or: npm install -g pnpm)" \
"flutter|--version|https://docs.flutter.dev/install (tools/ is a Flutter package: >= 3.47.0)" \
"dart|--version|ships with the Flutter SDK; make sure its bin/ is on PATH"; do \
name=$${tool%%|*}; rest=$${tool#*|}; args=$${rest%%|*}; hint=$${rest#*|}; \
if $$name $$args >/dev/null 2>&1 </dev/null; then \
printf "$(GREEN)✓$(RESET) %s\n" "$$name"; \
else \
printf "$(RED)✗ %-7s$(RESET) missing — %s\n" "$$name" "$$hint"; ok=0; \
fi; \
done; \
if [ $$ok -eq 1 ]; then \
echo "$(GREEN)✓ all toolchains present$(RESET)"; \
else \
echo ""; \
echo "$(RED)Install the missing tools above, then re-run.$(RESET)"; \
exit 1; \
fi
bootstrap bs: doctor install generate
@echo "$(GREEN)✓ bootstrap complete$(RESET)"
install i:
@echo "$(BLUE)pnpm install$(RESET)"
@pnpm install
@echo "$(BLUE)cd $(STARTER) && pnpm install$(RESET)"
@cd $(STARTER) && pnpm install
@echo "$(BLUE)cd $(TOOLS) && flutter pub get$(RESET)"
@cd $(TOOLS) && flutter pub get
@echo "$(GREEN)✓ dependencies installed$(RESET)"
generate g:
@echo "$(BLUE)pnpm -r generate$(RESET)"
@pnpm -r generate
@echo "$(GREEN)✓ generated$(RESET)"
icons:
@echo "$(BLUE)cd $(TOOLS) && dart run bin/file-icons/emit_typescript_icons.dart$(RESET)"
@cd $(TOOLS) && dart run bin/file-icons/emit_typescript_icons.dart
@echo "$(GREEN)✓ icons emitted$(RESET)"
lint l:
@echo "$(BLUE)pnpm -r check$(RESET)"
@pnpm -r check
@echo "$(BLUE)pnpm -r typecheck$(RESET)"
@pnpm -r typecheck
@echo "$(BLUE)cd $(STARTER) && pnpm check && pnpm typecheck$(RESET)"
@cd $(STARTER) && pnpm check && pnpm typecheck
@echo "$(BLUE)buf lint proto$(RESET)"
@$(BUF) lint $(PROTO)
@echo "$(BLUE)buf format --diff --exit-code proto$(RESET)"
@$(BUF) format --diff --exit-code $(PROTO)
@echo "$(BLUE)cd $(TOOLS) && dart analyze$(RESET)"
@cd $(TOOLS) && dart analyze
@echo "$(GREEN)✓ lint clean$(RESET)"
fix f:
@echo "$(BLUE)pnpm -r exec biome check --write$(RESET)"
@pnpm -r exec biome check --write
@echo "$(BLUE)buf format -w proto$(RESET)"
@$(BUF) format -w $(PROTO)
@echo "$(BLUE)cd $(TOOLS) && dart format .$(RESET)"
@cd $(TOOLS) && dart format .
@echo "$(GREEN)✓ fixes applied$(RESET)"
test t:
@echo "$(BLUE)pnpm -r test$(RESET)"
@pnpm -r test
@echo "$(BLUE)cd $(TOOLS) && flutter test$(RESET)"
@cd $(TOOLS) && flutter test
@echo "$(GREEN)✓ tests passed$(RESET)"