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 {
name: string;
@ -11,10 +11,10 @@ export interface SocialEntry {
}
export interface CoreTeam {
avatar: string;
name: string;
// required to download avatars from GitHub
github: string;
avatar?: string;
twitter?: string;
mastodon?: string;
sponsor?: string;
@ -26,20 +26,18 @@ export interface CoreTeam {
links?: SocialEntry[];
}
const contributorNames: string[] = contributorNamesJson;
const contributorsAvatars: Record<string, string> = {};
const contributorUsernames: string[] = contributorUsernamesJson;
export const contributors = (contributorNames as string[]).reduce((acc, name) => {
contributorsAvatars[name] = `/user-avatars/${name}.png`;
acc.push({ name, avatar: contributorsAvatars[name] });
return acc;
}, [] as Contributor[]);
export const contributors = contributorUsernames.map((username) => {
return { username, avatar: `/user-avatars/${username}.png` };
});
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>',
};
const createLinks = (tm: CoreTeam): CoreTeam => {
tm.avatar = `/user-avatars/${tm.github}.png`;
tm.links = [{ icon: 'github', link: `https://github.com/${tm.github}` }];
if (tm.mastodon) {
tm.links.push({ icon: 'mastodon', link: tm.mastodon });
@ -56,30 +54,27 @@ const createLinks = (tm: CoreTeam): CoreTeam => {
return tm;
};
const knut: CoreTeam = {
github: 'knsv',
name: 'Knut Sveidqvist',
title: 'Creator',
twitter: 'knutsveidqvist',
sponsor: 'https://github.com/sponsors/knsv',
};
const plainTeamMembers: CoreTeam[] = [
{
github: 'knsv',
avatar: contributorsAvatars.knsv,
name: 'Knut Sveidqvist',
title: 'Creator',
twitter: 'knutsveidqvist',
sponsor: 'https://github.com/sponsors/knsv',
},
{
github: 'NeilCuzon',
avatar: contributorsAvatars.NeilCuzon,
name: 'Neil Cuzon',
title: 'Developer',
},
{
github: 'tylerlong',
avatar: contributorsAvatars.tylerlong,
name: 'Tyler Liu',
title: 'Developer',
},
{
github: 'sidharthv96',
avatar: contributorsAvatars.sidharthv96,
name: 'Sidharth Vinod',
title: 'Developer',
twitter: 'sidv42',
@ -90,20 +85,17 @@ const plainTeamMembers: CoreTeam[] = [
},
{
github: 'ashishjain0512',
avatar: contributorsAvatars.ashishjain0512,
name: 'Ashish Jain',
title: 'Developer',
},
{
github: 'mmorel-35',
avatar: contributorsAvatars['mmorel-35'],
name: 'Matthieu Morel',
title: 'Developer',
linkedIn: 'matthieumorel35',
},
{
github: 'aloisklink',
avatar: contributorsAvatars.aloisklink,
name: 'Alois Klink',
title: 'Developer',
linkedIn: 'aloisklink',
@ -111,50 +103,46 @@ const plainTeamMembers: CoreTeam[] = [
},
{
github: 'pbrolin47',
avatar: contributorsAvatars.pbrolin47,
name: 'Per Brolin',
title: 'Developer',
},
{
github: 'Yash-Singh1',
avatar: contributorsAvatars['Yash-Singh1'],
name: 'Yash Singh',
title: 'Developer',
},
{
github: 'GDFaber',
avatar: contributorsAvatars.GDFaber,
name: 'Marc Faber',
title: 'Developer',
linkedIn: 'marc-faber',
},
{
github: 'MindaugasLaganeckas',
avatar: contributorsAvatars.MindaugasLaganeckas,
name: 'Mindaugas Laganeckas',
title: 'Developer',
},
{
github: 'jgreywolf',
avatar: contributorsAvatars.jgreywolf,
name: 'Justin Greywolf',
title: 'Developer',
},
{
github: 'IOrlandoni',
avatar: contributorsAvatars.IOrlandoni,
name: 'Nacho Orlandoni',
title: 'Developer',
},
{
github: 'huynhicode',
avatar: contributorsAvatars.huynhicode,
name: 'Steph Huynh',
title: 'Developer',
},
];
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 };

View File

@ -32,7 +32,7 @@ async function fetchContributors() {
async function generate() {
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();