2020-10-10 10:34:41 +08:00
|
|
|
const path = require('path');
|
|
|
|
const fs = require('fs');
|
2022-03-13 17:33:25 +08:00
|
|
|
const simpleGit = require('simple-git');
|
2020-10-10 10:34:41 +08:00
|
|
|
const _ = require('lodash');
|
|
|
|
|
|
|
|
const cwd = process.cwd();
|
|
|
|
const git = simpleGit(cwd);
|
|
|
|
|
|
|
|
const excludes = [
|
|
|
|
'users.noreply.github.com',
|
|
|
|
'gitter.im',
|
|
|
|
'.local',
|
|
|
|
'alibaba-inc.com',
|
|
|
|
'alipay.com',
|
|
|
|
'taobao.com',
|
2021-02-28 14:03:31 +08:00
|
|
|
'ant-design-bot',
|
2020-10-10 10:34:41 +08:00
|
|
|
];
|
|
|
|
|
|
|
|
async function execute() {
|
|
|
|
let logs = (await git.log()).all;
|
|
|
|
logs = _.remove(logs, ({ author_email: email }) => {
|
|
|
|
for (let i = 0; i < excludes.length; i++) {
|
|
|
|
const item = excludes[i];
|
2022-10-21 11:45:55 +08:00
|
|
|
if (email.includes(item)) {
|
2020-10-10 10:34:41 +08:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
});
|
|
|
|
logs = _.sortBy(_.unionBy(logs, 'author_email'), 'author_name');
|
|
|
|
fs.writeFileSync(
|
|
|
|
path.join(cwd, 'AUTHORS.txt'),
|
2022-11-19 13:47:33 +08:00
|
|
|
logs.map((item) => `${item.author_name} <${item.author_email}>`).join('\n'),
|
2020-10-10 10:34:41 +08:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
execute();
|