Adding justfile
This commit is contained in:
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
_build/*
|
||||||
|
.DS_Store
|
||||||
49
justfile
Normal file
49
justfile
Normal 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"
|
||||||
Reference in New Issue
Block a user