Files
gotes/justfile
2026-03-18 00:44:37 +00:00

50 lines
1.3 KiB
Makefile

# Use 'just <command>' to run tasks
# Default recipe (runs when you just type 'just')
default:
@just --list
build: clean
@echo "Building notes..."
@mkdir -p _build
go build -o _build/notes -ldflags="-s -w" .
chmod +x ./_build/notes
@echo "Build complete: ./_build/notes"
# 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
@rm -f _build/coverage.out
go test -v -coverprofile=_build/coverage.out ./...
@echo "Generate HTML report"
go tool cover -html=_build/coverage.out -o _build/coverage.html
@echo "Coverage report generated: _build/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'
# Run the server
run:
@echo "Starting notes server..."
go run . --server
# Run the built binary
run-binary: build
./_build/notes --server
# Clean build artifacts
clean:
@echo "Cleaning build artifacts..."
rm -rf _build
@echo "Clean complete"