forked from BrainTease/Brain-Storm
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
78 lines (66 loc) · 2.56 KB
/
Copy pathMakefile
File metadata and controls
78 lines (66 loc) · 2.56 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
.PHONY: setup dev test build lint clean docker-up docker-down export-openapi audit cargo-audit help
help:
@echo "Brain-Storm Makefile"
@echo "--------------------"
@echo "make setup - Install dependencies, add wasm target, build contracts"
@echo "make dev - Start backend and frontend in development mode"
@echo "make test - Run all tests (backend, frontend, contracts)"
@echo "make build - Build all apps for production"
@echo "make lint - Run linter on all apps"
@echo "make clean - Remove node_modules and build artifacts"
@echo "make docker-up - Start PostgreSQL and Redis via Docker Compose"
@echo "make docker-down - Stop and remove Docker Compose services"
@echo "make export-openapi - Build backend and export openapi.json"
@echo "make audit - Run npm audit across all workspaces"
@echo "make cargo-audit - Run cargo-audit on Rust contracts"
setup:
@echo "==> Installing Node.js dependencies..."
npm install
@echo "==> Adding wasm32 target..."
rustup target add wasm32-unknown-unknown
@echo "==> Building smart contracts..."
./scripts/build.sh
@echo "==> Setup complete!"
dev:
@echo "==> Starting backend and frontend..."
npm run dev:backend & npm run dev:frontend
test:
@echo "==> Running backend tests..."
npm run test --workspace=apps/backend
@echo "==> Running frontend tests..."
npm run test --workspace=apps/frontend || true
@echo "==> Running contract tests..."
cargo test
build:
@echo "==> Building for production..."
npm run build
lint:
@echo "==> Running lint checks..."
npm run lint --workspace=apps/backend
npm run lint --workspace=apps/frontend
clean:
@echo "==> Cleaning project..."
rm -rf node_modules apps/backend/dist apps/frontend/.next target
docker-up:
@echo "==> Starting PostgreSQL and Redis..."
docker compose up -d postgres redis
docker-down:
@echo "==> Stopping Docker services..."
docker compose down
audit:
@echo "==> Running npm audit across workspaces..."
@for ws in apps/backend apps/frontend; do \
echo " -> npm audit in $$ws"; \
npm audit --workspace=$$ws --audit-level=moderate || true; \
done
cargo-audit:
@echo "==> Running cargo-audit on Rust contracts..."
cargo audit --deny warnings
export-openapi:
@echo "==> Exporting OpenAPI spec..."
npm run build --workspace=apps/backend
cd apps/backend && EXPORT_OPENAPI=true node dist/main --export-openapi
mkdir -p docs/api/dist
cp apps/backend/openapi.json docs/api/dist/openapi.json
cp docs/api/swagger-ui.html docs/api/dist/index.html
@echo "==> OpenAPI spec exported to docs/api/dist/"