2022-02-26 10:34:36 -05:00
|
|
|
import contributors from '@dianmora/contributors';
|
2022-02-15 16:18:20 -05:00
|
|
|
import fs from 'fs/promises';
|
|
|
|
import path from 'path';
|
|
|
|
|
|
|
|
const token = process.env.TOKEN;
|
2022-08-27 12:24:57 -05:00
|
|
|
const excludedAccounts = [
|
2022-02-15 16:18:20 -05:00
|
|
|
'verdacciobot',
|
2022-04-16 05:26:02 -05:00
|
|
|
'github-actions[bot]',
|
2022-02-15 16:18:20 -05:00
|
|
|
'dependabot-preview[bot]',
|
|
|
|
'dependabot[bot]',
|
|
|
|
'64b2b6d12bfe4baae7dad3d01',
|
|
|
|
'greenkeeper[bot]',
|
|
|
|
'snyk-bot',
|
|
|
|
'allcontributors[bot]',
|
|
|
|
'renovate[bot]',
|
|
|
|
'undefined',
|
|
|
|
'renovate-bot',
|
|
|
|
];
|
|
|
|
|
|
|
|
(async () => {
|
|
|
|
try {
|
|
|
|
// Awesome script made by https://github.com/dianmorales
|
|
|
|
const result = await contributors({
|
2022-03-08 11:51:34 -05:00
|
|
|
token: token as string,
|
2022-02-15 16:18:20 -05:00
|
|
|
organization: 'verdaccio',
|
2022-08-27 12:24:57 -05:00
|
|
|
excludedAccounts,
|
2022-02-15 16:18:20 -05:00
|
|
|
allowFork: false,
|
|
|
|
allowPrivateRepo: false,
|
|
|
|
});
|
|
|
|
const pathContributorsFile = path.join(
|
|
|
|
__dirname,
|
|
|
|
'../packages/tools/docusaurus-plugin-contributors/src/contributors.json'
|
|
|
|
);
|
2022-04-16 05:26:02 -05:00
|
|
|
// for the website
|
2022-02-15 16:18:20 -05:00
|
|
|
await fs.writeFile(pathContributorsFile, JSON.stringify(result, null, 4));
|
2022-08-27 12:24:57 -05:00
|
|
|
const contributorsListId = result.contributors.map((contributor: any) => {
|
2022-04-16 05:26:02 -05:00
|
|
|
return { username: contributor?.login, id: contributor.id };
|
|
|
|
});
|
|
|
|
// for the ui, list of ids to be added on the contributors.
|
|
|
|
const pathContributorsUIFile = path.join(
|
|
|
|
__dirname,
|
2023-01-02 14:13:45 -05:00
|
|
|
'../packages/plugins/ui-theme/src/components/Contributors/generated_contributors_list.json'
|
2022-04-16 05:26:02 -05:00
|
|
|
);
|
|
|
|
await fs.writeFile(pathContributorsUIFile, JSON.stringify(contributorsListId, null, 4));
|
2022-02-15 16:18:20 -05:00
|
|
|
} catch (err) {
|
|
|
|
// eslint-disable-next-line no-console
|
|
|
|
console.error('error on update', err);
|
|
|
|
process.exit(1);
|
|
|
|
}
|
|
|
|
})();
|