From 89853e3582e837669a3b0598cde50b476e455132 Mon Sep 17 00:00:00 2001 From: Micheal Wilkinson Date: Tue, 17 Mar 2026 23:01:30 +0000 Subject: [PATCH] Adding justfile --- .gitignore | 2 ++ justfile | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 .gitignore create mode 100644 justfile diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..7b421b9 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +_build/* +.DS_Store \ No newline at end of file diff --git a/justfile b/justfile new file mode 100644 index 0000000..abe8382 --- /dev/null +++ b/justfile @@ -0,0 +1,49 @@ +# Use 'just ' 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" \ No newline at end of file