Files
agents/Makefile
T
2026-10-13 15:30:11 +07:00

55 lines
1.8 KiB
Makefile

.PHONY: check build prod-build publish dev game stop venue venue-update venue-https
PROD_DIR ?= prod
build:
$(MAKE) -C evening_detective_server build-linux
@test -n "$(PROD_DIR)"
@set -e; for dir in "$(PROD_DIR)" venue; do \
mkdir -p "$$dir/backend" "$$dir/frontend/dist"; \
rm -rf "$$dir/migrations"; \
mkdir -p "$$dir/migrations"; \
cp evening_detective_server/bin/evening_detective_server "$$dir/backend/evening_detective_server"; \
cp evening_detective_server/migrations/*.sql "$$dir/migrations/"; \
done
CGO_ENABLED=0 GOBIN="$(abspath venue/backend)" go install github.com/pressly/goose/v3/cmd/goose@v3.27.1
cp evening_detective_server/scripts/dev-user.sql venue/backend/dev-user.sql
npm --prefix evening_detective_frontend run type-check
npm --prefix evening_detective_frontend run build-only -- --outDir "$(abspath $(PROD_DIR)/frontend/dist)" --emptyOutDir
VITE_API_URL=/. npm --prefix evening_detective_frontend run build-only -- --outDir "$(abspath venue/frontend/dist)" --emptyOutDir
prod-build: build
venue:
bash venue/deploy.sh
venue-update venue-https: venue
dev:
bash scripts/dev.sh
game: venue
stop:
docker compose -f venue/docker-compose.yml -f venue/docker-compose.https.yml --env-file venue/.env down
publish:
@test -n "$(MSG)" || (echo 'Usage: make publish MSG="commit message"' >&2; exit 1)
@$(MAKE) build
@set -e; \
for repo in . evening_detective_server evening_detective_frontend; do \
git -C "$$repo" add -A; \
if git -C "$$repo" diff --cached --quiet; then \
echo "$$repo: no changes"; \
continue; \
fi; \
git -C "$$repo" commit -m "$(MSG)"; \
git -C "$$repo" push; \
done
check:
$(MAKE) -C evening_detective_server test
npm --prefix evening_detective_frontend run type-check
npm --prefix evening_detective_frontend run lint
npm --prefix evening_detective_frontend run lint:css