docs: add typedocs to vitepress docs

This commit is contained in:
braks
2022-07-30 15:47:13 +02:00
committed by Braks
parent c38787f60b
commit 74c329c143
5 changed files with 578 additions and 247 deletions

View File

@@ -1,35 +1,37 @@
{
"name": "docs2",
"version": "1.0.0",
"description": "",
"main": "index.js",
"private": true,
"scripts": {
"dev": "vitepress dev src",
"build": "vitepress build src",
"dev": "pnpm run typedoc && vitepress dev src",
"build": "pnpm run typedoc && vitepress build src",
"serve": "vitepress serve src",
"lint": "eslint --ext \".js,.jsx,.ts,.tsx\" --fix --ignore-path .gitignore .",
"typedoc": "typedoc --options ./typedoc.json",
"test": "echo \"Error: no test specified\" && exit 1"
},
"dependencies": {
"@algolia/client-search": "^4.14.2",
"@animxyz/core": "^0.6.6",
"@animxyz/vue3": "^0.6.7",
"@braks/vue-flow": "workspace:*",
"@stackblitz/sdk": "^1.8.0",
"@vue/repl": "1.1.2",
"blobity": "^0.1.7",
"blobity": "^0.2.1",
"canvas-confetti": "^1.5.1"
},
"devDependencies": {
"@iconify/json": "^2.1.81",
"@iconify/json": "^2.1.85",
"@types/canvas-confetti": "^1.4.3",
"@types/node": "^18.0.6",
"@types/node": "^18.6.2",
"@windicss/plugin-scrollbar": "^1.2.3",
"dotenv": "^16.0.1",
"ohmyfetch": "^0.4.18",
"typedoc": "^0.22.18",
"typedoc-plugin-markdown": "^3.13.4",
"unplugin-auto-import": "^0.9.5",
"unplugin-icons": "^0.14.7",
"unplugin-vue-components": "^0.19.9",
"unplugin-auto-import": "^0.10.3",
"unplugin-icons": "^0.14.8",
"unplugin-vue-components": "^0.21.2",
"vite-plugin-windicss": "^1.8.7",
"vitepress": "^1.0.0-alpha.4",
"windicss": "^3.5.6"

View File

@@ -18,29 +18,24 @@ function capitalize(str: string) {
}
const typedocSidebarEntries = (): DefaultTheme.SidebarGroup[] => {
const filePath = resolve(__dirname, '../../typedocs')
const filePath = resolve(__dirname, '../typedocs')
const docsModules = readdirSync(filePath).filter((name) => statSync(`${filePath}/${name}`).isDirectory())
const sidebarItems = docsModules.map((module) => {
let children = readdirSync(`${filePath}/${module}/`).map((entry) => `/typedocs/${module}/${entry}`)
return docsModules.map((module) => {
let children = readdirSync(`${filePath}/${module}/`).map<DefaultTheme.SidebarItem>((entry) => ({
text: entry.replace('.md', ''),
link: `/typedocs/${module}/${entry.replace('.md', '')}`,
}))
if (module === 'variables') {
children = children.filter((child) => {
return child.includes('default')
return child.link.includes('default')
})
}
return { text: capitalize(module), children }
return { text: capitalize(module), collapsible: true, items: children } as DefaultTheme.SidebarGroup
})
return [
{
text: 'Modules',
link: '/typedocs/',
items: [...sidebarItems],
},
]
}
export default defineConfigWithTheme<DefaultTheme.Config>({
@@ -203,6 +198,7 @@ export default defineConfigWithTheme<DefaultTheme.Config>({
],
},
],
'/typedocs/': typedocSidebarEntries(),
},
},
})

View File

@@ -3,6 +3,8 @@
// Read more: https://github.com/vuejs/core/pull/3399
import '@vue/runtime-core'
export {}
declare module '@vue/runtime-core' {
export interface GlobalComponents {
Acknowledgement: typeof import('./../components/home/Acknowledgement.vue')['default']
@@ -36,5 +38,3 @@ declare module '@vue/runtime-core' {
TeleportableNode: typeof import('./../components/examples/teleport/TeleportableNode.vue')['default']
}
}
export {}

View File

@@ -9,5 +9,6 @@
"lightHighlightTheme": "vitesse-light",
"disableSources": true,
"out": "src/typedocs",
"tsconfig": "../packages/vue-flow/tsconfig.docs.json"
"tsconfig": "../packages/vue-flow/tsconfig.docs.json",
"entryDocument": "index.md"
}

774
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff