|
@@ -1,7 +1,7 @@
|
|
|
/** 自动记录版本信息**/
|
|
|
-import { writeFile } from 'fs'
|
|
|
+const fs = require('fs')
|
|
|
const buildPath = process.env.npm_package_remote_local //放置 version.txt的路径
|
|
|
-import { execSync } from 'child_process' //同步子进程
|
|
|
+const execSync = require('child_process').execSync //同步子进程
|
|
|
const date = new Date() // Date对象
|
|
|
|
|
|
// 获取时间函数
|
|
@@ -32,7 +32,7 @@ const email = execSync('git show -s --format=%ce')
|
|
|
.trim() //邮箱
|
|
|
//const date = execSync('git show -s --format=%cd').toString().trim(); //日期
|
|
|
const versionStr = `git:${commit}<${branch}>\n作者:${name}<${email}>\n日期:${getDate('-', ':')}\n说明:${message}\n`
|
|
|
-writeFile(`${buildPath}/version.txt`, versionStr, (err) => {
|
|
|
+fs.writeFile(`${buildPath}/version.txt`, versionStr, (err) => {
|
|
|
if (err) console.err('写入失败', err)
|
|
|
})
|
|
|
|