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);