-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
67 lines (48 loc) · 1.54 KB
/
Makefile
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
########################################## local dev
.PHONY: local
local: run dist ## compiles/bundles all code, starts the rust server
@echo "success! visit the site in the browser at https://127.0.0.1:3000!"
########################################## docker
.PHONY: up
up: dist ## run the docker environment locally
@docker-compose up -d
.PHONY: up
down:
@docker-compose down
########################################## rust server
.PHONY: build
build: ## compile the rust server binary
@cargo build
.PHONY: run
run: ## run the rust app server locally
@cargo run
.PHONY: lint
lint: ## lint the rust code
@cargo fmt
.PHONY: test
test: lint ## run rust tests
@cargo test
.PHONY: release
release: ## compile a release build
@cargo build --release
.PHONY: check
check: ## verify the rust server bin is able to be compiled
@echo "checking server binary..."
@cargo check
@echo "checking pterm lib..."
@cd web/pterm && cargo check
.PHONY: watch
watch: ## run the hot-reload server for the rust backend
@systemfd --no-pid -s http::3000 -- cargo watch -x run
########################################## frontend ops
web/package.json:
@npm install -C web
.PHONY: dist
dist: web/package.json ## build and bundle all assets (js, css, html)
@rm -rf dist
@npm --prefix web run build
########################################## utils
.PHONY: help
help: ## lists some available makefile commands
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
.DEFAULT_GOAL := help