1- .PHONY : help build run server cli clean test test-go test-react fmt vet deps install dev
1+ .PHONY : help build frontend-build run run-dev server cli clean test test-go test-react fmt vet deps install dev
22
33# Variables
44BINARY_NAME =shadowmaster-server
@@ -28,6 +28,11 @@ deps: ## Download and install dependencies
2828 @go mod tidy
2929 @echo " $( GREEN) ✓ Dependencies installed$( NC) "
3030
31+ frontend-build : # # Build the frontend
32+ @echo " $( CYAN) Building frontend...$( NC) "
33+ @cd web/ui && npm run build
34+ @echo " $( GREEN) ✓ Frontend built$( NC) "
35+
3136build : frontend-build # # Build the server binary
3237 @echo " $( CYAN) Building server...$( NC) "
3338 @go build $(GOFLAGS ) -ldflags " $( LDFLAGS) " -o bin/$(BINARY_NAME ) ./cmd/shadowmaster-server
@@ -41,16 +46,20 @@ build-cli: ## Build the CLI binary
4146build-all : build build-cli # # Build both server and CLI binaries
4247 @echo " $( GREEN) ✓ All binaries built$( NC) "
4348
44- run : test server # # Alias for server target that also runs tests
45-
46- server : frontend-build # # Run the server
49+ run : build # # Run the server in production mode (serves built static files)
4750 @echo " $( CYAN) Starting ShadowMaster server...$( NC) "
48- @echo " $( YELLOW) Port: $( PORT) $( NC) "
49- @echo " $( YELLOW) Data directory: $( DATA_DIR) $( NC) "
50- @echo " $( YELLOW) Web directory: $( WEB_DIR) $( NC) "
51- @echo " "
5251 @mkdir -p $(DATA_DIR )
53- @go run ./cmd/shadowmaster-server -port $(PORT ) -data $(DATA_DIR ) -web $(WEB_DIR )
52+ @./bin/$(BINARY_NAME ) -port $(PORT ) -data $(DATA_DIR ) -web $(WEB_DIR )
53+
54+ run-dev : # # Run both API server and frontend dev server
55+ @echo " $( CYAN) Starting ShadowMaster in development mode...$( NC) "
56+ @echo " $( YELLOW) API server will run on port $( PORT) $( NC) "
57+ @echo " $( YELLOW) Frontend dev server will run on port 5173$( NC) "
58+ @echo " $( YELLOW) Press Ctrl+C to stop both servers$( NC) "
59+ @mkdir -p $(DATA_DIR )
60+ @ (trap ' kill 0' EXIT; \
61+ go run ./cmd/shadowmaster-server -port $(PORT ) -data $(DATA_DIR ) -web $(WEB_DIR ) & \
62+ cd web/ui && npm run dev)
5463
5564dev : # # Run the server in development mode (with auto-reload if available)
5665 @echo " $( CYAN) Starting ShadowMaster server in development mode...$( NC) "
@@ -79,10 +88,9 @@ test-go: ## Run Go tests
7988 @go test -v ./...
8089
8190test-react : # # Run React tests
82- @echo " $( CYAN) Running React smoke test...$( NC) "
83- @cd web/app && npm test -- --watch=false
84- @echo " $( CYAN) Running React unit tests...$( NC) "
85- @cd web/app && npm run test:unit
91+ @echo " $( CYAN) Running React lint checks...$( NC) "
92+ @cd web/ui && npm install
93+ @cd web/ui && npm run lint
8694
8795test-coverage : # # Run tests with coverage
8896 @echo " $( CYAN) Running tests with coverage...$( NC) "
@@ -141,10 +149,5 @@ watch: ## Watch for file changes and rebuild (requires fswatch or similar)
141149 echo " $( YELLOW) Please install fswatch or entr for file watching$( NC) " ; \
142150 fi
143151
144- frontend-build : # # Build the React frontend bundle
145- @echo " $( CYAN) Building React frontend...$( NC) "
146- @cd web/app && npm run build
147- @echo " $( GREEN) ✓ Frontend bundle built$( NC) "
148-
149152.DEFAULT_GOAL := help
150153
0 commit comments