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.
svelte/site/scripts/get-contributors.js

16 lines
540 B

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};`);
});