ant-design/scripts/generate-authors.ts
kiner-tang(文辉) 484521e546
chore: remove email from AUTHORS.txt (#43740)
* chore: remove email from AUTHORS.txt

* Update scripts/generate-authors.ts

Co-authored-by: lijianan <574980606@qq.com>
Signed-off-by: afc163 <afc163@gmail.com>

---------

Signed-off-by: afc163 <afc163@gmail.com>
Co-authored-by: afc163 <afc163@gmail.com>
Co-authored-by: lijianan <574980606@qq.com>
2023-07-24 12:01:33 +08:00

38 lines
822 B
TypeScript

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