-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
115 lines (90 loc) · 4.62 KB
/
Copy pathMakefile
File metadata and controls
115 lines (90 loc) · 4.62 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
.PHONY: init run dev server web desk android ios build check test verify-local clean doctor scan install uninstall help
# ── Default ──────────────────────────────────────────────
help: ## Show available commands
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | \
awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-12s\033[0m %s\n", $$1, $$2}'
# ── Init ─────────────────────────────────────────────────
init: ## Install deps, build backend, init ~/.cloudcode/
@echo "==> Checking prerequisites..."
@command -v cargo >/dev/null 2>&1 || { echo "Error: cargo not found. Install Rust: https://rustup.rs"; exit 1; }
@command -v node >/dev/null 2>&1 || { echo "Error: node not found. Install Node.js 18+"; exit 1; }
@command -v pnpm >/dev/null 2>&1 || { echo "Error: pnpm not found. Install pnpm first."; exit 1; }
@echo "==> Installing cargo-watch (hot-reload)..."
@cargo install cargo-watch --quiet 2>/dev/null || true
@echo "==> Installing frontend dependencies..."
@cd apps/web && pnpm install --silent
@echo "==> Installing desktop dependencies..."
@cd apps/desktop && pnpm install --silent
@echo "==> Building backend..."
@cargo build
@echo "==> Initializing ~/.cloudcode/..."
@cargo run --quiet -- init
@echo "==> Done."
# ── Run (separate or together) ───────────────────────────
server: ## Start backend dev server with hot-reload
@command -v cargo-watch >/dev/null 2>&1 || { echo "cargo-watch not found. Run 'cargo install cargo-watch' first."; exit 1; }
@cargo watch -w src -x 'run -- start'
web: ## Start web dev server
@cd apps/web && pnpm dev
desk: ## Start desktop dev shell
@cd apps/desktop && pnpm tauri:dev
android: ## Start Android dev target
@echo "Android shell placeholder ready at apps/mobile/android"
@echo "Next step: scaffold the actual Android runtime in apps/mobile/android"
ios: ## Start iOS dev target
@echo "iOS shell placeholder ready at apps/mobile/ios"
@echo "Next step: scaffold the actual iOS runtime in apps/mobile/ios"
dev: ## Start backend hot-reload + web dev server
@command -v cargo-watch >/dev/null 2>&1 || { echo "cargo-watch not found. Run 'cargo install cargo-watch' first."; exit 1; }
@trap 'kill 0' INT TERM; \
cargo watch -w src -x 'run -- start' & \
cd apps/web && pnpm dev & \
wait
run: ## Start backend + frontend together
@trap 'kill 0' INT TERM; \
cargo run -- start & \
cd apps/web && pnpm dev & \
wait
# ── Build ────────────────────────────────────────────────
build: ## Build production release
@echo "==> Building backend (release)..."
@cargo build --release
@echo "==> Building frontend..."
@cd apps/web && pnpm build
@echo "==> Build complete."
install: build ## Install to ~/.cloudcode/bin/
@mkdir -p ~/.cloudcode/bin ~/.cloudcode/web
@cp target/release/cloudcode ~/.cloudcode/bin/cloudcode
@cp -r apps/web/dist/ ~/.cloudcode/web/
@echo "Installed to ~/.cloudcode/bin/cloudcode"
@echo "Add to PATH: export PATH=\"\$$HOME/.cloudcode/bin:\$$PATH\""
uninstall: ## Remove ~/.cloudcode/bin/ and ~/.cloudcode/web/
@rm -rf ~/.cloudcode/bin ~/.cloudcode/web
@echo "Uninstalled. Config preserved at ~/.cloudcode/"
# ── Check ────────────────────────────────────────────────
check: ## Type-check backend + frontend
@echo "==> cargo check..."
@cargo check
@echo "==> tsc --noEmit..."
@cd apps/web && pnpm exec tsc --noEmit
@echo "==> All checks passed."
test: ## Run Rust unit and narrow integration tests
@echo "==> cargo test..."
@cargo test
@echo "==> Tests passed."
verify-local: ## Run the default local validation command set
@echo "==> Local validation: make check"
@$(MAKE) check
@echo "==> Local validation: make test"
@$(MAKE) test
@echo "==> Local validation complete."
# ── Clean ────────────────────────────────────────────────
clean: ## Remove build artifacts
@cargo clean
@rm -rf apps/web/dist apps/web/node_modules/.vite
@echo "Cleaned."
# ── Utilities ────────────────────────────────────────────
doctor: ## Run diagnostic checks
@cargo run --quiet -- doctor
scan: ## Scan for installed CLI tools
@cargo run --quiet -- scan