Files
nixcn-cms/justfile
2025-12-25 03:01:15 +08:00

28 lines
920 B
Makefile

project_name := "nixcn-cms"
project_dir := justfile_directory()
server_enrty := "main.go"
output_dir := join(project_dir, ".outputs")
client_dir := join(project_dir, "client")
exec_path := join(output_dir, project_name)
go_cmd := `realpath $(which go)`
bun_cmd := `realpath $(which bun)`
default: install clean build run
install:
cd {{ client_dir }} && {{ bun_cmd }} install
clean:
find .outputs -mindepth 1 ! -name config.yaml -exec rm -rf {} +
build:
mkdir -p {{ output_dir }}
{{ go_cmd }} build -o {{ exec_path }}{{ if os() == "windows" { ".exe" } else { "" } }} {{ server_enrty }}
cd {{ client_dir }} && {{ bun_cmd }} run build --outDir {{ join(output_dir, "static") }}
run:
cd {{ output_dir }} && CONFIG_PATH={{ output_dir }} {{ exec_path }}{{ if os() == "windows" { ".exe" } else { "" } }}
test:
cd {{ output_dir }} && CONFIG_PATH={{ output_dir }} GO_ENV=test go test -C .. ./...