fix: Command failed: git rev-parse --abbrev-ref HEAD

This commit is contained in:
菲鸽 2024-06-19 14:09:12 +08:00
parent 247ad78dbf
commit 12fd82778e
2 changed files with 2 additions and 6 deletions

View File

@ -1,5 +1,5 @@
<!doctype html>
<html build-time="%BUILD_TIME%" build-branch="%BUILD_BRANCH%">
<html build-time="%BUILD_TIME%">
<head>
<meta charset="UTF-8" />
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />

View File

@ -92,11 +92,7 @@ export default ({ command, mode }) => {
UNI_PLATFORM === 'h5' && {
name: 'html-transform',
transformIndexHtml(html) {
const branch = execSync('git rev-parse --abbrev-ref HEAD').toString().trim()
console.log('branch -> ', branch)
return html
.replace('%BUILD_TIME%', dayjs().format('YYYY-MM-DD HH:mm:ss'))
.replace('%BUILD_BRANCH%', branch)
return html.replace('%BUILD_TIME%', dayjs().format('YYYY-MM-DD HH:mm:ss'))
},
},
// 打包分析插件h5 + 生产环境才弹出