dedsudiyu преди 1 година
родител
ревизия
aca9cc4600
променени са 1 файла, в които са добавени 7 реда и са изтрити 8 реда
  1. 7 8
      vue.config.js

+ 7 - 8
vue.config.js

@@ -1,17 +1,16 @@
 'use strict'
 const path = require('path')
 
-/******** 获取git版本信息 ********/
+// 获取git版本信息
 const fs = require("fs")
-let getFile = fs.existsSync('.git')
-const gitHEAD = getFile?fs.readFileSync('.git/HEAD', 'utf-8').trim():false
-const ref = !gitHEAD?false:gitHEAD.split(': ')[1]
-const develop = !gitHEAD?false:gitHEAD.split('/')[2]
-const gitVersion = !ref?false:fs.readFileSync('.git/' + ref, 'utf-8').trim()
-const buildEdition = develop&&gitVersion?develop + ': ' + gitVersion:'未配置'
+const gitHEAD = fs.readFileSync('.git/HEAD', 'utf-8').trim()
+const ref = gitHEAD.split(': ')[1]
+const develop = gitHEAD.split('/')[2]
+const gitVersion = fs.readFileSync('.git/' + ref, 'utf-8').trim()
+const buildEdition = develop + ': ' + gitVersion
 const myDate = new Date();
 const buildTime = myDate.getFullYear() +'-'+ (myDate.getMonth()+1) +'-'+ myDate.getDate() +' '+ myDate.getHours() +':'+ myDate.getMinutes();
-const buildUser = getFile?fs.readFileSync('.git/logs/HEAD', 'utf-8').match(/<(\S*)>/)[1].match(/\+(\S*)@/)[1]:'未配置'
+const buildUser = fs.readFileSync('.git/logs/HEAD', 'utf-8').match(/<(\S*)>/)[1].match(/\+(\S*)@/)[1]
 
 function resolve(dir) {
   return path.join(__dirname, dir)