From a87602b3c45b1f7903460adfd6268c65c8669682 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 29 Dec 2023 16:50:43 +0100 Subject: chore(deps): update doc-dependencies (#2301) --- scripts/apidoc.ts | 6 +++++- scripts/apidoc/generate.ts | 2 +- scripts/apidoc/typedoc.ts | 24 ++++++++++++------------ 3 files changed, 18 insertions(+), 14 deletions(-) (limited to 'scripts') diff --git a/scripts/apidoc.ts b/scripts/apidoc.ts index 8c7ac6b8..d7c965ae 100644 --- a/scripts/apidoc.ts +++ b/scripts/apidoc.ts @@ -8,4 +8,8 @@ async function build(): Promise { await generate(); } -build().catch(console.error); +build().catch((error) => { + // Workaround until top level await is available + console.error(error); + process.exit(1); +}); diff --git a/scripts/apidoc/generate.ts b/scripts/apidoc/generate.ts index 44610869..eb00cea4 100644 --- a/scripts/apidoc/generate.ts +++ b/scripts/apidoc/generate.ts @@ -17,7 +17,7 @@ const pathOutputJson = resolve(pathOutputDir, 'typedoc.json'); * Generates the API documentation. */ export async function generate(): Promise { - const [app, project] = loadProject(); + const [app, project] = await loadProject(); // Useful for manually analyzing the content await app.generateJson(project, pathOutputJson); diff --git a/scripts/apidoc/typedoc.ts b/scripts/apidoc/typedoc.ts index 1e548c14..4d6a2b6c 100644 --- a/scripts/apidoc/typedoc.ts +++ b/scripts/apidoc/typedoc.ts @@ -31,19 +31,17 @@ type CommentHolder = Pick; * * @returns The TypeDoc application and the project reflection. */ -export function loadProject( +export async function loadProject( options: Partial = { entryPoints: ['src/index.ts'], pretty: true, cleanOutputDir: true, tsconfig: 'tsconfig.build.json', } -): [Application, ProjectReflection] { - const app = newTypeDocApp(); +): Promise<[Application, ProjectReflection]> { + const app = await newTypeDocApp(options); - app.bootstrap(options); - - const project = app.convert(); + const project = await app.convert(); if (!project) { throw new Error('Failed to convert project'); @@ -56,13 +54,15 @@ export function loadProject( /** * Creates and configures a new typedoc application. + * + * @param options The options to use for the project. */ -function newTypeDocApp(): Application { - const app = new Application(); - - app.options.addReader(new TSConfigReader()); - // If you want TypeDoc to load typedoc.json files - //app.options.addReader(new TypeDoc.TypeDocReader()); +async function newTypeDocApp( + options?: Partial +): Promise { + const app = await Application.bootstrapWithPlugins(options, [ + new TSConfigReader(), + ]); // Read parameter defaults app.converter.on(Converter.EVENT_CREATE_DECLARATION, parameterDefaultReader); -- cgit v1.2.3