-
-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathMakefile
More file actions
207 lines (169 loc) · 5.82 KB
/
Makefile
File metadata and controls
207 lines (169 loc) · 5.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
# Jazz CLI Makefile
# Provides convenient commands for development, building, and testing
.PHONY: help install build dev test test-watch lint lint-fix format clean start cli install-global uninstall-global push-tag patch minor major
# Default target
help: ## Show this help message
@echo "Jazz CLI - Available commands:"
@echo ""
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'
# Installation and setup
install: ## Install dependencies
@echo "Installing dependencies..."
bun install
# Development
dev: ## Start development server with hot reload
@echo "Starting development server..."
bun --watch src/main.ts
start: build ## Start the built application
@echo "Starting Jazz CLI..."
bun dist/main.js
cli: ## Run CLI directly from source
@echo "Running CLI from source..."
bun src/main.ts
# Building
build: clean ## Build the project
@echo "Building Jazz CLI..."
bun run build
clean: ## Clean build artifacts
@echo "Cleaning build artifacts..."
bun run clean
# Compilation & Signing
compile: clean ## Compile to standalone binary
@echo "Compiling to standalone binary..."
bun run scripts/compile.ts
sign: ## Sign the compiled binary (Usage: make sign IDENTITY="Developer ID Application: Name (ID)")
@if [ -z "$(IDENTITY)" ]; then \
echo "Error: IDENTITY argument is required. Usage: make sign IDENTITY=\"Developer ID Application: Name (ID)\""; \
exit 1; \
fi
@echo "Signing binary with identity: $(IDENTITY)"
codesign --force --options runtime --sign "$(IDENTITY)" dist/jazz
@echo "Verifying signature..."
codesign --verify --verbose dist/jazz
# Testing
test: ## Run tests
@echo "Running tests..."
bun test
test-watch: ## Run tests in watch mode
@echo "Running tests in watch mode..."
bun run test:watch
# Code quality
lint: ## Run linting
@echo "Running linter..."
bun run lint
lint-fix: ## Fix linting issues
@echo "Fixing linting issues..."
bun run lint:fix
format: ## Format code
@echo "Formatting code..."
bun run format
# Development workflow
check: lint test ## Run linting and tests
@echo "All checks passed!"
pre-commit: format lint-fix test ## Run pre-commit checks
@echo "Pre-commit checks completed!"
# Release
release-check: check ## Check if ready for release
@echo "Checking release readiness..."
@echo "Version: $$(grep '"version"' package.json | cut -d'"' -f4)"
@echo "Build status: $$(if [ -d dist ]; then echo "Built"; else echo "Not built"; fi)"
@echo "Tests: $$(if bun test >/dev/null 2>&1; then echo "Passing"; else echo "Failing"; fi)"
release-build: clean build test ## Build release version
@echo "Building release version..."
@echo "Release build completed!"
# Docker
docker-build: ## Build Docker image
@echo "Building Docker image..."
@if [ -f Dockerfile ]; then \
docker build -t jazz:latest .; \
else \
echo "Dockerfile not found"; \
fi
docker-run: ## Run Docker container
@echo "Running Docker container..."
@if [ -f Dockerfile ]; then \
docker run -it --rm jazz:latest; \
else \
echo "Dockerfile not found"; \
fi
# Environment setup
setup: install ## Complete development setup
@echo "Setting up development environment..."
@echo "✅ Dependencies installed"
@echo "✅ Development environment ready"
@echo ""
@echo "Next steps:"
@echo " make dev - Start development server"
@echo " make test - Run tests"
@echo " make build - Build the project"
# CI/CD helpers
ci-install: ## Install dependencies for CI
@echo "Installing dependencies for CI..."
bun install --frozen-lockfile
ci-test: ## Run tests for CI
@echo "Running CI tests..."
bun test --coverage
ci-build: ## Build for CI
@echo "Building for CI..."
bun run build
# Utility commands
version: ## Show version information
@echo "Jazz CLI Version Information:"
@echo "Package version: $$(grep '"version"' package.json | cut -d'"' -f4)"
@echo "Node version: $$(node --version)"
@echo "Bun version: $$(bun --version)"
@echo "TypeScript version: $$(bunx tsc --version)"
info: ## Show project information
@echo "Jazz CLI Project Information:"
@echo "Name: $$(grep '"name"' package.json | cut -d'"' -f4)"
@echo "Description: $$(grep '"description"' package.json | cut -d'"' -f4)"
@echo "Author: $$(grep '"author"' package.json | cut -d'"' -f4)"
@echo "License: $$(grep '"license"' package.json | cut -d'"' -f4)"
@echo "Repository: $$(grep '"repository"' package.json | cut -d'"' -f4 || echo 'Not specified')"
# Cleanup
clean-all: clean ## Clean everything including node_modules
@echo "Cleaning everything..."
rm -rf node_modules
rm -rf dist
rm -rf .bun
@echo "Complete cleanup finished!"
# Development helpers
watch: ## Watch for changes and rebuild
@echo "Watching for changes..."
@if command -v nodemon >/dev/null 2>&1; then \
nodemon --watch src --ext ts --exec "bun run build"; \
else \
echo "Nodemon not installed. Install with: npm install -g nodemon"; \
echo "Or use: make dev"; \
fi
# Quick development cycle
quick: format lint-fix build test ## Quick development cycle
@echo "Quick development cycle completed!"
# Show file structure
tree: ## Show project structure
@echo "Project structure:"
@tree -I 'node_modules|dist|.git' -a
# Security
audit: ## Run security audit
@echo "Running security audit..."
bun audit
# Update dependencies
update: ## Update dependencies
@echo "Updating dependencies..."
bun update
# Version bumping
push-tag: ## Push tags to remote (git push --follow-tags)
@echo "Pushing tags to remote..."
@git push --follow-tags
patch: ## Bump patch version (e.g., 0.4.5 -> 0.4.6)
@echo "Bumping patch version..."
@npm version patch
@$(MAKE) push-tag
minor: ## Bump minor version (e.g., 0.4.5 -> 0.5.0)
@echo "Bumping minor version..."
@npm version minor
@$(MAKE) push-tag
major: ## Bump major version (e.g., 0.4.5 -> 1.0.0)
@echo "Bumping major version..."
@npm version major
@$(MAKE) push-tag