-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
395 lines (292 loc) Β· 12 KB
/
Makefile
File metadata and controls
395 lines (292 loc) Β· 12 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
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
# Katalyst Framework Makefile
# Unified build system orchestrating Deno, Bun, NX, and Turborepo
.PHONY: help install dev build test lint clean deploy status
.DEFAULT_GOAL := help
# Configuration
DENO := deno run --allow-all
UNIFIED_RUNNER := scripts/unified-runner.ts
BUN_FALLBACK := bun
NODE_FALLBACK := npm
# Colors for output
CYAN := \033[36m
GREEN := \033[32m
YELLOW := \033[33m
RED := \033[31m
RESET := \033[0m
##@ General Commands
help: ## Display this help message
@echo "$(CYAN)π Katalyst Framework - Unified Build System$(RESET)"
@echo "$(CYAN)==============================================$(RESET)"
@echo ""
@echo "$(GREEN)Available commands:$(RESET)"
@awk 'BEGIN {FS = ":.*##"; printf ""} /^[a-zA-Z_-]+:.*?##/ { printf " $(CYAN)%-20s$(RESET) %s\n", $$1, $$2 } /^##@/ { printf "\n$(YELLOW)%s$(RESET)\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
@echo ""
@echo "$(GREEN)Package Managers:$(RESET) Deno (primary), Bun (fallback)"
@echo "$(GREEN)Task Runners:$(RESET) Turborepo (primary), NX (fallback)"
@echo "$(GREEN)Frameworks:$(RESET) Core (TanStack), Remix (Admin), Next.js (Marketing)"
status: ## Show system status and capabilities
@$(DENO) $(UNIFIED_RUNNER) --status
##@ Installation & Setup
install: ## Install dependencies (Deno primary, Bun fallback)
@echo "$(CYAN)π¦ Installing dependencies...$(RESET)"
@$(DENO) $(UNIFIED_RUNNER) --install || $(MAKE) install-fallback
install-fallback: ## Install using Bun fallback
@echo "$(YELLOW)π Using Bun fallback...$(RESET)"
@$(BUN_FALLBACK) install || npm install
install-force: ## Force reinstall all dependencies
@$(MAKE) clean-deps
@$(MAKE) install
setup: ## Initial project setup with cloud caching
@echo "$(CYAN)βοΈ Setting up Katalyst Framework...$(RESET)"
@$(MAKE) install
@$(MAKE) cache-setup
@$(MAKE) status
cache-setup: ## Setup cloud caching for Turbo and NX
@echo "$(CYAN)βοΈ Setting up cloud caching...$(RESET)"
@$(DENO) $(UNIFIED_RUNNER) --cloud-cache
##@ Development
dev: ## Start development servers for all frameworks
@echo "$(CYAN)π Starting development servers...$(RESET)"
@$(DENO) $(UNIFIED_RUNNER) --task dev
dev-core: ## Start Core framework development server
@$(DENO) $(UNIFIED_RUNNER) --task dev:core
dev-remix: ## Start Remix admin development server
@$(DENO) $(UNIFIED_RUNNER) --task dev:remix
dev-nextjs: ## Start Next.js marketing development server
@$(DENO) $(UNIFIED_RUNNER) --task dev:nextjs
##@ Building
build: ## Build all frameworks with cloud caching
@echo "$(CYAN)ποΈ Building all frameworks...$(RESET)"
@$(DENO) $(UNIFIED_RUNNER) --task build --cloud-cache
build-web: ## Build for web platforms
@$(DENO) $(UNIFIED_RUNNER) --task build:web --platforms web
build-desktop: ## Build for desktop platforms
@$(DENO) $(UNIFIED_RUNNER) --task build:desktop --platforms desktop
build-mobile: ## Build for mobile platforms
@$(DENO) $(UNIFIED_RUNNER) --task build:mobile --platforms mobile
build-native: ## Build native Rust components
@$(DENO) $(UNIFIED_RUNNER) --task build-native
build-all: ## Build for all platforms
@echo "$(CYAN)π Building for all platforms...$(RESET)"
@$(MAKE) build-native
@$(MAKE) build-web
@$(MAKE) build-desktop
@$(MAKE) build-mobile
build-core: ## Build Core framework only
@$(DENO) $(UNIFIED_RUNNER) --task build --frameworks core
build-remix: ## Build Remix framework only
@$(DENO) $(UNIFIED_RUNNER) --task build --frameworks remix
build-nextjs: ## Build Next.js framework only
@$(DENO) $(UNIFIED_RUNNER) --task build --frameworks nextjs
##@ Testing
test: ## Run all tests using Deno test runner
@echo "$(CYAN)π§ͺ Running all tests...$(RESET)"
@$(DENO) $(UNIFIED_RUNNER) --task test
test-unit: ## Run unit tests only
@$(DENO) $(UNIFIED_RUNNER) --task test:unit
test-integration: ## Run integration tests only
@$(DENO) $(UNIFIED_RUNNER) --task test:integration
test-performance: ## Run performance tests only
@$(DENO) $(UNIFIED_RUNNER) --task test:performance
test-e2e: ## Run end-to-end tests only
@$(DENO) $(UNIFIED_RUNNER) --task test:e2e
test-coverage: ## Run tests with coverage report
@$(DENO) tests/run-all.ts --coverage --reporter html
@echo "$(GREEN)β
Coverage report: tests/output/coverage/html/index.html$(RESET)"
test-watch: ## Run tests in watch mode
@$(DENO) tests/run-all.ts --watch
test-ci: ## Run tests for CI/CD (with bail on failure)
@$(DENO) tests/run-all.ts --coverage --reporter junit --bail
test-core: ## Run tests for Core framework
@$(DENO) $(UNIFIED_RUNNER) --task test --frameworks core
test-remix: ## Run tests for Remix framework
@$(DENO) $(UNIFIED_RUNNER) --task test --frameworks remix
test-nextjs: ## Run tests for Next.js framework
@$(DENO) $(UNIFIED_RUNNER) --task test --frameworks nextjs
test-shared: ## Run tests for shared components
@$(DENO) $(UNIFIED_RUNNER) --task test --frameworks shared
test-multithreading: ## Test multithreading and WebAssembly performance
@$(DENO) tests/performance/multithreading.test.ts
##@ Code Quality
lint: ## Run linting across all frameworks
@echo "$(CYAN)π Running linters...$(RESET)"
@$(DENO) $(UNIFIED_RUNNER) --task lint
lint-deno: ## Run Deno-specific linting
@deno lint && deno fmt --check
lint-fix: ## Fix linting issues automatically
@deno fmt
@bunx biome check --apply .
typecheck: ## Run TypeScript type checking
@$(DENO) $(UNIFIED_RUNNER) --task typecheck
typecheck-deno: ## Run Deno type checking
@deno check **/*.ts
format: ## Format code using Deno formatter
@deno fmt
format-check: ## Check code formatting
@deno fmt --check
##@ Preview & Storybook
preview: ## Preview built applications
@$(DENO) $(UNIFIED_RUNNER) --task preview
preview-core: ## Preview Core framework
@$(DENO) $(UNIFIED_RUNNER) --task preview --frameworks core
preview-remix: ## Preview Remix framework
@$(DENO) $(UNIFIED_RUNNER) --task preview --frameworks remix
preview-nextjs: ## Preview Next.js framework
@$(DENO) $(UNIFIED_RUNNER) --task preview --frameworks nextjs
storybook: ## Start Storybook development server
@storybook dev -p 6006
storybook-build: ## Build Storybook for production
@storybook build
##@ Deployment
deploy: ## Deploy all frameworks
@echo "$(CYAN)π Deploying all frameworks...$(RESET)"
@$(MAKE) build
@$(DENO) $(UNIFIED_RUNNER) --task deploy
deploy-web: ## Deploy web applications
@$(MAKE) build-web
@$(DENO) $(UNIFIED_RUNNER) --task deploy --platforms web
deploy-desktop: ## Deploy desktop applications
@$(MAKE) build-desktop
@$(DENO) $(UNIFIED_RUNNER) --task deploy --platforms desktop
deploy-mobile: ## Deploy mobile applications
@$(MAKE) build-mobile
@$(DENO) $(UNIFIED_RUNNER) --task deploy --platforms mobile
##@ Cleaning
clean: ## Clean build artifacts and caches
@echo "$(CYAN)π§Ή Cleaning build artifacts...$(RESET)"
@$(DENO) $(UNIFIED_RUNNER) --clean
clean-all: ## Deep clean everything including node_modules
@echo "$(RED)ποΈ Deep cleaning everything...$(RESET)"
@rm -rf dist .next .remix node_modules/.cache .turbo .nx coverage tests/output
@rm -rf node_modules
@rm -rf */node_modules
@rm -rf bun.lockb package-lock.json yarn.lock
clean-deps: ## Clean dependency directories
@rm -rf node_modules */node_modules bun.lockb package-lock.json yarn.lock
clean-build: ## Clean only build artifacts
@rm -rf dist .next .remix */dist */build
clean-cache: ## Clean only cache directories
@rm -rf node_modules/.cache .turbo .nx coverage tests/output
clean-test: ## Clean test artifacts
@rm -rf tests/output tests/coverage .nyc_output coverage
##@ Tool-Specific Commands
# NX Commands
nx-build: ## Build using NX only
@nx run-many --target=build --projects=core,remix,nextjs --parallel
nx-test: ## Test using NX only
@nx run-many --target=test --projects=core,remix,nextjs,shared --parallel
nx-lint: ## Lint using NX only
@nx run-many --target=lint --projects=core,remix,nextjs,shared --parallel
nx-reset: ## Reset NX cache
@nx reset
# Turbo Commands
turbo-build: ## Build using Turbo only
@turbo build
turbo-test: ## Test using Turbo only
@turbo test
turbo-lint: ## Lint using Turbo only
@turbo lint
turbo-prune: ## Prune Turbo cache
@turbo prune
# Bun Commands
bun-install: ## Install using Bun only
@$(BUN_FALLBACK) install
bun-build: ## Build using Bun only
@$(BUN_FALLBACK) run build
bun-test: ## Test using Bun only
@$(BUN_FALLBACK) test
bun-dev: ## Develop using Bun only
@$(BUN_FALLBACK) run dev
##@ Utilities
check-env: ## Check environment and tool availability
@echo "$(CYAN)π Checking environment...$(RESET)"
@command -v deno >/dev/null 2>&1 && echo "$(GREEN)β
Deno$(RESET)" || echo "$(RED)β Deno$(RESET)"
@command -v bun >/dev/null 2>&1 && echo "$(GREEN)β
Bun$(RESET)" || echo "$(RED)β Bun$(RESET)"
@command -v node >/dev/null 2>&1 && echo "$(GREEN)β
Node.js$(RESET)" || echo "$(RED)β Node.js$(RESET)"
@command -v nx >/dev/null 2>&1 && echo "$(GREEN)β
NX$(RESET)" || echo "$(RED)β NX$(RESET)"
@command -v turbo >/dev/null 2>&1 && echo "$(GREEN)β
Turbo$(RESET)" || echo "$(RED)β Turbo$(RESET)"
doctor: ## Run comprehensive system diagnostics
@echo "$(CYAN)π₯ Running system diagnostics...$(RESET)"
@$(MAKE) check-env
@$(MAKE) status
@echo ""
@echo "$(GREEN)Configuration files:$(RESET)"
@ls -la deno.json package.json turbo.json nx.json 2>/dev/null || echo "$(YELLOW)Some config files missing$(RESET)"
benchmark: ## Run performance benchmarks
@echo "$(CYAN)β‘ Running performance benchmarks...$(RESET)"
@$(MAKE) test-performance
@$(MAKE) test-multithreading
update: ## Update dependencies
@echo "$(CYAN)β¬οΈ Updating dependencies...$(RESET)"
@$(BUN_FALLBACK) update || npm update
security-audit: ## Run security audit
@echo "$(CYAN)π Running security audit...$(RESET)"
@$(BUN_FALLBACK) audit || npm audit
##@ Advanced
# Advanced workflows
full-ci: ## Complete CI workflow
@echo "$(CYAN)π Running full CI workflow...$(RESET)"
@$(MAKE) clean
@$(MAKE) install
@$(MAKE) lint
@$(MAKE) typecheck
@$(MAKE) test-ci
@$(MAKE) build
release-prep: ## Prepare for release
@echo "$(CYAN)π¦ Preparing release...$(RESET)"
@$(MAKE) full-ci
@$(MAKE) build-all
@echo "$(GREEN)β
Release preparation complete$(RESET)"
dev-setup: ## Setup development environment
@echo "$(CYAN)π οΈ Setting up development environment...$(RESET)"
@$(MAKE) setup
@$(MAKE) storybook &
@$(MAKE) dev
# Parallel execution examples
parallel-test: ## Run tests in parallel across frameworks
@echo "$(CYAN)β‘ Running parallel tests...$(RESET)"
@$(MAKE) test-core & \
$(MAKE) test-remix & \
$(MAKE) test-nextjs & \
$(MAKE) test-shared & \
wait
parallel-build: ## Build frameworks in parallel
@echo "$(CYAN)β‘ Building in parallel...$(RESET)"
@$(MAKE) build-core & \
$(MAKE) build-remix & \
$(MAKE) build-nextjs & \
wait
# Documentation
docs: ## Generate documentation
@echo "$(CYAN)π Generating documentation...$(RESET)"
@deno doc --html --name="Katalyst Framework" shared/src/index.ts
# Debugging
debug-deno: ## Debug with Deno inspector
@deno run --allow-all --inspect-brk $(UNIFIED_RUNNER) --status
debug-test: ## Debug tests with inspector
@deno test --allow-all --inspect-brk tests/unit/
# Watch commands
watch-build: ## Watch and rebuild on changes
@echo "$(CYAN)π Watching for changes...$(RESET)"
@while true; do \
inotifywait -r -e modify,create,delete . 2>/dev/null; \
$(MAKE) build; \
done
# Quick shortcuts
q-dev: dev ## Quick: Start development (alias)
q-build: build ## Quick: Build all (alias)
q-test: test ## Quick: Run tests (alias)
q-clean: clean ## Quick: Clean artifacts (alias)
##@ Examples
example-basic: ## Example: Basic development workflow
@echo "$(GREEN)Example: Basic development workflow$(RESET)"
@echo " make install dev"
example-testing: ## Example: Complete testing workflow
@echo "$(GREEN)Example: Complete testing workflow$(RESET)"
@echo " make test test-coverage test-e2e"
example-deployment: ## Example: Production deployment
@echo "$(GREEN)Example: Production deployment$(RESET)"
@echo " make clean install build-all test-ci deploy"
example-debugging: ## Example: Debug failing tests
@echo "$(GREEN)Example: Debug failing tests$(RESET)"
@echo " make test-watch or make debug-test"