- 删除通用 desktop target,重命名 platform targets 为简短形式 (desktop-mac/win/linux)
- 构建产物文件名统一为 nex-{os}-{arch}[.exe] 格式
- Windows 托盘图标使用 .ico 格式(运行时按平台选择)
- Windows 原生对话框使用 user32.MessageBoxW 替代 msg * 命令
- 更新 README.md 和 package-macos.sh 中的引用
- 添加单元测试覆盖 MessageBoxW 封装和图标选择逻辑
- 同步更新 desktop-app spec 规范文档
113 lines
3.2 KiB
Makefile
113 lines
3.2 KiB
Makefile
.PHONY: all clean \
|
|
backend-build backend-run backend-test backend-test-unit backend-test-integration backend-test-coverage \
|
|
backend-lint backend-deps backend-generate \
|
|
backend-migrate-up backend-migrate-down backend-migrate-status backend-migrate-create \
|
|
frontend-build frontend-dev frontend-test frontend-test-watch frontend-test-coverage frontend-test-e2e frontend-lint \
|
|
desktop-mac desktop-win desktop-linux package-macos
|
|
|
|
# ============================================
|
|
# 后端
|
|
# ============================================
|
|
|
|
all: backend-build
|
|
|
|
backend-build:
|
|
cd backend && go build -o bin/server ./cmd/server
|
|
|
|
backend-run:
|
|
cd backend && go run ./cmd/server
|
|
|
|
backend-test:
|
|
cd backend && go test ./... -v
|
|
|
|
backend-test-unit:
|
|
cd backend && go test ./internal/... ./pkg/... -v
|
|
|
|
backend-test-integration:
|
|
cd backend && go test ./tests/... -v
|
|
|
|
backend-test-coverage:
|
|
cd backend && go test ./... -coverprofile=coverage.out
|
|
cd backend && go tool cover -html=coverage.out -o coverage.html
|
|
@echo "Coverage report generated: backend/coverage.html"
|
|
|
|
backend-lint:
|
|
cd backend && go tool golangci-lint run ./...
|
|
|
|
backend-deps:
|
|
cd backend && go mod tidy
|
|
|
|
backend-generate:
|
|
cd backend && go generate ./...
|
|
|
|
backend-migrate-up:
|
|
cd backend && goose -dir migrations sqlite3 $(DB_PATH) up
|
|
|
|
backend-migrate-down:
|
|
cd backend && goose -dir migrations sqlite3 $(DB_PATH) down
|
|
|
|
backend-migrate-status:
|
|
cd backend && goose -dir migrations sqlite3 $(DB_PATH) status
|
|
|
|
backend-migrate-create:
|
|
@read -p "Migration name: " name; \
|
|
cd backend && goose -dir migrations create $$name sql
|
|
|
|
# ============================================
|
|
# 前端
|
|
# ============================================
|
|
|
|
frontend-build:
|
|
cd frontend && bun install && bun run build
|
|
|
|
frontend-dev:
|
|
cd frontend && bun dev
|
|
|
|
frontend-test:
|
|
cd frontend && bun run test
|
|
|
|
frontend-test-watch:
|
|
cd frontend && bun run test:watch
|
|
|
|
frontend-test-coverage:
|
|
cd frontend && bun run test:coverage
|
|
|
|
frontend-test-e2e:
|
|
cd frontend && bun run test:e2e
|
|
|
|
frontend-lint:
|
|
cd frontend && bun run lint
|
|
|
|
# ============================================
|
|
# 桌面应用
|
|
# ============================================
|
|
|
|
frontend-build-desktop:
|
|
cd frontend && cp .env.desktop .env.production.local && bun install && bun run build && rm -f .env.production.local
|
|
|
|
embedfs-prepare:
|
|
rm -rf embedfs/assets embedfs/frontend-dist
|
|
cp -r assets embedfs/assets
|
|
cp -r frontend/dist embedfs/frontend-dist
|
|
|
|
desktop-mac: frontend-build-desktop embedfs-prepare
|
|
cd backend && CGO_ENABLED=1 GOOS=darwin GOARCH=arm64 go build -o ../build/nex-mac-arm64 ./cmd/desktop
|
|
cd backend && CGO_ENABLED=1 GOOS=darwin GOARCH=amd64 go build -o ../build/nex-mac-amd64 ./cmd/desktop
|
|
|
|
desktop-win: frontend-build-desktop embedfs-prepare
|
|
cd backend && CGO_ENABLED=1 GOOS=windows GOARCH=amd64 go build -ldflags "-H=windowsgui" -o ../build/nex-win-amd64.exe ./cmd/desktop
|
|
|
|
desktop-linux: frontend-build-desktop embedfs-prepare
|
|
cd backend && CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -o ../build/nex-linux-amd64 ./cmd/desktop
|
|
|
|
package-macos:
|
|
./scripts/build/package-macos.sh
|
|
|
|
# ============================================
|
|
# 清理
|
|
# ============================================
|
|
|
|
clean:
|
|
rm -rf backend/bin/ backend/coverage.out backend/coverage.html
|
|
rm -rf build/
|