Skip to content

Commit

Permalink
docs: upgrade docs generation
Browse files Browse the repository at this point in the history
  • Loading branch information
posva committed Dec 4, 2024
1 parent c347a7b commit c8ef04b
Show file tree
Hide file tree
Showing 7 changed files with 160 additions and 228 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"@rollup/plugin-replace": "^6.0.1",
"@rollup/plugin-terser": "^0.4.4",
"@types/lodash.kebabcase": "^4.1.9",
"@types/node": "^20.14.12",
"@types/node": "^22.10.1",
"@vitest/coverage-v8": "^2.1.8",
"@vitest/ui": "^2.1.8",
"@vue/compiler-sfc": "~3.5.13",
Expand All @@ -58,7 +58,7 @@
"semver": "^7.6.3",
"simple-git-hooks": "^2.11.1",
"typedoc": "^0.26.11",
"typedoc-plugin-markdown": "^4.2.10",
"typedoc-plugin-markdown": "~4.2.0",
"typescript": "~5.6.3",
"vitest": "^2.1.8",
"vue": "~3.5.13"
Expand Down
15 changes: 3 additions & 12 deletions packages/docs/.vitepress/config/en.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { DefaultTheme, LocaleSpecificConfig } from 'vitepress'
import typedocSidebar from '../../api/typedoc-sidebar.json'

export const META_URL = 'https://pinia.vuejs.org'
export const META_TITLE = 'Pinia 🍍'
Expand Down Expand Up @@ -53,18 +54,8 @@ export const enConfig: LocaleSpecificConfig<DefaultTheme.Config> = {
sidebar: {
'/api/': [
{
text: 'packages',
items: [
{ text: 'pinia', link: '/api/pinia/' },
{
text: '@pinia/nuxt',
link: '/api/@pinia/nuxt/',
},
{
text: '@pinia/testing',
link: '/api/@pinia/testing/',
},
],
text: 'API',
items: typedocSidebar,
},
],
// catch-all fallback
Expand Down
2 changes: 2 additions & 0 deletions packages/docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"private": true,
"type": "module",
"scripts": {
"predocs": "node run-typedoc.mjs",
"docs": "vitepress dev .",
"docs:api": "node run-typedoc.mjs",
"docs:translation:compare": "v-translation compare",
Expand All @@ -17,6 +18,7 @@
"@vueuse/core": "^12.0.0",
"pinia": "workspace:*",
"vitepress": "1.5.0",
"typedoc-vitepress-theme": "^1.1.1",
"vitepress-translation-helper": "^0.2.2",
"vue-use-spring": "^0.3.3"
}
Expand Down
10 changes: 8 additions & 2 deletions packages/docs/run-typedoc.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,19 @@ import { createTypeDocApp } from './typedoc-markdown.mjs'
const __dirname = path.dirname(new URL(import.meta.url).pathname)

createTypeDocApp({
name: 'API Documentation',
textContentMappings: {
'title.indexPage': 'API Reference',
'title.memberPage': '{name}',
},
tsconfig: path.resolve(__dirname, './typedoc.tsconfig.json'),
// entryPointStrategy: 'packages',
categorizeByGroup: true,
githubPages: false,
readme: 'none',
indexFormat: 'table',
disableSources: true,
plugin: ['typedoc-plugin-markdown'],
plugin: ['typedoc-plugin-markdown', 'typedoc-vitepress-theme'],
useCodeBlocks: true,
entryPoints: [
path.resolve(__dirname, '../pinia/src/index.ts'),
path.resolve(__dirname, '../testing/src/index.ts'),
Expand Down
6 changes: 2 additions & 4 deletions packages/docs/typedoc-markdown.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,13 @@ import { Application, TSConfigReader, PageEvent } from 'typedoc'

const __dirname = path.dirname(new URL(import.meta.url).pathname)

/** @satisfies {Partial<import('typedoc').TypeDocOptions & import('typedoc-plugin-markdown').PluginOptions>} */
const DEFAULT_OPTIONS = {
// disableOutputCheck: true,
cleanOutputDir: true,
excludeInternal: true,
readme: 'none',
out: path.resolve(__dirname, './api'),
entryFileName: 'index.md',
hideBreadcrumbs: false,
// hideInPageTOC: true,
// hideBreadcrumbs: false,
preserveAnchorCasing: true,
}

Expand Down
2 changes: 1 addition & 1 deletion packages/pinia/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
],
"license": "MIT",
"devDependencies": {
"@microsoft/api-extractor": "7.47.11",
"@microsoft/api-extractor": "7.48.0",
"@vue/test-utils": "^2.4.6"
},
"dependencies": {
Expand Down
Loading

0 comments on commit c8ef04b

Please sign in to comment.