-
Notifications
You must be signed in to change notification settings - Fork 77
Expand file tree
/
Copy pathMakefile
More file actions
162 lines (134 loc) · 5.47 KB
/
Makefile
File metadata and controls
162 lines (134 loc) · 5.47 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
.PHONY: help build test lint clean build-contract build-keeper build-frontend test-contract test-keeper test-frontend lint-contract lint-keeper lint-frontend lint-js clean-contract clean-keeper clean-frontend
# Default target
help:
@echo "SoroTask Makefile - Common Development Tasks"
@echo ""
@echo "Usage: make [target]"
@echo ""
@echo "Targets:"
@echo " build Build all components (contract, frontend)"
@echo " build-contract Build Soroban smart contract (Rust)"
@echo " build-keeper Keeper doesn't require build (Node.js runtime)"
@echo " build-frontend Build Frontend component (Next.js)"
@echo ""
@echo " test Run tests for all components"
@echo " test-contract Run contract tests (Rust)"
@echo " test-keeper Run keeper tests (Jest)"
@echo " test-frontend Run frontend tests (N/A - echo only)"
@echo ""
@echo " lint Lint all components"
@echo " lint-contract Lint contract code (cargo clippy)"
@echo " lint-keeper Lint keeper code (ESLint)"
@echo " lint-frontend Lint frontend code (ESLint)"
@echo ""
@echo " clean Clean all build artifacts"
@echo " clean-contract Clean contract build artifacts"
@echo " clean-keeper Clean keeper build artifacts"
@echo " clean-frontend Clean frontend build artifacts"
@echo ""
@echo " install Install all dependencies"
@echo " format Format all code"
@echo " check Run lint + test"
@echo " dev Show dev workflow"
@echo ""
# ==============================================================================
# BUILD TARGETS
# ==============================================================================
build: build-contract build-frontend
@echo "✓ All buildable components built successfully"
build-contract:
@echo "Building Soroban smart contract..."
cd contract && cargo build --release
@echo "✓ Contract built successfully"
build-keeper:
@echo "Keeper is a Node.js runtime application - no build step needed"
@echo "Run 'npm start' in keeper/ directory to start the service"
build-frontend:
@echo "Building Frontend component (Next.js)..."
cd frontend && npm install && npm run build
@echo "✓ Frontend built successfully"
# ==============================================================================
# TEST TARGETS
# ==============================================================================
test: test-contract test-keeper test-frontend
@echo "✓ All tests completed"
test-contract:
@echo "Running contract tests..."
cd contract && cargo test --release
@echo "✓ Contract tests passed"
test-keeper:
@echo "Running keeper tests (Jest)..."
cd keeper && npm test
@echo "✓ Keeper tests passed"
test-frontend:
@echo "Frontend tests not specified (echo only)"
cd frontend && npm test
# ==============================================================================
# LINT TARGETS
# ==============================================================================
lint: lint-contract lint-keeper lint-frontend lint-js
@echo "✓ All components linted successfully"
lint-contract:
@echo "Linting contract code (cargo clippy)..."
cd contract && cargo clippy --all-targets --all-features -- -D warnings
@echo "✓ Contract linting passed"
lint-keeper:
@echo "Linting keeper code (ESLint)..."
cd keeper && npm run lint
@echo "✓ Keeper linting passed"
lint-frontend:
@echo "Linting frontend code (ESLint)..."
cd frontend && npm run lint
@echo "✓ Frontend linting passed"
lint-js:
@echo "Running lint-staged on staged files..."
npx lint-staged
@echo "✓ Lint-staged passed"
# ==============================================================================
# CLEAN TARGETS
# ==============================================================================
clean: clean-contract clean-keeper clean-frontend
@echo "✓ All build artifacts cleaned"
clean-contract:
@echo "Cleaning contract build artifacts..."
cd contract && cargo clean
@echo "✓ Contract cleaned"
clean-keeper:
@echo "Cleaning keeper build artifacts..."
cd keeper && rm -rf node_modules coverage .nyc_output
@echo "✓ Keeper cleaned"
clean-frontend:
@echo "Cleaning frontend build artifacts..."
cd frontend && rm -rf node_modules .next dist build out
@echo "✓ Frontend cleaned"
# ==============================================================================
# UTILITY TARGETS
# ==============================================================================
install:
@echo "Installing dependencies for all components..."
npm install
cd contract && cargo fetch
cd keeper && npm install
cd frontend && npm install
@echo "✓ All dependencies installed"
format:
@echo "Formatting all code..."
cd contract && cargo fmt
cd keeper && npm run lint:fix 2>/dev/null || npx prettier --write "src/**/*.{ts,js}" "__tests__/**/*.{ts,js}" 2>/dev/null || echo " (prettier not configured for keeper)"
cd frontend && npm run lint:fix 2>/dev/null || echo " (lint:fix not configured for frontend)"
@echo "✓ Code formatted"
check: lint test
@echo "✓ All checks passed (lint + test)"
dev:
@echo "Development workflow - Run each in a separate terminal:"
@echo ""
@echo "Contract (Rust):"
@echo " cd contract && cargo watch -x build"
@echo ""
@echo "Keeper (Node.js - background service):"
@echo " cd keeper && npm run dev"
@echo ""
@echo "Frontend (Next.js):"
@echo " cd frontend && npm run dev"
@echo ""
.DEFAULT_GOAL := help