Adding justfile

This commit is contained in:
Micheal Wilkinson
2026-03-17 23:01:30 +00:00
parent 6a1eabf525
commit 89853e3582
2 changed files with 51 additions and 0 deletions

49
justfile Normal file
View File

@@ -0,0 +1,49 @@
# 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" .
@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"