Files
gotes/justfile
2026-03-22 19:35:12 +00:00

53 lines
1.6 KiB
Makefile

# Use 'just <command>' to run tasks
build_path := "_build"
server_exec_name := "server"
simplecli_exec_name := "simplecli"
# Default recipe (runs when you just type 'just')
default:
@just --list
build: clean
@echo "Building notes..."
@mkdir -p {{ build_path }}
@just build-server
@just build-simplecli
build-server:
@echo "Building the isolated server..."
@rm -f {{ build_path }}/{{ server_exec_name }}
go build -o {{ build_path }}/{{ server_exec_name }} -ldflags="-s -w" cmd/server/main.go
build-simplecli:
@echo "Building the simple cli..."
@rm -f {{ build_path }}/{{ simplecli_exec_name }}
go build -o {{ build_path }}/{{ simplecli_exec_name }} -ldflags="-s -w" cmd/simplecli/main.go
# Run tests with short output
test:
@echo "Running tests..."
go test --short ./...
@echo "Tests complete"
# Run tests with coverage
test-coverage:
@echo "Running tests with coverage..."
@mkdir -p {{ build_path }}
@rm -f {{ build_path }}/coverage.out
go test -v -coverprofile={{ build_path }}/coverage.out ./...
@echo "Generate HTML report"
go tool cover -html={{ build_path }}/coverage.out -o {{ build_path }}/coverage.html
@echo "Coverage report generated: {{ build_path }}/coverage.html"
# Watch for changes and run tests automatically
watch:
@echo "Watching for changes..."
@command -v watchexec >/dev/null 2>&1 || (echo "Error: watchexec not installed. Install with: brew install watchexec" && exit 1)
@watchexec --clear --exts go -- sh -c 'echo "Changes detected, running tests..." && just test'
# Clean build artifacts
clean:
@echo "Cleaning build artifacts..."
rm -rf {{ build_path }}
@echo "Clean complete"