ant-design/scripts/generate-authors.ts
lijianan 5183e5d64a
chore: update authors list (#44694)
* chore: update authors list

* chore: fix

* Update scripts/generate-authors.ts

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

* chore: fix

---------

Signed-off-by: lijianan <574980606@qq.com>
Co-authored-by: afc163 <afc163@gmail.com>
2023-09-07 20:55:34 +08:00

44 lines
881 B
TypeScript

import fs from 'fs';
import path from 'path';
import _ from 'lodash';
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 { all } = await git.log();
all = _.remove(all, ({ author_email: email }) => {
for (let i = 0; i < excludes.length; i++) {
const item = excludes[i];
if (email.includes(item)) {
return false;
}
}
return true;
});
all = _.sortBy(_.unionBy(all, 'author_email'), 'author_name');
fs.writeFileSync(
path.join(cwd, 'contributors.json'),
JSON.stringify(
Array.from(new Set<string>(all.map((authorItem) => authorItem.author_name))),
null,
2,
),
);
}
execute();