import fs from 'fs'; import gitlog, { GitlogOptions } from 'gitlog'; import { resolve } from "path"; import { copyFileSync } from "./utils"; const options: GitlogOptions = { 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.slice(0, -9) }; }).filter(log => log.subject.indexOf("开发") === -1); fs.writeFile("./dist/log.json", JSON.stringify(cs, null, 2), function (err) { if (err) console.log("日志写入失败", err); else console.log("日志写入成功"); }); copyFileSync(resolve("./utils/log.html"), resolve("./dist/"));