From c10e4c5d096952cba910621a58d1d56f020c8b5a Mon Sep 17 00:00:00 2001 From: seechi-yolo Date: Thu, 27 Aug 2026 00:54:26 +0000 Subject: [PATCH] fix(build): emit UI_VERSION in prettier-compliant form Always wrapping the export broke short branch names (zjrc_3.2408) with prettier/prettier Delete newline. Wrap only when the one-line assignment exceeds printWidth 80. Co-authored-by: Cursor --- scripts/getGitVersion.mjs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/scripts/getGitVersion.mjs b/scripts/getGitVersion.mjs index b903ef545..dd2c77c67 100644 --- a/scripts/getGitVersion.mjs +++ b/scripts/getGitVersion.mjs @@ -12,6 +12,12 @@ const commitId = execSync('git rev-parse --short HEAD', { version = `${branch.split('\n')[0]} ${commitId.split('\n')[0]}`; const filePath = resolve(process.cwd(), './src/scripts/version.ts'); -// 长分支名单行会触发 prettier printWidth,拆成多行避免 docker_build_ee 失败 -const command = `export const UI_VERSION =\n '${version}';\n`; +// 与 .eslintrc.json prettier/prettier.printWidth 保持一致: +// 短分支名单行即可;超过 80 才拆行。一律拆行会在短分支上触发 Delete ⏎。 +const PRINT_WIDTH = 80; +const oneLine = `export const UI_VERSION = '${version}';`; +const command = + oneLine.length > PRINT_WIDTH + ? `export const UI_VERSION =\n '${version}';\n` + : `${oneLine}\n`; writeFileSync(filePath, command);