aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/apidoc.ts6
-rw-r--r--scripts/apidoc/generate.ts2
-rw-r--r--scripts/apidoc/typedoc.ts24
3 files changed, 18 insertions, 14 deletions
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<void> {
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<void> {
- 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<Reflection, 'comment'>;
*
* @returns The TypeDoc application and the project reflection.
*/
-export function loadProject(
+export async function loadProject(
options: Partial<TypeDocOptions> = {
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<TypeDocOptions>
+): Promise<Application> {
+ const app = await Application.bootstrapWithPlugins(options, [
+ new TSConfigReader(),
+ ]);
// Read parameter defaults
app.converter.on(Converter.EVENT_CREATE_DECLARATION, parameterDefaultReader);