-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMakefile
More file actions
74 lines (60 loc) · 2.5 KB
/
Makefile
File metadata and controls
74 lines (60 loc) · 2.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
PM := pnpm
.PHONY: help prepare dev build start clean lint format type-check knip check content ignore-content-changes
help:
@printf "%s\n" \
"Targets:" \
" prepare Install deps and hoa-backend" \
" dev Launch the frontend dev server" \
" build Build the frontend" \
" start Start the built frontend (production)" \
" lint Lint frontend" \
" format Format frontend" \
" type-check Run type checks" \
" knip Run knip" \
" check Run lint, format, type checks, and knip" \
" clean Remove node_modules, .next, .source" \
" content Fetch blog and news content" \
" ignore-content-changes Tell Git to ignore local changes under content/ (run once per clone)"
prepare:
$(PM) install
test -d hoa-major-data || git clone https://github.com/HITSZ-OpenAuto/hoa-major-data
@if [ "$$(uname -s)" = "Darwin" ] && [ "$$(uname -m)" = "arm64" ]; then \
echo "Downloading hoa-backend binary for macOS-arm64..."; \
mkdir -p $(HOME)/.cargo/bin; \
curl -L https://github.com/HITSZ-OpenAuto/hoa-backend/releases/latest/download/hoa-backend-macos-arm64.tar.gz | tar -xz -C $(HOME)/.cargo/bin; \
elif [ "$$(uname -s)" = "Linux" ] && [ "$$(uname -m)" = "x86_64" ]; then \
echo "Downloading hoa-backend binary for Linux..."; \
mkdir -p $(HOME)/.cargo/bin; \
curl -L https://github.com/HITSZ-OpenAuto/hoa-backend/releases/latest/download/hoa-backend-linux.tar.gz | tar -xz -C $(HOME)/.cargo/bin; \
else \
cargo install --git https://github.com/HITSZ-OpenAuto/hoa-backend.git; \
fi
curl -o repos_list.txt https://raw.githubusercontent.com/HITSZ-OpenAuto/repos-management/refs/heads/main/repos_list.txt
dev:
$(PM) run dev
build:
$(PM) run build
start:
$(PM) start
lint:
$(PM) run lint --fix
format:
$(PM) run fmt
type-check:
$(PM) run types:check
knip:
$(PM) run knip
check: lint format type-check knip
clean:
rm -rf node_modules .next .source
content:
rm -rf content/blog content/news content/docs
for type in blog news; do \
git clone --depth 1 --filter=blob:none https://github.com/HITSZ-OpenAuto/hoa-$$type temp; \
mv temp/$$type content/$$type; \
rm -rf temp; \
done
hoa-backend --fetch
$(MAKE) ignore-content-changes
ignore-content-changes:
@git ls-files content/ 2>/dev/null | xargs -I {} git update-index --skip-worktree {} 2>/dev/null; echo "Done. Git will ignore local changes under content/."