- Add PluginCtlConfig struct with IgnoreAssets field for glob patterns - Add ParsePluginCtlConfig function to parse manifest props["pluginctl"] - Update updateassets command to respect ignore patterns with glob matching - Add comprehensive logging when files are skipped due to ignore patterns - Support patterns like *.test.js, build/, node_modules for flexible exclusion - Add extensive tests for config parsing and path matching functionality - Maintain backward compatibility with existing manifests - Fix Makefile check-changes target and add logger init to tests 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
160 lines
3.9 KiB
Makefile
160 lines
3.9 KiB
Makefile
# pluginctl Makefile
|
|
# Based on common Go project patterns
|
|
|
|
# Build information
|
|
VERSION ?= $(shell git describe --tags --always --dirty)
|
|
COMMIT ?= $(shell git rev-parse --short HEAD)
|
|
BUILD_DATE ?= $(shell date -u +"%Y-%m-%dT%H:%M:%SZ")
|
|
|
|
# Go build variables
|
|
GO_VERSION ?= $(shell awk '/^go / {print $$2}' go.mod)
|
|
GOOS ?= $(shell go env GOOS)
|
|
GOARCH ?= $(shell go env GOARCH)
|
|
|
|
# Tool versions
|
|
GOLANGCI_LINT_VERSION ?= v1.62.2
|
|
GORELEASER_VERSION ?= v2.10.2
|
|
|
|
# Project variables
|
|
BINARY_NAME = pluginctl
|
|
MAIN_PACKAGE = ./cmd/pluginctl
|
|
DIST_DIR = dist
|
|
|
|
# Build flags
|
|
LDFLAGS = -ldflags="-s -w -X main.version=$(VERSION) -X main.commit=$(COMMIT) -X main.date=$(BUILD_DATE)"
|
|
|
|
# Default target
|
|
.PHONY: all
|
|
all: clean lint test build
|
|
|
|
# Help target
|
|
.PHONY: help
|
|
help: ## Show this help message
|
|
@echo "Available targets:"
|
|
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf " %-20s %s\n", $$1, $$2}' $(MAKEFILE_LIST)
|
|
|
|
# Clean build artifacts
|
|
.PHONY: clean
|
|
clean: ## Clean build artifacts
|
|
@echo "Cleaning build artifacts..."
|
|
@rm -rf $(DIST_DIR)
|
|
@rm -f $(BINARY_NAME)
|
|
@go clean -cache
|
|
|
|
# Install dependencies
|
|
.PHONY: deps
|
|
deps: ## Install/update dependencies
|
|
@echo "Installing dependencies..."
|
|
@go mod download
|
|
@go mod tidy
|
|
|
|
# Run tests
|
|
.PHONY: test
|
|
test: ## Run tests
|
|
@echo "Running tests..."
|
|
@go test -v ./...
|
|
|
|
# Run tests with coverage
|
|
.PHONY: test-coverage
|
|
test-coverage: ## Run tests with coverage
|
|
@echo "Running tests with coverage..."
|
|
@go test -v -coverprofile=coverage.out ./...
|
|
@go tool cover -html=coverage.out -o coverage.html
|
|
@echo "Coverage report generated: coverage.html"
|
|
|
|
# Lint code
|
|
.PHONY: lint
|
|
lint: ## Run linter
|
|
@echo "Running linter..."
|
|
@golangci-lint run
|
|
|
|
# Fix linting issues
|
|
.PHONY: lint-fix
|
|
lint-fix: ## Fix linting issues
|
|
@echo "Fixing linting issues..."
|
|
@golangci-lint run --fix
|
|
|
|
# Build for all platforms using goreleaser
|
|
.PHONY: build-all
|
|
build: clean ## Build for all platforms using goreleaser
|
|
@echo "Building for all platforms using goreleaser..."
|
|
@goreleaser build --clean
|
|
|
|
# Install binary
|
|
.PHONY: install
|
|
install:
|
|
@echo "Installing $(BINARY_NAME)..."
|
|
@go install $(LDFLAGS) $(MAIN_PACKAGE)
|
|
|
|
# Run the application
|
|
.PHONY: run
|
|
run: ## Run the application
|
|
@go run $(MAIN_PACKAGE) $(ARGS)
|
|
|
|
# Format code
|
|
.PHONY: fmt
|
|
fmt: ## Format code
|
|
@echo "Formatting code..."
|
|
@go fmt ./...
|
|
|
|
# Generate code
|
|
.PHONY: generate
|
|
generate: ## Generate code
|
|
@echo "Generating code..."
|
|
@go generate ./...
|
|
|
|
# Check for updates
|
|
.PHONY: check-updates
|
|
check-updates: ## Check for dependency updates
|
|
@echo "Checking for dependency updates..."
|
|
@go list -u -m all
|
|
|
|
# Release (requires goreleaser)
|
|
.PHONY: release
|
|
release: ## Create a release
|
|
@echo "Creating release..."
|
|
@goreleaser release --clean
|
|
|
|
# Snapshot release (for testing)
|
|
.PHONY: snapshot
|
|
snapshot: ## Create a snapshot release
|
|
@echo "Creating snapshot release..."
|
|
@goreleaser release --snapshot --clean
|
|
|
|
# Development setup
|
|
.PHONY: dev-setup
|
|
dev-setup: ## Set up development environment
|
|
@echo "Setting up development environment..."
|
|
@go get -tool github.com/golangci/golangci-lint/cmd/golangci-lint@$(GOLANGCI_LINT_VERSION)
|
|
@go get -tool github.com/goreleaser/goreleaser/v2@$(GORELEASER_VERSION)
|
|
@echo "Development tools installed"
|
|
|
|
# Verify build
|
|
.PHONY: verify
|
|
verify: clean lint test build ## Verify build (clean, lint, test, build)
|
|
@echo "Build verification complete"
|
|
|
|
# Quick development build
|
|
.PHONY: dev
|
|
dev: fmt lint snapshot ## Quick development build (fmt, lint, build)
|
|
|
|
# Check changes target
|
|
.PHONY: check-changes
|
|
check-changes: lint test ## Check changes (lint, test)
|
|
@echo "All checks passed!"
|
|
|
|
# CI target
|
|
.PHONY: ci
|
|
ci: deps verify ## CI target (deps, verify)
|
|
|
|
# Print build info
|
|
.PHONY: version
|
|
version: ## Print version information
|
|
@echo "Version: $(VERSION)"
|
|
@echo "Commit: $(COMMIT)"
|
|
@echo "Build Date: $(BUILD_DATE)"
|
|
@echo "Go Version: $(GO_VERSION)"
|
|
@echo "OS/Arch: $(GOOS)/$(GOARCH)"
|
|
@echo "Tool Versions:"
|
|
@echo " golangci-lint: $(GOLANGCI_LINT_VERSION)"
|
|
@echo " goreleaser: $(GORELEASER_VERSION)"
|