.PHONY: help build test clean fmt lint doc check install \
release release-major release-minor release-patch release-dry-run \
publish publish-dry-run version bump changelog
.DEFAULT_GOAL := help
BLUE := \033[34m
GREEN := \033[32m
YELLOW := \033[33m
RED := \033[31m
RESET := \033[0m
help:
@echo ""
@echo "$(BLUE)compress-json-rs$(RESET) - Development and Release Commands"
@echo ""
@echo "$(GREEN)Development:$(RESET)"
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | grep -E "(build|test|clean|fmt|lint|doc|check)" | awk 'BEGIN {FS = ":.*?## "}; {printf " $(YELLOW)%-18s$(RESET) %s\n", $$1, $$2}'
@echo ""
@echo "$(GREEN)Release:$(RESET)"
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | grep -E "(release|publish|version|bump|changelog)" | awk 'BEGIN {FS = ":.*?## "}; {printf " $(YELLOW)%-18s$(RESET) %s\n", $$1, $$2}'
@echo ""
@echo "$(GREEN)Examples:$(RESET)"
@echo " make test Run all tests"
@echo " make release Auto-bump and release"
@echo " make release-minor Release with minor version bump"
@echo " make release-dry-run Preview release without changes"
@echo ""
build:
@echo "$(BLUE)Building...$(RESET)"
cargo build
build-release:
@echo "$(BLUE)Building release...$(RESET)"
cargo build --release
test:
@echo "$(BLUE)Running tests...$(RESET)"
cargo test
test-verbose:
@echo "$(BLUE)Running tests (verbose)...$(RESET)"
cargo test -- --nocapture
clean:
@echo "$(BLUE)Cleaning...$(RESET)"
cargo clean
rm -rf target/doc
fmt:
@echo "$(BLUE)Formatting code...$(RESET)"
cargo fmt
fmt-check:
@echo "$(BLUE)Checking formatting...$(RESET)"
cargo fmt --check
lint:
@echo "$(BLUE)Running clippy...$(RESET)"
cargo clippy -- -D warnings
doc:
@echo "$(BLUE)Generating documentation...$(RESET)"
cargo doc --no-deps --open
doc-build:
@echo "$(BLUE)Building documentation...$(RESET)"
cargo doc --no-deps
check: fmt-check lint test
@echo "$(GREEN)All checks passed!$(RESET)"
install:
@echo "$(BLUE)Installing locally...$(RESET)"
cargo install --path .
version:
@./scripts/get-version.sh
bump:
@./scripts/bump-version.sh auto
bump-major:
@./scripts/bump-version.sh major
bump-minor:
@./scripts/bump-version.sh minor
bump-patch:
@./scripts/bump-version.sh patch
changelog:
@./scripts/changelog.sh
release: check
@echo "$(BLUE)Starting release process...$(RESET)"
@./scripts/release.sh auto
release-major: check
@echo "$(BLUE)Starting major release...$(RESET)"
@./scripts/release.sh major
release-minor: check
@echo "$(BLUE)Starting minor release...$(RESET)"
@./scripts/release.sh minor
release-patch: check
@echo "$(BLUE)Starting patch release...$(RESET)"
@./scripts/release.sh patch
release-dry-run:
@echo "$(BLUE)Release dry run...$(RESET)"
@./scripts/release.sh --dry-run
release-local: check
@echo "$(BLUE)Local release...$(RESET)"
@./scripts/release.sh --no-push --skip-publish
publish:
@echo "$(BLUE)Publishing to crates.io...$(RESET)"
@./scripts/publish.sh
publish-dry-run:
@echo "$(BLUE)Publish dry run...$(RESET)"
@./scripts/publish.sh --dry-run
setup:
@echo "$(BLUE)Setting up development environment...$(RESET)"
@chmod +x scripts/*.sh
@rustup component add rustfmt clippy
@echo "$(GREEN)Setup complete!$(RESET)"
ci:
@echo "$(BLUE)Running CI checks...$(RESET)"
cargo fmt --check
cargo clippy -- -D warnings
cargo test
cargo doc --no-deps
@echo "$(GREEN)CI checks passed!$(RESET)"