import { resolve } from "path"; import { copyFileSync } from "./utils"; const gitlog = require('gitlog'); const options = { repo: __dirname , number: 50 , fields: ['subject', 'authorName', "authorDate"] , execOptions: { maxBuffer: 1000 * 1024 } }; let commits = gitlog(options); let cs = commits.map(c => { return { subject: c.subject, auther: c.authorName, time: c.authorDate } }); const fs = require('fs'); fs.writeFile("./dist/log.json", JSON.stringify(cs, null, 2), function (err) { if (err) console.log("日志写入失败", err); else console.log("日志写入成功"); }); fs.writeFile("./dist/ver.json", Date.now(), err => { if (err) console.log("版本写入失败", err); else console.log("版本写入成功"); }); copyFileSync(resolve("./utils/log.html"), resolve("./dist/"));