.PHONY: run build test test-be test-fe test-mp web-dev web-build clean

run:
	go run ./cmd/server

build: web-build
	go build -o bin/server ./cmd/server

web-dev:
	cd web && pnpm dev

web-build:
	cd web && pnpm install && pnpm build

test: test-be test-fe test-mp

test-be:
	go test ./... -count=1

# 后端测试即 MySQL 兼容性测试：CI 侧（Jenkinsfile Backend Test 阶段）拉起
# docker-compose.test.yml 的临时 mysql:8 后注入 MYSQL_TEST_* 环境变量跑全量，
# 由 internal/testdb 自动切换到 MySQL。本地 go test 无该组变量时自动回退内存 SQLite。

test-fe:
	cd web && pnpm test -- --run

# miniprogram：vitest 单测 + tsc 类型检查（e2e 需微信开发者工具，不在此跑）。
test-mp:
	cd miniprogram && npm test
	cd miniprogram && npm run typecheck

clean:
	go clean
	npx --yes rimraf web/dist web/node_modules
