-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathMakefile
More file actions
132 lines (100 loc) · 4.5 KB
/
Copy pathMakefile
File metadata and controls
132 lines (100 loc) · 4.5 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
# Hexkit — task runner. Run `make` (or `make help`) to list targets.
# Ensure the rustup toolchain is on PATH even in non-login shells.
export PATH := $(HOME)/.cargo/bin:$(PATH)
# Host Rust target — needed so `cargo build --target …` picks the same triple
# Tauri expects for sidecar binaries (e.g. binaries/hexkit-aarch64-apple-darwin).
HOST_TARGET := $(shell rustc -Vv 2>/dev/null | sed -n 's/^host: //p')
SIDECAR_EXT := $(if $(findstring windows,$(HOST_TARGET)),.exe,)
SIDECAR_PATH := src-tauri/binaries/hexkit-cli-$(HOST_TARGET)$(SIDECAR_EXT)
.DEFAULT_GOAL := help
## ----- Setup -----
install: ## Install JS + Rust dependencies
pnpm install
cargo fetch
## ----- Develop -----
dev: cli-sidecar ## Run the desktop app (Tauri, hot-reload)
pnpm tauri dev
web: ## Run the frontend only in a browser (http://localhost:1420)
pnpm dev
watch: ## Run frontend tests in watch mode
pnpm test:watch
## ----- Build -----
build: ## Build the production frontend bundle (tsc + vite)
pnpm build
bundle: cli-sidecar ## Build the distributable desktop app (Tauri installer/app)
pnpm tauri build
# Build a debug-profile .app bundle and "open" it so macOS Launch Services
# registers the `hexkit://` scheme. After running this once you can iterate
# with `make dev` and `hexkit://` URLs (from Raycast, the CLI, anywhere) will
# launch the bundled app — deep links *don't* reach the raw `tauri dev`
# binary because it has no Info.plist for LS to route to.
dev-bundle: cli-sidecar ## Build + register a debug .app so hexkit:// works during dev
pnpm tauri build --debug
@APP=$$(ls -dt src-tauri/target/debug/bundle/macos/*.app 2>/dev/null | head -1); \
if [ -z "$$APP" ]; then \
echo "error: no .app bundle was produced" >&2; exit 1; \
fi; \
echo "Registering $$APP with Launch Services…"; \
/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -f "$$APP"; \
open "$$APP"; \
echo; \
echo "Done. Try: open 'hexkit://json.format?input=%7B%22a%22%3A1%7D'"
cli: ## Build the headless `hexkit` CLI (release)
cargo build --release -p hexkit-cli
@echo "Built target/release/hexkit"
cli-sidecar: ## Build and stage the CLI sidecar Tauri bundles into the app
@cargo build --release -p hexkit-cli --target $(HOST_TARGET)
@mkdir -p src-tauri/binaries
@cp target/$(HOST_TARGET)/release/hexkit$(SIDECAR_EXT) $(SIDECAR_PATH)
@echo "Sidecar staged: $(SIDECAR_PATH)"
## ----- Test -----
test: test-rust test-web ## Run all tests (Rust + frontend)
test-rust: cli-sidecar ## Run the Rust workspace tests
cargo test --workspace
test-web: ## Run the frontend (Vitest) tests
pnpm test
coverage: ## Run frontend tests with a coverage report
pnpm test:coverage
## ----- Quality -----
check: typecheck lint test build ## Full gate: typecheck, lint, tests, build
typecheck: ## Type-check the frontend (tsc --noEmit)
pnpm typecheck
lint: cli-sidecar ## Lint Rust with clippy (warnings = errors)
cargo clippy --workspace --all-targets -- -D warnings
fmt: ## Format Rust code (cargo fmt)
cargo fmt --all
fmt-check: ## Verify Rust formatting without writing
cargo fmt --all --check
## ----- Release -----
# Bump the version in Cargo workspace + tauri.conf.json + package.json.
# Usage: make bump VERSION=0.2.0
bump: ## Bump every version-of-record (VERSION=X.Y.Z)
@if [ -z "$(VERSION)" ]; then \
echo "error: VERSION is required, e.g. make bump VERSION=0.2.0"; exit 2; \
fi
@node scripts/bump.mjs $(VERSION)
# Full release flow: bump, gate, commit, tag, push.
# Usage: make release VERSION=0.2.0
release: ## Bump + run gate + commit + tag + push (VERSION=X.Y.Z)
@if [ -z "$(VERSION)" ]; then \
echo "error: VERSION is required, e.g. make release VERSION=0.2.0"; exit 2; \
fi
@node scripts/bump.mjs $(VERSION)
@$(MAKE) check
@git add Cargo.toml Cargo.lock src-tauri/tauri.conf.json package.json CHANGELOG.md
@git commit -m "chore: release v$(VERSION)"
@git tag -a "v$(VERSION)" -m "Hexkit v$(VERSION)"
@echo
@echo "Tagged v$(VERSION). To publish, push both:"
@echo " git push origin $$(git rev-parse --abbrev-ref HEAD)"
@echo " git push origin v$(VERSION)"
## ----- Maintenance -----
clean: ## Remove build artifacts (target, dist, coverage)
cargo clean
rm -rf dist coverage
help: ## Show this help
@grep -hE '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) \
| awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-12s\033[0m %s\n", $$1, $$2}'
.PHONY: install dev web watch build bundle dev-bundle cli cli-sidecar test \
test-rust test-web coverage check typecheck lint fmt fmt-check bump \
release clean help