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.
38 lines
829 B
38 lines
829 B
2 years ago
|
import fs from 'fs';
|
||
|
import _ from 'lodash';
|
||
|
import path from 'path';
|
||
|
import simpleGit from 'simple-git';
|
||
4 years ago
|
|
||
|
const cwd = process.cwd();
|
||
|
const git = simpleGit(cwd);
|
||
|
|
||
|
const excludes = [
|
||
|
'users.noreply.github.com',
|
||
|
'gitter.im',
|
||
|
'.local',
|
||
|
'alibaba-inc.com',
|
||
|
'alipay.com',
|
||
|
'taobao.com',
|
||
4 years ago
|
'ant-design-bot',
|
||
4 years ago
|
];
|
||
|
|
||
|
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];
|
||
2 years ago
|
if (email.includes(item)) {
|
||
4 years ago
|
return false;
|
||
|
}
|
||
|
}
|
||
|
return true;
|
||
|
});
|
||
|
logs = _.sortBy(_.unionBy(logs, 'author_email'), 'author_name');
|
||
|
fs.writeFileSync(
|
||
|
path.join(cwd, 'AUTHORS.txt'),
|
||
2 years ago
|
logs.map((item) => `${item.author_name} <${item.author_email}>`).join('\n'),
|
||
4 years ago
|
);
|
||
|
}
|
||
|
|
||
|
execute();
|