Skip to content

Commit

Permalink
feat(typedoc-config): use pages plugin only if pages exists
Browse files Browse the repository at this point in the history
  • Loading branch information
andrepolischuk committed Oct 24, 2023
1 parent ffba102 commit 982ecc5
Showing 1 changed file with 16 additions and 13 deletions.
29 changes: 16 additions & 13 deletions packages/typedoc-config/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,7 @@ const OUT_PATH = path.resolve(process.cwd(), 'public')
const DOCS_PATH = path.resolve(process.cwd(), 'docs')
const README_PATH = path.resolve(process.cwd(), 'readme.md')

let pagesConfig

try {
pagesConfig = require(path.resolve(DOCS_PATH, 'index.json'))
} catch (e) {}

module.exports = {
const config = {
theme: 'default',
out: OUT_PATH,
readme: README_PATH,
Expand All @@ -23,10 +17,19 @@ module.exports = {
excludePrivate: true,
excludeProtected: true,
excludeInternal: true,
excludeNotDocumented: true,
plugin: ['@knodes/typedoc-plugin-pages'],
pluginPages: {
source: DOCS_PATH,
pages: pagesConfig
}
excludeNotDocumented: true
}

try {
const pagesConfig = require(path.resolve(DOCS_PATH, 'index.json'))

if (pagesConfig) {
config.plugin = ['@knodes/typedoc-plugin-pages']
config.pluginPages = {
source: DOCS_PATH,
pages: pagesConfig
}
}
} catch (e) {}

module.exports = config

0 comments on commit 982ecc5

Please sign in to comment.