@@ -12,7 +12,7 @@ import { coreTeamMembers } from '../contributors'
diff --git a/docs/src/components/ListItem.vue b/docs/.vitepress/components/ListItem.vue
similarity index 100%
rename from docs/src/components/ListItem.vue
rename to docs/.vitepress/components/ListItem.vue
diff --git a/docs/src/components/TeamMember.vue b/docs/.vitepress/components/TeamMember.vue
similarity index 100%
rename from docs/src/components/TeamMember.vue
rename to docs/.vitepress/components/TeamMember.vue
diff --git a/docs/.vitepress/config.ts b/docs/.vitepress/config.ts
index 258e851278b4..53986851d41d 100644
--- a/docs/.vitepress/config.ts
+++ b/docs/.vitepress/config.ts
@@ -11,8 +11,8 @@ import {
twitter,
vitestDescription,
vitestName,
-} from '../docs-data'
-import { coreTeamMembers } from '../src/contributors'
+} from './meta'
+import { teamMembers } from './contributors'
export default defineConfig({
lang: 'en-US',
@@ -22,7 +22,7 @@ export default defineConfig({
['meta', { name: 'theme-color', content: '#ffffff' }],
['link', { rel: 'icon', href: '/logo.svg', type: 'image/svg+xml' }],
['link', { rel: 'alternate icon', href: '/favicon.ico', type: 'image/png', sizes: '16x16' }],
- ['meta', { name: 'author', content: `${coreTeamMembers.map(c => c.name).join(', ')} and ${vitestName} contributors` }],
+ ['meta', { name: 'author', content: `${teamMembers.map(c => c.name).join(', ')} and ${vitestName} contributors` }],
['meta', { name: 'keywords', content: 'vitest, vite, test, coverage, snapshot, react, vue, preact, svelte, solid, lit, ruby, cypress, puppeteer, jsdom, happy-dom, test-runner, jest, typescript, esm, tinypool, tinyspy, c8, node' }],
['meta', { property: 'og:title', content: vitestName }],
['meta', { property: 'og:description', content: vitestDescription }],
diff --git a/docs/contributors.json b/docs/.vitepress/contributor-names.json
similarity index 100%
rename from docs/contributors.json
rename to docs/.vitepress/contributor-names.json
diff --git a/docs/src/contributors.ts b/docs/.vitepress/contributors.ts
similarity index 90%
rename from docs/src/contributors.ts
rename to docs/.vitepress/contributors.ts
index b0120f14628a..de04ea4c5199 100644
--- a/docs/src/contributors.ts
+++ b/docs/.vitepress/contributors.ts
@@ -1,4 +1,4 @@
-import contributors from '../contributors.json'
+import contributorNames from './contributor-names.json'
export interface Contributor {
name: string
@@ -18,13 +18,13 @@ const contributorsAvatars: Record = {}
const getAvatarUrl = (name: string) => import.meta.hot ? `https://github.com/${name}.png` : `/user-avatars/${name}.png`
-const contributorList = (contributors as string[]).reduce((acc, name) => {
+export const contributors = (contributorNames as string[]).reduce((acc, name) => {
contributorsAvatars[name] = getAvatarUrl(name)
acc.push({ name, avatar: contributorsAvatars[name] })
return acc
}, [] as Contributor[])
-const coreTeamMembers: CoreTeam[] = [
+export const teamMembers: CoreTeam[] = [
{
avatar: contributorsAvatars.antfu,
name: 'Anthony Fu',
@@ -82,5 +82,3 @@ const coreTeamMembers: CoreTeam[] = [
description: 'A fullstack developer
Creating tools for collaboration',
},
]
-
-export { coreTeamMembers, contributorList as contributors }
diff --git a/docs/docs-data.ts b/docs/.vitepress/meta.ts
similarity index 100%
rename from docs/docs-data.ts
rename to docs/.vitepress/meta.ts
diff --git a/docs/scripts/assets.ts b/docs/.vitepress/scripts/assets.ts
similarity index 97%
rename from docs/scripts/assets.ts
rename to docs/.vitepress/scripts/assets.ts
index dce1f4d02e0b..2daca50f7d9d 100644
--- a/docs/scripts/assets.ts
+++ b/docs/.vitepress/scripts/assets.ts
@@ -1,6 +1,6 @@
import { promises as fs } from 'fs'
import fg from 'fast-glob'
-import { font, preconnectHomeLinks, preconnectLinks } from '../docs-data'
+import { font, preconnectHomeLinks, preconnectLinks } from '../meta'
const preconnect = `
${preconnectLinks.map(l => ``).join('\n')}
diff --git a/docs/.vitepress/scripts/fetch-avatars.ts b/docs/.vitepress/scripts/fetch-avatars.ts
new file mode 100644
index 000000000000..2cc24fa55050
--- /dev/null
+++ b/docs/.vitepress/scripts/fetch-avatars.ts
@@ -0,0 +1,35 @@
+import { join, resolve } from 'pathe'
+import fs from 'fs-extra'
+import { $fetch } from 'ohmyfetch'
+import { teamMembers } from '../contributors'
+
+const docsDir = resolve(__dirname, '../..')
+const pathContributors = resolve(docsDir, '.vitepress/contributor-names.json')
+const dirAvatars = resolve(docsDir, 'public/user-avatars/')
+const dirSponsors = resolve(docsDir, 'public/sponsors/')
+
+let contributors: string[] = []
+const team = teamMembers.map(i => i.github)
+
+async function download(url: string, fileName: string) {
+ // eslint-disable-next-line no-console
+ console.log('downloading', fileName)
+ const image = await $fetch(url, { responseType: 'arrayBuffer' })
+ await fs.writeFile(fileName, Buffer.from(image))
+}
+
+async function fetchAvatars() {
+ await fs.ensureDir(dirAvatars)
+ contributors = JSON.parse(await fs.readFile(pathContributors, { encoding: 'utf-8' }))
+
+ await Promise.all(contributors.map(name => download(`https://github.com/${name}.png?size${team.includes(name) ? 100 : 40}`, join(dirAvatars, 'name.png'))))
+}
+
+async function fetchSponsors() {
+ await fs.ensureDir(dirSponsors)
+ await download('https://cdn.jsdelivr.net/gh/antfu/static/sponsors.svg', join(dirSponsors, 'antfu.svg'))
+ await download('https://cdn.jsdelivr.net/gh/patak-dev/static/sponsors.svg', join(dirSponsors, 'patak-dev.svg'))
+}
+
+fetchAvatars()
+fetchSponsors()
diff --git a/docs/main.css b/docs/.vitepress/style/main.css
similarity index 100%
rename from docs/main.css
rename to docs/.vitepress/style/main.css
diff --git a/docs/style/vars.css b/docs/.vitepress/style/vars.css
similarity index 100%
rename from docs/style/vars.css
rename to docs/.vitepress/style/vars.css
diff --git a/docs/.vitepress/theme/index.ts b/docs/.vitepress/theme/index.ts
index c8cc9d5dc8f0..061797e5e377 100644
--- a/docs/.vitepress/theme/index.ts
+++ b/docs/.vitepress/theme/index.ts
@@ -1,10 +1,10 @@
import { h } from 'vue'
import Theme from 'vitepress/theme'
import { inBrowser } from 'vitepress'
-import '../../main.css'
-import '../../style/vars.css'
+import '../style/main.css'
+import '../style/vars.css'
import 'uno.css'
-import HomePage from '../../src/components/HomePage.vue'
+import HomePage from '../components/HomePage.vue'
if (inBrowser)
import('./pwa')
diff --git a/docs/package.json b/docs/package.json
index 2c6e0be84e71..b99192a1ff85 100644
--- a/docs/package.json
+++ b/docs/package.json
@@ -6,7 +6,7 @@
"build": "nr prefetch && vitepress build",
"serve": "vitepress serve",
"preview-https": "pnpm run build && serve .vitepress/dist",
- "prefetch": "esno scripts/fetch-avatars.ts"
+ "prefetch": "esno .vitepress/scripts/fetch-avatars.ts"
},
"dependencies": {
"@vueuse/core": "^8.5.0",
diff --git a/docs/scripts/fetch-avatars.ts b/docs/scripts/fetch-avatars.ts
deleted file mode 100644
index e6b7c01808b3..000000000000
--- a/docs/scripts/fetch-avatars.ts
+++ /dev/null
@@ -1,31 +0,0 @@
-import fs from 'fs-extra'
-import { $fetch } from 'ohmyfetch'
-import { coreTeamMembers } from '../src/contributors'
-
-const pathContributors = '../docs/contributors.json'
-const dirAvatars = '../docs/public/user-avatars/'
-const dirSponsors = '../docs/public/sponsors/'
-
-let contributors: string[] = []
-const team = coreTeamMembers.map(i => i.github)
-
-async function download(url: string, fileName: string) {
- const image = await $fetch(url, { responseType: 'arrayBuffer' })
- await fs.writeFile(fileName, Buffer.from(image))
-}
-
-async function fetchAvatars() {
- await fs.ensureDir(dirAvatars)
- contributors = JSON.parse(await fs.readFile(pathContributors, { encoding: 'utf-8' }))
-
- await Promise.all(contributors.map(async name => download(`https://github.com/${name}.png?size${team.includes(name) ? 100 : 40}`, `${dirAvatars}${name}.png`)))
-}
-
-async function fetchSponsors() {
- await fs.ensureDir(dirSponsors)
- await download('https://cdn.jsdelivr.net/gh/antfu/static/sponsors.svg', `${dirSponsors}antfu.svg`)
- await download('https://cdn.jsdelivr.net/gh/patak-dev/static/sponsors.svg', `${dirSponsors}patak-dev.svg`)
-}
-
-fetchAvatars()
-fetchSponsors()
diff --git a/docs/vite.config.ts b/docs/vite.config.ts
index 5bc34b109dfc..6741a9a631a1 100644
--- a/docs/vite.config.ts
+++ b/docs/vite.config.ts
@@ -14,8 +14,8 @@ import {
vitestDescription,
vitestName,
vitestShortName,
-} from './docs-data'
-import { optimizePages } from './scripts/assets'
+} from './.vitepress/meta'
+import { optimizePages } from './.vitepress/scripts/assets'
const PWA = VitePWA({
outDir: '.vitepress/dist',
@@ -86,7 +86,8 @@ export default defineConfig({
plugins: [
Components({
include: [/\.vue/, /\.md/],
- dts: true,
+ dirs: '.vitepress/components',
+ dts: '.vitepress/components.d.ts',
}),
Unocss({
shortcuts: [
diff --git a/scripts/update-contributors.ts b/scripts/update-contributors.ts
index 741fae08e705..faa8048d2f17 100644
--- a/scripts/update-contributors.ts
+++ b/scripts/update-contributors.ts
@@ -21,7 +21,7 @@ async function fetchContributors(page = 1) {
async function generate() {
const collaborators = await fetchContributors()
- await fs.writeFile('./docs/contributors.json', JSON.stringify(collaborators, null, 2), 'utf8')
+ await fs.writeFile('./docs/.vitepress/contributor-names.json', JSON.stringify(collaborators, null, 2), 'utf8')
}
generate()