Simplify contributors

This commit is contained in:
Sidharth Vinod 2023-04-29 10:51:03 +05:30
parent cdc68d99fe
commit 9e0410e0d3
No known key found for this signature in database
GPG Key ID: FB5CCD378D3907CD
2 changed files with 20 additions and 32 deletions

View File

@ -1,4 +1,4 @@
import contributorNamesJson from './contributor-names.json'; import contributorUsernamesJson from './contributor-names.json';
export interface Contributor { export interface Contributor {
name: string; name: string;
@ -11,10 +11,10 @@ export interface SocialEntry {
} }
export interface CoreTeam { export interface CoreTeam {
avatar: string;
name: string; name: string;
// required to download avatars from GitHub // required to download avatars from GitHub
github: string; github: string;
avatar?: string;
twitter?: string; twitter?: string;
mastodon?: string; mastodon?: string;
sponsor?: string; sponsor?: string;
@ -26,20 +26,18 @@ export interface CoreTeam {
links?: SocialEntry[]; links?: SocialEntry[];
} }
const contributorNames: string[] = contributorNamesJson; const contributorUsernames: string[] = contributorUsernamesJson;
const contributorsAvatars: Record<string, string> = {};
export const contributors = (contributorNames as string[]).reduce((acc, name) => { export const contributors = contributorUsernames.map((username) => {
contributorsAvatars[name] = `/user-avatars/${name}.png`; return { username, avatar: `/user-avatars/${username}.png` };
acc.push({ name, avatar: contributorsAvatars[name] }); });
return acc;
}, [] as Contributor[]);
const websiteSVG = { const websiteSVG = {
svg: '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-globe"><circle cx="12" cy="12" r="10"></circle><line x1="2" y1="12" x2="22" y2="12"></line><path d="M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"></path></svg>', svg: '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-globe"><circle cx="12" cy="12" r="10"></circle><line x1="2" y1="12" x2="22" y2="12"></line><path d="M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"></path></svg>',
}; };
const createLinks = (tm: CoreTeam): CoreTeam => { const createLinks = (tm: CoreTeam): CoreTeam => {
tm.avatar = `/user-avatars/${tm.github}.png`;
tm.links = [{ icon: 'github', link: `https://github.com/${tm.github}` }]; tm.links = [{ icon: 'github', link: `https://github.com/${tm.github}` }];
if (tm.mastodon) { if (tm.mastodon) {
tm.links.push({ icon: 'mastodon', link: tm.mastodon }); tm.links.push({ icon: 'mastodon', link: tm.mastodon });
@ -56,30 +54,27 @@ const createLinks = (tm: CoreTeam): CoreTeam => {
return tm; return tm;
}; };
const knut: CoreTeam = {
github: 'knsv',
name: 'Knut Sveidqvist',
title: 'Creator',
twitter: 'knutsveidqvist',
sponsor: 'https://github.com/sponsors/knsv',
};
const plainTeamMembers: CoreTeam[] = [ const plainTeamMembers: CoreTeam[] = [
{
github: 'knsv',
avatar: contributorsAvatars.knsv,
name: 'Knut Sveidqvist',
title: 'Creator',
twitter: 'knutsveidqvist',
sponsor: 'https://github.com/sponsors/knsv',
},
{ {
github: 'NeilCuzon', github: 'NeilCuzon',
avatar: contributorsAvatars.NeilCuzon,
name: 'Neil Cuzon', name: 'Neil Cuzon',
title: 'Developer', title: 'Developer',
}, },
{ {
github: 'tylerlong', github: 'tylerlong',
avatar: contributorsAvatars.tylerlong,
name: 'Tyler Liu', name: 'Tyler Liu',
title: 'Developer', title: 'Developer',
}, },
{ {
github: 'sidharthv96', github: 'sidharthv96',
avatar: contributorsAvatars.sidharthv96,
name: 'Sidharth Vinod', name: 'Sidharth Vinod',
title: 'Developer', title: 'Developer',
twitter: 'sidv42', twitter: 'sidv42',
@ -90,20 +85,17 @@ const plainTeamMembers: CoreTeam[] = [
}, },
{ {
github: 'ashishjain0512', github: 'ashishjain0512',
avatar: contributorsAvatars.ashishjain0512,
name: 'Ashish Jain', name: 'Ashish Jain',
title: 'Developer', title: 'Developer',
}, },
{ {
github: 'mmorel-35', github: 'mmorel-35',
avatar: contributorsAvatars['mmorel-35'],
name: 'Matthieu Morel', name: 'Matthieu Morel',
title: 'Developer', title: 'Developer',
linkedIn: 'matthieumorel35', linkedIn: 'matthieumorel35',
}, },
{ {
github: 'aloisklink', github: 'aloisklink',
avatar: contributorsAvatars.aloisklink,
name: 'Alois Klink', name: 'Alois Klink',
title: 'Developer', title: 'Developer',
linkedIn: 'aloisklink', linkedIn: 'aloisklink',
@ -111,50 +103,46 @@ const plainTeamMembers: CoreTeam[] = [
}, },
{ {
github: 'pbrolin47', github: 'pbrolin47',
avatar: contributorsAvatars.pbrolin47,
name: 'Per Brolin', name: 'Per Brolin',
title: 'Developer', title: 'Developer',
}, },
{ {
github: 'Yash-Singh1', github: 'Yash-Singh1',
avatar: contributorsAvatars['Yash-Singh1'],
name: 'Yash Singh', name: 'Yash Singh',
title: 'Developer', title: 'Developer',
}, },
{ {
github: 'GDFaber', github: 'GDFaber',
avatar: contributorsAvatars.GDFaber,
name: 'Marc Faber', name: 'Marc Faber',
title: 'Developer', title: 'Developer',
linkedIn: 'marc-faber', linkedIn: 'marc-faber',
}, },
{ {
github: 'MindaugasLaganeckas', github: 'MindaugasLaganeckas',
avatar: contributorsAvatars.MindaugasLaganeckas,
name: 'Mindaugas Laganeckas', name: 'Mindaugas Laganeckas',
title: 'Developer', title: 'Developer',
}, },
{ {
github: 'jgreywolf', github: 'jgreywolf',
avatar: contributorsAvatars.jgreywolf,
name: 'Justin Greywolf', name: 'Justin Greywolf',
title: 'Developer', title: 'Developer',
}, },
{ {
github: 'IOrlandoni', github: 'IOrlandoni',
avatar: contributorsAvatars.IOrlandoni,
name: 'Nacho Orlandoni', name: 'Nacho Orlandoni',
title: 'Developer', title: 'Developer',
}, },
{ {
github: 'huynhicode', github: 'huynhicode',
avatar: contributorsAvatars.huynhicode,
name: 'Steph Huynh', name: 'Steph Huynh',
title: 'Developer', title: 'Developer',
}, },
]; ];
const teamMembers = plainTeamMembers.map((tm) => createLinks(tm)); const teamMembers = plainTeamMembers.map((tm) => createLinks(tm));
teamMembers.sort((a, b) => contributorNames.indexOf(a.github) - contributorNames.indexOf(b.github)); teamMembers.sort(
(a, b) => contributorUsernames.indexOf(a.github) - contributorUsernames.indexOf(b.github)
);
teamMembers.unshift(createLinks(knut));
export { teamMembers }; export { teamMembers };

View File

@ -32,7 +32,7 @@ async function fetchContributors() {
async function generate() { async function generate() {
const collaborators = await fetchContributors(); const collaborators = await fetchContributors();
await writeFile(pathContributors, JSON.stringify(collaborators, null, 2), 'utf8'); await writeFile(pathContributors, JSON.stringify(collaborators, null, 2) + '\n', 'utf8');
} }
void generate(); void generate();