0
0
mirror of https://github.com/sveltejs/svelte.git synced 2024-12-01 17:30:59 +01:00
svelte/site/scripts/get-contributors.js
2018-12-24 22:29:49 -05:00

16 lines
540 B
JavaScript

const fs = require('fs');
const fetch = require('node-fetch');
process.chdir(__dirname);
fetch(`https://api.github.com/repos/sveltejs/svelte/stats/contributors`)
.then(r => r.json())
.then(contributors => {
const munged = contributors
.sort((a, b) => b.total - a.total)
.map(({ author }) => ({ name: author.login, src: author.avatar_url }));
const str = `[\n\t${munged.map(c => `{ name: '${c.name}', src: '${c.src}' }`).join(',\n\t')}\n]`;
fs.writeFileSync(`../src/routes/_contributors.js`, `export default ${str};`);
});