docs: add typedocs to vitepress docs

This commit is contained in:
braks
2022-08-01 21:10:14 +02:00
committed by Braks
parent c38787f60b
commit 74c329c143
5 changed files with 578 additions and 247 deletions
+12 -10
View File
@@ -1,35 +1,37 @@
{ {
"name": "docs2", "name": "docs2",
"version": "1.0.0", "version": "1.0.0",
"description": "", "private": true,
"main": "index.js",
"scripts": { "scripts": {
"dev": "vitepress dev src", "dev": "pnpm run typedoc && vitepress dev src",
"build": "vitepress build src", "build": "pnpm run typedoc && vitepress build src",
"serve": "vitepress serve 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" "test": "echo \"Error: no test specified\" && exit 1"
}, },
"dependencies": { "dependencies": {
"@algolia/client-search": "^4.14.2",
"@animxyz/core": "^0.6.6", "@animxyz/core": "^0.6.6",
"@animxyz/vue3": "^0.6.7", "@animxyz/vue3": "^0.6.7",
"@braks/vue-flow": "workspace:*", "@braks/vue-flow": "workspace:*",
"@stackblitz/sdk": "^1.8.0", "@stackblitz/sdk": "^1.8.0",
"@vue/repl": "1.1.2", "@vue/repl": "1.1.2",
"blobity": "^0.1.7", "blobity": "^0.2.1",
"canvas-confetti": "^1.5.1" "canvas-confetti": "^1.5.1"
}, },
"devDependencies": { "devDependencies": {
"@iconify/json": "^2.1.81", "@iconify/json": "^2.1.85",
"@types/canvas-confetti": "^1.4.3", "@types/canvas-confetti": "^1.4.3",
"@types/node": "^18.0.6", "@types/node": "^18.6.2",
"@windicss/plugin-scrollbar": "^1.2.3", "@windicss/plugin-scrollbar": "^1.2.3",
"dotenv": "^16.0.1", "dotenv": "^16.0.1",
"ohmyfetch": "^0.4.18", "ohmyfetch": "^0.4.18",
"typedoc": "^0.22.18", "typedoc": "^0.22.18",
"typedoc-plugin-markdown": "^3.13.4", "typedoc-plugin-markdown": "^3.13.4",
"unplugin-auto-import": "^0.9.5", "unplugin-auto-import": "^0.10.3",
"unplugin-icons": "^0.14.7", "unplugin-icons": "^0.14.8",
"unplugin-vue-components": "^0.19.9", "unplugin-vue-components": "^0.21.2",
"vite-plugin-windicss": "^1.8.7", "vite-plugin-windicss": "^1.8.7",
"vitepress": "^1.0.0-alpha.4", "vitepress": "^1.0.0-alpha.4",
"windicss": "^3.5.6" "windicss": "^3.5.6"
+9 -13
View File
@@ -18,29 +18,24 @@ function capitalize(str: string) {
} }
const typedocSidebarEntries = (): DefaultTheme.SidebarGroup[] => { 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 docsModules = readdirSync(filePath).filter((name) => statSync(`${filePath}/${name}`).isDirectory())
const sidebarItems = docsModules.map((module) => { return docsModules.map((module) => {
let children = readdirSync(`${filePath}/${module}/`).map((entry) => `/typedocs/${module}/${entry}`) let children = readdirSync(`${filePath}/${module}/`).map<DefaultTheme.SidebarItem>((entry) => ({
text: entry.replace('.md', ''),
link: `/typedocs/${module}/${entry.replace('.md', '')}`,
}))
if (module === 'variables') { if (module === 'variables') {
children = children.filter((child) => { 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>({ export default defineConfigWithTheme<DefaultTheme.Config>({
@@ -203,6 +198,7 @@ export default defineConfigWithTheme<DefaultTheme.Config>({
], ],
}, },
], ],
'/typedocs/': typedocSidebarEntries(),
}, },
}, },
}) })
+2 -2
View File
@@ -3,6 +3,8 @@
// Read more: https://github.com/vuejs/core/pull/3399 // Read more: https://github.com/vuejs/core/pull/3399
import '@vue/runtime-core' import '@vue/runtime-core'
export {}
declare module '@vue/runtime-core' { declare module '@vue/runtime-core' {
export interface GlobalComponents { export interface GlobalComponents {
Acknowledgement: typeof import('./../components/home/Acknowledgement.vue')['default'] 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'] TeleportableNode: typeof import('./../components/examples/teleport/TeleportableNode.vue')['default']
} }
} }
export {}
+2 -1
View File
@@ -9,5 +9,6 @@
"lightHighlightTheme": "vitesse-light", "lightHighlightTheme": "vitesse-light",
"disableSources": true, "disableSources": true,
"out": "src/typedocs", "out": "src/typedocs",
"tsconfig": "../packages/vue-flow/tsconfig.docs.json" "tsconfig": "../packages/vue-flow/tsconfig.docs.json",
"entryDocument": "index.md"
} }
+553 -221
View File
File diff suppressed because it is too large Load Diff