diff --git a/packages/mermaid/src/docs/.vitepress/contributors.ts b/packages/mermaid/src/docs/.vitepress/contributors.ts index a223a36df..bef2c1311 100644 --- a/packages/mermaid/src/docs/.vitepress/contributors.ts +++ b/packages/mermaid/src/docs/.vitepress/contributors.ts @@ -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 = {}; +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: '', }; 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 }; diff --git a/packages/mermaid/src/docs/.vitepress/scripts/fetch-contributors.ts b/packages/mermaid/src/docs/.vitepress/scripts/fetch-contributors.ts index a758bd76a..33513e690 100644 --- a/packages/mermaid/src/docs/.vitepress/scripts/fetch-contributors.ts +++ b/packages/mermaid/src/docs/.vitepress/scripts/fetch-contributors.ts @@ -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();