build: 修改frontend lint报错

This commit is contained in:
sophie committed 2026-10-15 15:13:10 +08:00
1 parent 22bee49346
commit 6c47d0639c
2 files changed
+18 -10

No files matched your search

Vendored
+12 -5
View File
@@ -360,11 +360,18 @@ pipeline {
steps {
echo '[Frontend Lint] FRONTEND_CHANGED=true,执行 npm run lint(Element 规则当前为 off)'
sh '''
set -e
docker run --rm \
-v "${WORKSPACE}:/repo" \
-w /repo \
node:22-alpine sh -c "chmod +x scripts/ci_frontend_lint.sh && ./scripts/ci_frontend_lint.sh"
set -eu
test -f "${WORKSPACE}/scripts/ci_frontend_lint.sh"
test -f "${WORKSPACE}/frontend/package.json"
# 不用 -v 挂载工作区:Jenkins 在容器里时,宿主机 Docker 看不到 /var/jenkins_home。
# 把前端源码和脚本打进容器再检查。node_modules 由容器内 npm ci 安装。
tar -C "${WORKSPACE}" \
--exclude=frontend/node_modules \
--exclude=frontend/dist \
-cf - \
frontend scripts/ci_frontend_lint.sh \
| docker run --rm -i node:22-alpine \
sh -c 'mkdir -p /repo && tar -xf - -C /repo && sh /repo/scripts/ci_frontend_lint.sh'
'''
}
}
+6 -5
View File
@@ -1,13 +1,14 @@
#!/usr/bin/env bash
#!/bin/sh
# Jenkins 前端风格检查。只跑 npm run lint,不跑 build。
# 用 /bin/sh,因为 node:22-alpine 里没有 bash。
# Element 规则当前是 off,本脚本应通过。启用方式见 docs/ui/ELEMENT_MIGRATION.md §9.2。
set -euo pipefail
set -eu
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
ROOT_DIR="$(cd "${SCRIPT_DIR}/.." && pwd)"
SCRIPT_DIR="$(CDPATH= cd -- "$(dirname "$0")" && pwd)"
ROOT_DIR="$(CDPATH= cd -- "${SCRIPT_DIR}/.." && pwd)"
FRONTEND_DIR="${ROOT_DIR}/frontend"
if [[ ! -f "${FRONTEND_DIR}/package.json" ]]; then
if [ ! -f "${FRONTEND_DIR}/package.json" ]; then
echo "[ci-frontend-lint] missing ${FRONTEND_DIR}/package.json"
exit 1
fi