Skip to content

Commit

Permalink
Merge bd53e9d into 2dc780a
Browse files Browse the repository at this point in the history
  • Loading branch information
sidharthv96 committed May 9, 2023
2 parents 2dc780a + bd53e9d commit b38cb3c
Show file tree
Hide file tree
Showing 29 changed files with 3,143 additions and 552 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Expand Up @@ -36,3 +36,6 @@ tsconfig.tsbuildinfo
knsv*.html
local*.html
stats/

**/user-avatars/*
**/contributor-names.json
2 changes: 1 addition & 1 deletion .lintstagedrc.mjs
@@ -1,5 +1,5 @@
export default {
'!(docs/**/*)*.{ts,js,json,html,md,mts}': [
'!(docs/**/*)*.{ts,js,html,md,mts}': [
'eslint --cache --cache-strategy content --fix',
// don't cache prettier yet, since we use `prettier-plugin-jsdoc`,
// and prettier doesn't invalidate cache on plugin updates"
Expand Down
3 changes: 2 additions & 1 deletion .prettierignore
Expand Up @@ -4,4 +4,5 @@ cypress/platform/xss3.html
coverage
# Autogenerated by PNPM
pnpm-lock.yaml
stats
stats
packages/mermaid/src/docs/.vitepress/components.d.ts
16 changes: 15 additions & 1 deletion cSpell.json
Expand Up @@ -5,11 +5,13 @@
"acyclicer",
"adamiecki",
"alois",
"aloisklink",
"antiscript",
"appli",
"applitools",
"asciidoctor",
"ashish",
"ashishjain",
"astah",
"bbox",
"bilkent",
Expand Down Expand Up @@ -49,22 +51,27 @@
"grav",
"greywolf",
"huynh",
"huynhicode",
"inkdrop",
"jaoude",
"jgreywolf",
"jison",
"jiti",
"kaufmann",
"khroma",
"klemm",
"klink",
"knsv",
"knut",
"knutsveidqvist",
"laganeckas",
"linetype",
"lintstagedrc",
"logmsg",
"lucida",
"markdownish",
"matthieu",
"matthieumorel",
"mdast",
"mdbook",
"mermaidjs",
Expand All @@ -74,8 +81,11 @@
"mindmaps",
"mitigations",
"mkdocs",
"mmorel",
"mult",
"orlandoni",
"pathe",
"pbrolin",
"phpbb",
"plantuml",
"playfair",
Expand Down Expand Up @@ -112,14 +122,17 @@
"ts-nocheck",
"tsdoc",
"tuleap",
"tylerlong",
"ugge",
"unist",
"unocss",
"valign",
"verdana",
"viewports",
"vinod",
"visio",
"vitepress",
"vueuse",
"xlink",
"yash"
],
Expand Down Expand Up @@ -161,6 +174,7 @@
],
"ignorePaths": [
"packages/mermaid/src/docs/CHANGELOG.md",
"packages/mermaid/src/docs/.vitepress/redirect.ts"
"packages/mermaid/src/docs/.vitepress/redirect.ts",
"packages/mermaid/src/docs/.vitepress/contributor-names.json"
]
}
1 change: 1 addition & 0 deletions package.json
Expand Up @@ -26,6 +26,7 @@
"lint": "eslint --cache --cache-strategy content --ignore-path .gitignore . && pnpm lint:jison && prettier --cache --check .",
"lint:fix": "eslint --cache --cache-strategy content --fix --ignore-path .gitignore . && prettier --write . && ts-node-esm scripts/fixCSpell.ts",
"lint:jison": "ts-node-esm ./scripts/jison/lint.mts",
"contributors": "ts-node-esm scripts/updateContributors.ts",
"cypress": "cypress run",
"cypress:open": "cypress open",
"e2e": "start-server-and-test dev http://localhost:9000/ cypress",
Expand Down
5 changes: 4 additions & 1 deletion packages/mermaid/.gitignore
@@ -1,3 +1,6 @@
src/vitepress
src/docs/config/setup
README.*
README.*
src/docs/public/user-avatars/
src/docs/.vitepress/cache
src/docs/.vitepress/components.d.ts
4 changes: 2 additions & 2 deletions packages/mermaid/package.json
Expand Up @@ -28,8 +28,8 @@
"docs:build": "rimraf ../../docs && pnpm docs:spellcheck && pnpm docs:code && ts-node-esm src/docs.mts",
"docs:verify": "pnpm docs:spellcheck && pnpm docs:code && ts-node-esm src/docs.mts --verify",
"docs:pre:vitepress": "rimraf src/vitepress && pnpm docs:code && ts-node-esm src/docs.mts --vitepress",
"docs:build:vitepress": "pnpm docs:pre:vitepress && vitepress build src/vitepress && cpy --flat src/docs/landing/ ./src/vitepress/.vitepress/dist/landing",
"docs:dev": "pnpm docs:pre:vitepress && concurrently \"vitepress dev src/vitepress\" \"ts-node-esm src/docs.mts --watch --vitepress\"",
"docs:build:vitepress": "pnpm docs:pre:vitepress && (cd src/vitepress && pnpm --filter ./ install && pnpm run build) && cpy --flat src/docs/landing/ ./src/vitepress/.vitepress/dist/landing",
"docs:dev": "pnpm docs:pre:vitepress && concurrently \"pnpm --filter ./ src/vitepress dev\" \"ts-node-esm src/docs.mts --watch --vitepress\"",
"docs:serve": "pnpm docs:build:vitepress && vitepress serve src/vitepress",
"docs:spellcheck": "cspell --config ../../cSpell.json \"src/docs/**/*.md\"",
"release": "pnpm build",
Expand Down
10 changes: 8 additions & 2 deletions packages/mermaid/src/docs.mts
Expand Up @@ -362,9 +362,15 @@ const transformHtml = (filename: string) => {
};

const getGlobs = (globs: string[]): string[] => {
globs.push('!**/dist', '!**/redirect.spec.ts', '!**/landing');
globs.push(
'!**/dist',
'!**/redirect.spec.ts',
'!**/landing',
'!**/node_modules',
'!**/user-avatars'
);
if (!vitepress) {
globs.push('!**/.vitepress', '!**/vite.config.ts', '!src/docs/index.md');
globs.push('!**/.vitepress', '!**/vite.config.ts', '!src/docs/index.md', '!**/package.json');
}
return globs;
};
Expand Down
27 changes: 27 additions & 0 deletions packages/mermaid/src/docs/.vitepress/components/Contributors.vue
@@ -0,0 +1,27 @@
<script setup lang="ts">
import { contributors } from '../contributors';
</script>

<template>
<div flex="~ wrap gap2" justify-center>
<a
v-for="{ name, avatar } of contributors"
:key="name"
:href="`https://github.com/${name}`"
m-0
rel="noopener noreferrer"
:aria-label="`${name} on GitHub`"
>
<img
loading="lazy"
:src="avatar"
width="50"
height="50"
rounded-full
h-12
w-12
:alt="`${name}'s avatar`"
/>
</a>
</div>
</template>
26 changes: 26 additions & 0 deletions packages/mermaid/src/docs/.vitepress/components/HomePage.vue
@@ -0,0 +1,26 @@
<script setup lang="ts">
import { VPTeamMembers } from 'vitepress/theme';
import { teamMembers } from '../contributors';
</script>

<template>
<div class="content">
<div class="content-container">
<main class="main">
<div class="vp-doc" flex flex-col items-center mt-10>
<h2 id="meet-the-team" op50 font-normal p="t-10 b-2">Meet The Team</h2>
<div w-full p-10>
<VPTeamMembers size="small" :members="teamMembers" />
</div>
<h2 id="the-team" op50 font-normal pt-5 pb-2>Contributors</h2>
<p text-lg max-w-200 text-center leading-7>
<Contributors />
<br />
<a href="https://chat.vitest.dev" rel="noopener noreferrer">Join the community</a> and
get involved!
</p>
</div>
</main>
</div>
</div>
</template>
148 changes: 148 additions & 0 deletions packages/mermaid/src/docs/.vitepress/contributors.ts
@@ -0,0 +1,148 @@
import contributorUsernamesJson from './contributor-names.json';

export interface Contributor {
name: string;
avatar: string;
}

export interface SocialEntry {
icon: string | { svg: string };
link: string;
}

export interface CoreTeam {
name: string;
// required to download avatars from GitHub
github: string;
avatar?: string;
twitter?: string;
mastodon?: string;
sponsor?: string;
website?: string;
linkedIn?: string;
title?: string;
org?: string;
desc?: string;
links?: SocialEntry[];
}

const contributorUsernames: string[] = contributorUsernamesJson;

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 });
}
if (tm.twitter) {
tm.links.push({ icon: 'twitter', link: `https://twitter.com/${tm.twitter}` });
}
if (tm.website) {
tm.links.push({ icon: websiteSVG, link: tm.website });
}
if (tm.linkedIn) {
tm.links.push({ icon: 'linkedin', link: `https://www.linkedin.com/in/${tm.linkedIn}` });
}
return tm;
};

const knut: CoreTeam = {
github: 'knsv',
name: 'Knut Sveidqvist',
title: 'Creator',
twitter: 'knutsveidqvist',
sponsor: 'https://github.com/sponsors/knsv',
};

const plainTeamMembers: CoreTeam[] = [
{
github: 'NeilCuzon',
name: 'Neil Cuzon',
title: 'Developer',
},
{
github: 'tylerlong',
name: 'Tyler Liu',
title: 'Developer',
},
{
github: 'sidharthv96',
name: 'Sidharth Vinod',
title: 'Developer',
twitter: 'sidv42',
mastodon: 'https://techhub.social/@sidv',
sponsor: 'https://github.com/sponsors/sidharthv96',
linkedIn: 'sidharth-vinod',
website: 'https://sidharth.dev',
},
{
github: 'ashishjain0512',
name: 'Ashish Jain',
title: 'Developer',
},
{
github: 'mmorel-35',
name: 'Matthieu Morel',
title: 'Developer',
linkedIn: 'matthieumorel35',
},
{
github: 'aloisklink',
name: 'Alois Klink',
title: 'Developer',
linkedIn: 'aloisklink',
website: 'https://aloisklink.com',
},
{
github: 'pbrolin47',
name: 'Per Brolin',
title: 'Developer',
},
{
github: 'Yash-Singh1',
name: 'Yash Singh',
title: 'Developer',
},
{
github: 'GDFaber',
name: 'Marc Faber',
title: 'Developer',
linkedIn: 'marc-faber',
},
{
github: 'MindaugasLaganeckas',
name: 'Mindaugas Laganeckas',
title: 'Developer',
},
{
github: 'jgreywolf',
name: 'Justin Greywolf',
title: 'Developer',
},
{
github: 'IOrlandoni',
name: 'Nacho Orlandoni',
title: 'Developer',
},
{
github: 'huynhicode',
name: 'Steph Huynh',
title: 'Developer',
},
];

const teamMembers = plainTeamMembers.map((tm) => createLinks(tm));
teamMembers.sort(
(a, b) => contributorUsernames.indexOf(a.github) - contributorUsernames.indexOf(b.github)
);
teamMembers.unshift(createLinks(knut));

export { teamMembers };
33 changes: 33 additions & 0 deletions packages/mermaid/src/docs/.vitepress/scripts/fetch-avatars.ts
@@ -0,0 +1,33 @@
import { mkdir, writeFile, readFile } from 'node:fs/promises';
import { existsSync } from 'node:fs';
import { fileURLToPath } from 'url';

const pathContributors = new URL('../contributor-names.json', import.meta.url);
const getAvatarPath = (name: string) =>
new URL(`../../public/user-avatars/${name}.png`, import.meta.url);

let contributors: string[] = [];

async function download(url: string, fileName: URL) {
if (existsSync(fileName)) {
return;
}
// eslint-disable-next-line no-console
console.log('downloading', fileName);
try {
const image = await fetch(url);
await writeFile(fileName, Buffer.from(await image.arrayBuffer()));
} catch {}
}

async function fetchAvatars() {
await mkdir(fileURLToPath(new URL('..', getAvatarPath('none'))), { recursive: true });
contributors = JSON.parse(await readFile(pathContributors, { encoding: 'utf-8' }));
await Promise.allSettled(
contributors.map((name) =>
download(`https://github.com/${name}.png?size=100`, getAvatarPath(name))
)
);
}

fetchAvatars();

0 comments on commit b38cb3c

Please sign in to comment.