You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
WebCAD/utils/log.ts

37 lines
823 B

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,
5 years ago
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/"));