forked from Arenax-gaming/ArenaX
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
152 lines (127 loc) · 4.64 KB
/
Makefile
File metadata and controls
152 lines (127 loc) · 4.64 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
# ArenaX Development Makefile
.PHONY: help install build test clean lint format check-all docker-build docker-up docker-down
# Default target
help:
@echo "ArenaX Development Commands:"
@echo ""
@echo "Installation:"
@echo " install Install all dependencies"
@echo " install-frontend Install frontend dependencies"
@echo " install-backend Install backend dependencies"
@echo " install-contracts Install contracts dependencies"
@echo ""
@echo "Development:"
@echo " dev Start all services in development mode"
@echo " dev-frontend Start frontend development server"
@echo " dev-backend Start backend development server"
@echo ""
@echo "Building:"
@echo " build Build all projects"
@echo " build-frontend Build frontend for production"
@echo " build-backend Build backend"
@echo " build-contracts Build contracts for deployment"
@echo ""
@echo "Testing:"
@echo " test Run all tests"
@echo " test-frontend Run frontend tests"
@echo " test-backend Run backend tests"
@echo " test-contracts Run contracts tests"
@echo ""
@echo "Code Quality:"
@echo " lint Lint all code"
@echo " format Format all code"
@echo " check-all Run all checks (lint, format, test)"
@echo ""
@echo "Docker:"
@echo " docker-build Build Docker images"
@echo " docker-up Start services with Docker Compose"
@echo " docker-down Stop Docker services"
@echo ""
@echo "Utilities:"
@echo " clean Clean all build artifacts"
@echo " setup Initial project setup"
# Installation
install: install-frontend install-backend install-contracts
install-frontend:
@echo "Installing frontend dependencies..."
@if command -v yarn >/dev/null 2>&1; then cd frontend && yarn install; else echo "Yarn not found, skipping frontend installation"; fi
install-backend:
@echo "Installing backend dependencies..."
@if [ -f "backend/Cargo.toml" ]; then cd backend && cargo build; else echo "Backend Cargo.toml not found, skipping backend installation"; fi
install-contracts:
@echo "Installing contracts dependencies..."
cd contracts && cargo build
# Development
dev:
@echo "Starting all services..."
@echo "Run 'make dev-frontend' and 'make dev-backend' in separate terminals"
dev-frontend:
@echo "Starting frontend development server..."
@if command -v yarn >/dev/null 2>&1; then cd frontend && yarn dev; else echo "Yarn not found, cannot start frontend"; fi
dev-backend:
@echo "Starting backend development server..."
cd backend && cargo run
# Building
build: build-frontend build-backend build-contracts
build-frontend:
@echo "Building frontend..."
cd frontend && yarn build
build-backend:
@echo "Building backend..."
cd backend && cargo build --release
build-contracts:
@echo "Installing WASM target..."
rustup target add wasm32-unknown-unknown
@echo "Building contracts..."
cd contracts && cargo build --target wasm32-unknown-unknown --release
# Testing
test: test-frontend test-backend test-contracts
test-frontend:
@echo "Running frontend tests..."
cd frontend && yarn test
test-backend:
@echo "Running backend tests..."
cd backend && cargo test
test-contracts:
@echo "Running contracts tests..."
cd contracts && cargo test
# Code Quality
lint:
@echo "Linting frontend..."
cd frontend && yarn lint
@echo "Linting backend..."
cd backend && cargo clippy
@echo "Linting contracts..."
cd contracts && cargo clippy
format:
@echo "Formatting frontend..."
cd frontend && yarn format
@echo "Formatting backend..."
cd backend && cargo fmt
@echo "Formatting contracts..."
cd contracts && cargo fmt
check-all: lint format test
@echo "All checks completed!"
# Docker
docker-build:
@echo "Building Docker images..."
@docker-compose build
docker-up:
@echo "Starting services with Docker Compose..."
@docker-compose up -d
docker-down:
@echo "Stopping Docker services..."
@docker-compose down
# Utilities
clean:
@echo "Cleaning build artifacts..."
@if [ -d "frontend" ]; then cd frontend && rm -rf .next node_modules; fi
@if [ -f "backend/Cargo.toml" ]; then cd backend && cargo clean; fi
@if [ -f "contracts/Cargo.toml" ]; then cd contracts && cargo clean; fi
@rm -rf target
setup: install
@echo "Setting up environment files..."
@if [ -f "frontend/env.example" ] && [ ! -f "frontend/.env.local" ]; then cp frontend/env.example frontend/.env.local; fi
@if [ -f "backend/env.example" ] && [ ! -f "backend/.env" ]; then cp backend/env.example backend/.env; fi
@if [ -f "contracts/env.example" ] && [ ! -f "contracts/.env" ]; then cp contracts/env.example contracts/.env; fi
@echo "Setup complete! Edit the .env files with your configuration."