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

46 lines
948 B

import { resolve } from "path";
import { copyFileSync } from "./utils";
import gitlog, { GitlogOptions } from 'gitlog';
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)
};
});
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/"));