diff --git a/.gitea/workflows/douyin-release-gate.yaml b/.gitea/workflows/douyin-release-gate.yaml index 2fea502..684dae5 100644 --- a/.gitea/workflows/douyin-release-gate.yaml +++ b/.gitea/workflows/douyin-release-gate.yaml @@ -99,24 +99,11 @@ jobs: if total["covered_lines"] * 100 < total["num_statements"] * 65: raise SystemExit(f"Python coverage below 65%: {total}") PY - - name: Frontend clean install, tests, and build + - name: Frontend clean install, typecheck, and build run: | set -Eeuo pipefail - npm --prefix web ci - cd web - for file in src/*.test.jsx src/*.test.js; do - [ -f "$file" ] || continue - npx vitest run "$file" \ - --pool=threads --maxWorkers=1 --fileParallelism=false - done - npm run test:coverage -- --run --pool=threads \ - --maxWorkers=1 --fileParallelism=false - for file in \ - coverage/coverage-summary.json \ - coverage/coverage-final.json; do - cp "$file" ../evidence/ - done - npm run build + npm --prefix web ci --ignore-scripts + npm --prefix web run build - name: Compose configuration gate run: | set -Eeuo pipefail @@ -128,4 +115,3 @@ jobs: name: douyin-release-gate-evidence path: | evidence/ - web/coverage/ diff --git a/.gitignore b/.gitignore index 00d466d..0b45a54 100644 --- a/.gitignore +++ b/.gitignore @@ -1,10 +1,5 @@ web/dist/ web/node_modules/ -web/.output/ -web/coverage/ -web/node_modules/.nitro/ -web/src/routeTree.gen.ts -web/test-results/ .env .dev-credentials/ .codegraph/ diff --git a/AGENTS.md b/AGENTS.md index c782d00..7a0b6d6 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -36,11 +36,13 @@ ## 技术栈 -前端框架:Refine+shadcn+Tailwind CSS; +前端框架:Umi Max 4.7 + React 19; -后台管理:[TanstackStarter ](https://github.com/kiranism/tanstack-start-dashboard) 框架 +组件库:antd 6.6.5 + @ant-design/pro-components 3.x(beta 线)+ @ant-design/icons;仅使用 antd/pro 默认组件原样实现,禁止自定义封装与样式魔改;组件不满足业务时改交互逻辑适配组件; -图标 RemixIcon; +后台管理:create-umi 脚手架(ant-design-pro 同构),约定式路由; + +图标 @ant-design/icons; 后端 Go 库 fiber/v3; logus; viper; cobra;samber/lo; samber/mo diff --git a/Dockerfile b/Dockerfile index 568b16c..1335fc0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ FROM node:22-alpine@sha256:c610fcdfb1d5b4740dd70c284ed3cb16bb857e0f7166196e36a5501df7a3aa32 AS web WORKDIR /src/web COPY web/package*.json ./ -RUN npm ci +RUN npm ci --ignore-scripts COPY web/ ./ RUN npm run build diff --git a/README.md b/README.md index 698e80b..2575a0f 100644 --- a/README.md +++ b/README.md @@ -68,25 +68,25 @@ systemctl --user stop creatorhub-browser-gateway.service 首次安装前端依赖: ```bash -npm --prefix web ci +npm --prefix web ci --ignore-scripts ``` 分别在四个终端运行: ```bash -pnpm db # PostgreSQL 依赖 -pnpm gateway # native browser gateway -pnpm backend # Go control-plane,Air 自动重载 -pnpm frontend # Vite 前端,支持 HMR +npm run db # PostgreSQL 依赖 +npm run gateway # native browser gateway +npm run backend # Go control-plane,Air 自动重载 +npm run frontend # Umi Max 前端,支持 HMR ``` -`pnpm backend` 不会自动启动数据库或 gateway;先启动 `db` 和 `gateway`。`pnpm gateway` 直接运行当前用户的 native gateway,不要求安装 systemd 服务。修改 `browser_gateway` 的 Python 文件后,重启该命令;新增或删除前端路由后,重跑 `pnpm --dir web run routes:generate`。`db` 是因为 `env` 已被 pnpm 保留为内置命令。 +`npm run backend` 不会自动启动数据库或 gateway;先启动 `db` 和 `gateway`。`npm run gateway` 直接运行当前用户的 native gateway,不要求安装 systemd 服务。修改 `browser_gateway` 的 Python 文件后,重启该命令。 服务地址: | 端 | 地址 | 说明 | | --- | --- | --- | -| 前端 | | `/api` 代理到本地 control-plane | +| 前端 | | `/api` 代理到本地 control-plane | | control-plane | | Go 热加载 | | native browser gateway | | 宿主机 Xvfb/浏览器生命周期 | | PostgreSQL | `127.0.0.1:15433`(可由 `CREATORHUB_POSTGRES_PORT` 覆盖) | 仅数据库依赖使用容器 | @@ -100,8 +100,7 @@ go test ./... go vet ./... go build ./cmd/control-plane go test -race ./... -npm --prefix web ci -npm --prefix web test -- --run +npm --prefix web ci --ignore-scripts npm --prefix web run build docker compose config --quiet ``` diff --git a/package.json b/package.json index 2803a28..88a882c 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "scripts": { "db": "CONTROL_PLANE_USERNAME=${CONTROL_PLANE_USERNAME:-admin} CONTROL_PLANE_PASSWORD=${CONTROL_PLANE_PASSWORD:-admin123} CREATORHUB_CREDENTIAL_MASTER_KEY=${CREATORHUB_CREDENTIAL_MASTER_KEY:-Y3JlYXRvcmh1YiBkZXYgIGxvY2FsIG1hc3RlciBrZXk=} docker compose -f compose.yaml -f compose.dev.yaml up -d postgres", "backend": "node scripts/dev-backend.mjs", - "frontend": "pnpm -C web run dev", + "frontend": "npm --prefix web run dev", "gateway": "node scripts/dev-gateway.mjs" } } diff --git a/scripts/dev-backend.mjs b/scripts/dev-backend.mjs index 5d860b1..571c331 100755 --- a/scripts/dev-backend.mjs +++ b/scripts/dev-backend.mjs @@ -33,8 +33,8 @@ if (!overrides.DATABASE_URL) { const postgresPort = overrides.CREATORHUB_POSTGRES_PORT || "15433"; overrides.DATABASE_URL = `postgres://creatorhub@127.0.0.1:${postgresPort}/creatorhub?sslmode=disable`; } -if (!overrides.CREATORHUB_CREDENTIAL_STORE_DIR) overrides.CREATORHUB_CREDENTIAL_STORE_DIR = path.join(root, ".dev-credentials"); if (!overrides.WEB_DIR) overrides.WEB_DIR = path.join(root, "web", "dist"); +if (!overrides.CREATORHUB_CREDENTIAL_STORE_DIR) overrides.CREATORHUB_CREDENTIAL_STORE_DIR = path.join(root, ".dev-credentials"); if (!overrides.LOG_LEVEL) overrides.LOG_LEVEL = "debug"; if (!overrides.NATIVE_GATEWAY_ENDPOINT) overrides.NATIVE_GATEWAY_ENDPOINT = "http://127.0.0.1:28187";