From 07795461cd20de11ddad904c3d5f587f640390f9 Mon Sep 17 00:00:00 2001 From: zhangtao <9480807882@qq.com> Date: Sun, 4 Oct 2026 06:16:59 +0800 Subject: [PATCH] =?UTF-8?q?ci(frontend):=20=E7=B1=BB=E5=9E=8B=E6=A3=80?= =?UTF-8?q?=E6=9F=A5=E5=89=8D=E5=85=88=E6=89=A7=E8=A1=8C=E7=94=9F=E4=BA=A7?= =?UTF-8?q?=E6=9E=84=E5=BB=BA=E4=BB=A5=E7=94=9F=E6=88=90=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E5=AF=BC=E5=85=A5=E5=A3=B0=E6=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 干净检出下 src/types/{auto-imports,components}.d.ts 不存在(由 unplugin-* 在 vite 运行时生成、仓库不跟踪),vue-tsc 会因缺少自动导入声明报大量 TS2304 (ref / h / onMounted / ElMessage / useTable…),导致 web job 在 CI 上必然失败; 本地因存在生成文件而一直为绿。 修复:在「类型检查」前增加「生产构建」步骤(顺便把生产构建纳入 CI 校验)。 已验证:清空生成文件 → build:prod 退出码 0 且重新生成 d.ts → type-check 0 错误 → vitest 41 passed;app job 不需要生成文件,保持不变。 --- .github/workflows/frontend-ci.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/frontend-ci.yml b/.github/workflows/frontend-ci.yml index e17a2bce..e125d3fe 100644 --- a/.github/workflows/frontend-ci.yml +++ b/.github/workflows/frontend-ci.yml @@ -34,6 +34,13 @@ jobs: - name: 安装依赖 run: pnpm install --frozen-lockfile + # src/types/{auto-imports,components}.d.ts 由 unplugin-* 在 vite 运行时生成, + # 仓库按惯例不跟踪(见 frontend/web/.gitignore)。干净检出下 vue-tsc 会因缺少 + # 自动导入声明报大量 TS2304(ref/h/onMounted/ElMessage…),因此必须先跑一次构建 + # 生成这些声明,再执行类型检查。顺带把生产构建纳入 CI 校验。 + - name: 生产构建(生成自动导入声明) + run: pnpm run build:prod + - name: 类型检查 run: pnpm run type-check