Skip to content

Commit

Permalink
fix(docusaurus): create out directory if it doesn't exist (#641)
Browse files Browse the repository at this point in the history
  • Loading branch information
tgreyuk committed Jul 1, 2024
1 parent 82af7c3 commit c36151f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/brave-cats-hug.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'docusaurus-plugin-typedoc': patch
---

- Create output directory if it doesn't exist (#641)
8 changes: 6 additions & 2 deletions packages/docusaurus-plugin-typedoc/src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@ async function generateTypedoc(context: any, opts: Partial<PluginOptions>) {

const { id, sidebar, ...optionsPassedToTypeDoc } = pluginOptions;

const outputDir = path.join(siteDir, pluginOptions.out);

if (!fs.existsSync(outputDir)) {
fs.mkdirSync(outputDir, { recursive: true });
}

const app = (await Application.bootstrapWithPlugins(
optionsPassedToTypeDoc,
)) as unknown as MarkdownApplication;
Expand All @@ -61,8 +67,6 @@ async function generateTypedoc(context: any, opts: Partial<PluginOptions>) {
} as DeclarationOption);
});

const outputDir = app.options.getValue('out');

if (sidebar?.autoConfiguration) {
const docsPreset = context.siteConfig?.presets?.find((preset: any) =>
Boolean(preset[1]?.docs),
Expand Down

0 comments on commit c36151f

Please sign in to comment.