Expend justfile functions

Signed-off-by: Asai Neko <sugar@sne.moe>
This commit is contained in:
2025-12-28 16:22:28 +08:00
parent af66dc6155
commit 7d76b85055

View File

@@ -7,7 +7,9 @@ exec_path := join(output_dir, project_name)
go_cmd := `realpath $(which go)` go_cmd := `realpath $(which go)`
bun_cmd := `realpath $(which bun)` bun_cmd := `realpath $(which bun)`
default: install clean build run default: install clean build-back build-client run-back
backend: install clean build-back run-back
install: install:
cd {{ client_dir }} && {{ bun_cmd }} install cd {{ client_dir }} && {{ bun_cmd }} install
@@ -17,12 +19,17 @@ clean:
mkdir -p {{ output_dir }} mkdir -p {{ output_dir }}
cp {{ join(project_dir, "config.default.yaml") }} {{ join(output_dir, "config.yaml") }} cp {{ join(project_dir, "config.default.yaml") }} {{ join(output_dir, "config.yaml") }}
build: client-dev:
{{ go_cmd }} build -o {{ exec_path }}{{ if os() == "windows" { ".exe" } else { "" } }} {{ server_enrty }} cd {{ client_dir }} && {{ bun_cmd }} dev
build-client:
cd {{ client_dir }} && {{ bun_cmd }} run build --outDir {{ join(output_dir, "static") }} cd {{ client_dir }} && {{ bun_cmd }} run build --outDir {{ join(output_dir, "static") }}
run: build-back:
{{ go_cmd }} build -o {{ exec_path }}{{ if os() == "windows" { ".exe" } else { "" } }} {{ server_enrty }}
run-back:
cd {{ output_dir }} && CONFIG_PATH={{ output_dir }} {{ exec_path }}{{ if os() == "windows" { ".exe" } else { "" } }} cd {{ output_dir }} && CONFIG_PATH={{ output_dir }} {{ exec_path }}{{ if os() == "windows" { ".exe" } else { "" } }}
test: test-back:
cd {{ output_dir }} && CONFIG_PATH={{ output_dir }} GO_ENV=test go test -C .. ./... cd {{ output_dir }} && CONFIG_PATH={{ output_dir }} GO_ENV=test go test -C .. ./...