浏览代码

领导关怀替换

CzRger 1 年之前
父节点
当前提交
cb53c60dc0
共有 5 个文件被更改,包括 31 次插入2 次删除
  1. 1 1
      package.json
  2. 29 0
      preBuild.js
  3. 1 1
      src/App.vue
  4. 二进制
      src/views/common/img/info-main-2.png
  5. 二进制
      src/views/common/img/ldgh-son_2.png

+ 1 - 1
package.json

@@ -5,7 +5,7 @@
   "type": "module",
   "scripts": {
     "dev": "vite",
-    "build": "vite build --mode development",
+    "build": "node preBuild.js && vite build --mode development",
     "preview": "vite preview"
   },
   "dependencies": {

+ 29 - 0
preBuild.js

@@ -0,0 +1,29 @@
+import * as child_process from 'child_process'
+import * as fs from 'fs'
+import dayjs from 'dayjs'
+
+let commitId = child_process.execSync(`git log -n1 --format=format:"%H"`).toString();
+let commitUser = child_process.execSync(`git log -n1 --format=format:"%an"`).toString();
+let commitBranch = child_process.execSync(`git log -n1 --format=format:"%d"`).toString().trim();
+let commitTime = child_process.execSync(`git log -n1 --pretty=format:"%ad" --date=iso`).toString().substring(0, 19);
+let buildUser = child_process.execSync(`git config user.name`).toString().trim();
+
+// const txt = `提交ID:${commitId}
+// 提交用户:${commitUser}
+// 提交分支:${commitBranch}
+// 提交时间:${commitTime}
+// 打包用户:${buildUser}
+// 打包时间:${dayjs(new Date()).format('YYYY-MM-DD HH:mm:ss')}
+// `
+const j = {
+  '提交ID:': commitId,
+  '提交用户:': commitUser,
+  '提交分支:': commitBranch,
+  '提交时间:': commitTime,
+  '打包用户:': buildUser,
+  '打包时间:': dayjs(new Date()).format('YYYY-MM-DD HH:mm:ss'),
+}
+
+fs.writeFileSync('./src/out/git_info.json', JSON.stringify(j));
+
+console.log('========== Save git info done. ==========');

+ 1 - 1
src/App.vue

@@ -16,7 +16,7 @@ import {
 } from 'vue'
 import {useStore} from 'vuex'
 import {ElConfigProvider} from 'element-plus'
-import zhLocale from 'element-plus/lib/locale/lang/zh-cn'
+import zhLocale from 'element-plus/es/locale/lang/zh-cn'
 export default defineComponent({
   name: 'App',
   components: {

二进制
src/views/common/img/info-main-2.png


二进制
src/views/common/img/ldgh-son_2.png