forked from Shonen-Labs/StarkFinder
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
152 lines (134 loc) · 5.97 KB
/
Makefile
File metadata and controls
152 lines (134 loc) · 5.97 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
# StarkFinder Makefile
# This Makefile provides convenient commands for developing and managing the StarkFinder project
.PHONY: help install build test clean dev start lint type-check db-setup docker-up docker-down contracts-build contracts-test
# Default target
help:
@echo "StarkFinder Development Commands"
@echo "================================"
@echo "make install - Install all dependencies (npm + scarb)"
@echo "make build - Build the entire project (frontend + contracts)"
@echo "make dev - Start development server"
@echo "make test - Run all tests"
@echo "make lint - Run linting"
@echo "make type-check - Run TypeScript type checking"
@echo "make db-setup - Setup database (generate + migrate)"
@echo "make db-seed - Seed the database with initial data"
@echo "make clean - Clean build artifacts and dependencies"
@echo "make docker-up - Start services with Docker Compose"
@echo "make docker-down - Stop Docker Compose services"
@echo "make contracts-build - Build Starknet contracts"
@echo "make contracts-test - Run Starknet contract tests"
@echo ""
# Install all project dependencies
install:
@echo "Installing root dependencies..."
@npm install
@echo "Installing client dependencies..."
@cd client && npm install
@echo "Installing Prisma dependencies..."
@cd client && npx prisma generate
@echo "Building Starknet contracts..."
@if [ -f "client/app/devx/contracts/utility-contracts/fee-deduction/Scarb.toml" ] && command -v scarb >/dev/null 2>&1; then \
cd client/app/devx/contracts/utility-contracts/fee-deduction && scarb build; \
elif [ -f "client/app/devx/contracts/utility-contracts/fee-deduction/Scarb.toml" ]; then \
echo "⚠️ Scarb not found. Please install Scarb to build contracts: https://docs.swmansion.com/scarb/download.html"; \
fi
@echo "✅ Installation complete!"
# Build the entire project
build:
@echo "Building frontend..."
@cd client && npm run build
@echo "Building Starknet contracts..."
@if [ -f "client/app/devx/contracts/utility-contracts/fee-deduction/Scarb.toml" ] && command -v scarb >/dev/null 2>&1; then \
cd client/app/devx/contracts/utility-contracts/fee-deduction && scarb build; \
elif [ -f "client/app/devx/contracts/utility-contracts/fee-deduction/Scarb.toml" ]; then \
echo "⚠️ Scarb not found. Please install Scarb to build contracts: https://docs.swmansion.com/scarb/download.html"; \
fi
@echo "✅ Build complete!"
# Start development server
dev:
@echo "Starting development server..."
@cd client && npm run dev
# Start production server
start:
@echo "Starting production server..."
@cd client && npm run start
# Run all tests
test:
@echo "Running frontend tests..."
@cd client && npm run type-check
@echo "Running Starknet contract tests..."
@if [ -f "client/app/devx/contracts/utility-contracts/fee-deduction/Scarb.toml" ] && command -v scarb >/dev/null 2>&1; then \
cd client/app/devx/contracts/utility-contracts/fee-deduction && scarb test; \
elif [ -f "client/app/devx/contracts/utility-contracts/fee-deduction/Scarb.toml" ]; then \
echo "⚠️ Scarb not found. Please install Scarb to run contract tests: https://docs.swmansion.com/scarb/download.html"; \
fi
@echo "✅ All tests completed!"
# Run linting
lint:
@echo "Running linter..."
@cd client && npm run lint
# Run TypeScript type checking
type-check:
@echo "Running TypeScript type checking..."
@cd client && npm run type-check
# Setup database (generate Prisma client and run migrations)
db-setup:
@echo "Setting up database..."
@cd client && npx prisma generate
@cd client && npx prisma migrate dev
@echo "✅ Database setup complete!"
# Seed the database with initial data
db-seed:
@echo "Seeding database..."
@cd client && npm run seed
@echo "✅ Database seeding complete!"
# Clean build artifacts and dependencies
clean:
@echo "Cleaning build artifacts..."
@rm -rf client/node_modules
@rm -rf node_modules
@rm -rf client/.next
@rm -rf client/dist
@if [ -f "client/app/devx/contracts/utility-contracts/fee-deduction/Scarb.toml" ] && command -v scarb >/dev/null 2>&1; then \
cd client/app/devx/contracts/utility-contracts/fee-deduction && scarb clean; \
fi
@echo "✅ Clean complete!"
# Start services with Docker Compose
docker-up:
@echo "Starting Docker services..."
@docker-compose up -d
@echo "✅ Docker services started!"
# Stop Docker Compose services
docker-down:
@echo "Stopping Docker services..."
@docker-compose down
@echo "✅ Docker services stopped!"
# Build Starknet contracts specifically
contracts-build:
@echo "Building Starknet contracts..."
@if [ -f "client/app/devx/contracts/utility-contracts/fee-deduction/Scarb.toml" ] && command -v scarb >/dev/null 2>&1; then \
cd client/app/devx/contracts/utility-contracts/fee-deduction && scarb build; \
elif [ -f "client/app/devx/contracts/utility-contracts/fee-deduction/Scarb.toml" ]; then \
echo "⚠️ Scarb not found. Please install Scarb to build contracts: https://docs.swmansion.com/scarb/download.html"; \
else \
echo "No Scarb.toml found. Skipping contract build."; \
fi
@echo "✅ Contract build complete!"
# Test Starknet contracts specifically
contracts-test:
@echo "Testing Starknet contracts..."
@if [ -f "client/app/devx/contracts/utility-contracts/fee-deduction/Scarb.toml" ] && command -v scarb >/dev/null 2>&1; then \
cd client/app/devx/contracts/utility-contracts/fee-deduction && scarb test; \
elif [ -f "client/app/devx/contracts/utility-contracts/fee-deduction/Scarb.toml" ]; then \
echo "⚠️ Scarb not found. Please install Scarb to run contract tests: https://docs.swmansion.com/scarb/download.html"; \
else \
echo "No Scarb.toml found. Skipping contract tests."; \
fi
@echo "✅ Contract tests complete!"
# Quick setup for new developers
setup: install db-setup
@echo "✅ Project setup complete! You can now run 'make dev' to start development."
# Full CI/CD pipeline simulation
ci: install lint type-check test build
@echo "✅ CI pipeline completed successfully!"