Files
nixcn-cms/justfile
Asai Neko 4796653896
All checks were successful
Build Backend (NixCN CMS) TeamCity build finished
Build Frontend (NixCN CMS) TeamCity build finished
Fix jwt middleware
Signed-off-by: Asai Neko <sugar@sne.moe>
2026-01-02 13:17:25 +08:00

41 lines
1.3 KiB
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-back build-client run-back
backend: clean build-back run-back
install:
cd {{ client_dir }} && {{ bun_cmd }} install
clean:
mkdir -p .outputs
find .outputs -mindepth 1 ! -path .outputs/config.yaml -exec rm -rf {} +
client:
cd {{ client_dir }} && {{ bun_cmd }} dev
build-client:
cd {{ client_dir }} && {{ bun_cmd }} run build --outDir {{ join(output_dir, "static") }}
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 { "" } }}
test-back:
cd {{ output_dir }} && CONFIG_PATH={{ output_dir }} GO_ENV=test go test -C .. ./...
dev-back: clean
watchexec -r -e go,yaml,tpl -i '.devenv/**' -i '.direnv/**' -i 'client/**' -i 'vendor/**' 'go build -o {{ join(output_dir, "nixcn-cms") }} . && cd {{ output_dir }} && CONFIG_PATH={{ output_dir }} {{ exec_path }}'
dev:
devenv up --verbose