-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
58 lines (45 loc) · 1.07 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
# SPDX-FileCopyrightText: 2024 caixw
#
# SPDX-License-Identifier: MIT
.PHONY: api gen build-cmd build install init watch-server watch-admin watch test
ROOT = .
DOCS = $(ROOT)/docs
CMD = $(ROOT)/cmd
CMFX = $(ROOT)/cmfx
ADMIN = $(ROOT)/admin
DOC_API = $(DOCS)/api
CMD_SERVER = $(CMD)/server
SERVER_BIN = server
# 生成 API 文件
api:
web restdoc -t=admin,common -o=$(DOC_API)/admin.yaml $(CMFX)
# 生成中间代码
gen:
go generate $(ROOT)/...
# 编译测试项目
build-cmd:
web build -o=$(CMD_SERVER)/$(SERVER_BIN) -v $(CMD_SERVER)
npm run build -w=cmd/admin
# 编译项目内容
build:
npm run build -w=admin
# 安装依赖
install:
go mod download
npm install
# 安装基本数据,依赖 build 生成的测试项目
init:
cd $(CMD_SERVER) && ./server -a=install
watch-server:
web watch -app=-a=serve $(CMD_SERVER)
watch-admin:
npm run dev -w=cmd/admin
# 运行测试内容
#
# 需要采用 -j 执行并行命令,比如:
# make watch -j2
watch: watch-server watch-admin
# 执行测试内容
test:
go test ./... -count=1 -p=1 -parallel=1
npm run test -w=admin