Skip to content

Commit

Permalink
docs: add team emeriti and update the sidebar and navigation (#5169)
Browse files Browse the repository at this point in the history
Co-authored-by: userquin <[email protected]>
  • Loading branch information
sheremet-va and userquin authored Feb 12, 2024
1 parent 4e17942 commit 38f7932
Show file tree
Hide file tree
Showing 8 changed files with 195 additions and 116 deletions.
11 changes: 1 addition & 10 deletions docs/.vitepress/components/HomePage.vue
Original file line number Diff line number Diff line change
@@ -1,21 +1,12 @@
<script setup lang="ts">
import { VPTeamMembers, VPHomeSponsors } from 'vitepress/theme'
import { teamMembers } from '../contributors'
import { VPHomeSponsors } from 'vitepress/theme'
import { sponsors } from '../sponsors'
</script>

<template>
<div class="content">
<div class="content-container">
<main class="main">
<div class="vp-doc" flex flex-col items-center>
<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>
</div>
<VPHomeSponsors
v-if="sponsors"
message="Vitest is free and open source, made possible by wonderful sponsors."
Expand Down
44 changes: 34 additions & 10 deletions docs/.vitepress/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,25 +98,44 @@ export default withPwa(defineConfig({
{ text: 'Config', link: '/config/', activeMatch: '^/config/' },
{ text: 'Advanced', link: '/advanced/api', activeMatch: '^/advanced/' },
{
text: `v${version}`,
text: 'Resources',
items: [
{
text: 'Release Notes ',
link: releases,
text: 'Team',
link: '/team',
},
{
text: 'Contributing ',
link: contributing,
items: [
{
text: 'X (formerly Twitter)',
link: twitter,
},
{
text: 'Discord Chat',
link: discord,
},
{
text: 'Releases ',
link: releases,
},
{
text: 'Contributing ',
link: contributing,
},
],
},
],
},
{
text: `v${version}`,
link: `https://github.com/vitest-dev/vitest/releases/tag/v${version}`,
},
],

sidebar: {
// TODO: bring sidebar of apis and config back
'/advanced': [
{
text: 'Advanced',
items: [
{
text: 'Vitest Node API',
Expand All @@ -141,9 +160,8 @@ export default withPwa(defineConfig({
],
},
],
'/': [
'/guide/': [
{
text: 'Guide',
items: [
{
text: 'Why Vitest',
Expand Down Expand Up @@ -239,8 +257,9 @@ export default withPwa(defineConfig({
},
],
},
],
'/api/': [
{
text: 'API',
items: [
{
text: 'Test API Reference',
Expand Down Expand Up @@ -268,9 +287,14 @@ export default withPwa(defineConfig({
},
],
},
],
'/config/': [
{
text: 'Config',
items: [
{
text: 'Config File',
link: '/config/file',
},
{
text: 'Config Reference',
link: '/config/',
Expand Down
24 changes: 14 additions & 10 deletions docs/.vitepress/contributors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,18 @@ const plainTeamMembers: CoreTeam[] = [
title: 'A passionate enthusiast of open source contributions',
desc: 'Team member of Vitest & UnoCSS',
},
{
avatar: contributorsAvatars.zxch3n,
name: 'Zixuan Chen',
github: 'zxch3n',
mastodon: 'https://elk.zone/hachyderm.io/@zx',
twitter: 'zxch3n',
title: 'A fullstack developer',
desc: 'Working on CRDTs & local-first software',
},
]

const plainTeamEmeritiMembers: CoreTeam[] = [
{
avatar: contributorsAvatars.Aslemammad,
name: 'Mohammad Bagher',
Expand All @@ -127,15 +139,6 @@ const plainTeamMembers: CoreTeam[] = [
title: 'A tech lead, fullstack developer',
desc: 'Author of fluent-vue',
},
{
avatar: contributorsAvatars.zxch3n,
name: 'Zixuan Chen',
github: 'zxch3n',
mastodon: 'https://elk.zone/hachyderm.io/@zx',
twitter: 'zxch3n',
title: 'A fullstack developer',
desc: 'Working on CRDTs & local-first software',
},
{
avatar: contributorsAvatars.poyoho,
name: 'Yoho Po',
Expand All @@ -155,5 +158,6 @@ const plainTeamMembers: CoreTeam[] = [
]

const teamMembers = plainTeamMembers.map(tm => createLinks(tm))
const teamEmeritiMembers = plainTeamEmeritiMembers.map(tm => createLinks(tm))

export { teamMembers }
export { teamMembers, teamEmeritiMembers }
4 changes: 2 additions & 2 deletions docs/.vitepress/scripts/fetch-avatars.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { existsSync, promises as fsp } from 'node:fs'
import { fileURLToPath } from 'node:url'
import { dirname, join, resolve } from 'pathe'
import { teamMembers } from '../contributors'
import { teamEmeritiMembers, teamMembers } from '../contributors'

const docsDir = resolve(dirname(fileURLToPath(import.meta.url)), '../..')
const dirAvatars = resolve(docsDir, 'public/user-avatars/')
Expand All @@ -23,7 +23,7 @@ async function fetchAvatars() {
if (!existsSync(dirAvatars))
await fsp.mkdir(dirAvatars, { recursive: true })

await Promise.all(teamMembers.map(c => c.github).map(name => download(`https://github.com/${name}.png?size=100`, join(dirAvatars, `${name}.png`))))
await Promise.all([...teamEmeritiMembers, ...teamMembers].map(c => c.github).map(name => download(`https://github.com/${name}.png?size=100`, join(dirAvatars, `${name}.png`))))
}

async function fetchSponsors() {
Expand Down
16 changes: 16 additions & 0 deletions docs/.vitepress/style/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,22 @@ img.resizable-img {
height: unset;
}

.VPTeamMembersItem.medium .profile .data .affiliation {
min-height: unset;
}
.VPTeamMembersItem.medium .profile .data .desc {
min-height: unset;
}
/* fix height ~ 2 lines of text: 3 cards per row */
@media (min-width: 648px) {
.VPTeamMembersItem.medium .profile .data .affiliation {
min-height: 4rem;
}
.VPTeamMembersItem.medium .profile .data .desc {
min-height: 4rem;
}
}

/* fix height ~ 2 lines of text: 3 or more cards per row */
.VPTeamMembersItem.small .profile .data .affiliation {
min-height: 3rem;
Expand Down
79 changes: 79 additions & 0 deletions docs/config/file.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
---
outline: deep
---

# Managing Vitest config file

If you are using Vite and have a `vite.config` file, Vitest will read it to match with the plugins and setup as your Vite app. If you want to have a different configuration for testing or your main app doesn't rely on Vite specifically, you could either:

- Create `vitest.config.ts`, which will have the higher priority and will **override** the configuration from `vite.config.ts` (Vitest supports all conventional JS and TS extensions, but doesn't support `json`) - it means all options in your `vite.config` will be **ignored**
- Pass `--config` option to CLI, e.g. `vitest --config ./path/to/vitest.config.ts`
- Use `process.env.VITEST` or `mode` property on `defineConfig` (will be set to `test`/`benchmark` if not overridden with `--mode`) to conditionally apply different configuration in `vite.config.ts`

To configure `vitest` itself, add `test` property in your Vite config. You'll also need to add a reference to Vitest types using a [triple slash command](https://www.typescriptlang.org/docs/handbook/triple-slash-directives.html#-reference-types-) at the top of your config file, if you are importing `defineConfig` from `vite` itself.

Using `defineConfig` from `vite` you should follow this:

```ts
/// <reference types="vitest" />
import { defineConfig } from 'vite'

export default defineConfig({
test: {
// ... Specify options here.
},
})
```

Using `defineConfig` from `vitest/config` you should follow this:

```ts
import { defineConfig } from 'vitest/config'

export default defineConfig({
test: {
// ... Specify options here.
},
})
```

You can retrieve Vitest's default options to expand them if needed:

```ts
import { configDefaults, defineConfig } from 'vitest/config'

export default defineConfig({
test: {
exclude: [...configDefaults.exclude, 'packages/template/*'],
},
})
```

When using a separate `vitest.config.js`, you can also extend Vite's options from another config file if needed:

```ts
import { defineConfig, mergeConfig } from 'vitest/config'
import viteConfig from './vite.config'

export default mergeConfig(viteConfig, defineConfig({
test: {
exclude: ['packages/template/*'],
},
}))
```

If your Vite config is defined as a function, you can define the config like this:

```ts
import { defineConfig, mergeConfig } from 'vitest/config'
import viteConfig from './vite.config'

export default defineConfig(configEnv => mergeConfig(
viteConfig(configEnv),
defineConfig({
test: {
exclude: ['packages/template/*'],
},
})
))
```
Loading

0 comments on commit 38f7932

Please sign in to comment.