Separating server and client for reasons ...
This commit is contained in:
43
justfile
43
justfile
@@ -1,5 +1,7 @@
|
||||
# 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:
|
||||
@@ -7,10 +9,20 @@ default:
|
||||
|
||||
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"
|
||||
@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" isolated/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" isolated/simplecli/main.go
|
||||
|
||||
|
||||
# Run tests with short output
|
||||
test:
|
||||
@@ -21,12 +33,12 @@ test:
|
||||
# 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 ./...
|
||||
@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/coverage.out -o _build/coverage.html
|
||||
@echo "Coverage report generated: _build/coverage.html"
|
||||
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:
|
||||
@@ -34,17 +46,8 @@ watch:
|
||||
@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
|
||||
rm -rf {{ build_path }}
|
||||
@echo "Clean complete"
|
||||
Reference in New Issue
Block a user