Skip to content

Commit

Permalink
fix: move bootstrap logic out of ready() lifecycle (#290)
Browse files Browse the repository at this point in the history
  • Loading branch information
tgreyuk committed Feb 4, 2022
1 parent eb688bb commit 53eff76
Showing 1 changed file with 25 additions and 25 deletions.
50 changes: 25 additions & 25 deletions packages/vuepress-plugin-typedoc/src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,40 +14,40 @@ let project: ProjectReflection | undefined;
export const typedocPlugin = (opts: PluginOptions, ctx: any) => {
const options = getOptions(opts);

return {
name: 'vuepress-plugin-typedoc',
async ready() {
const outputDirectory =
(ctx.sourceDir || ctx.dir.source()) + '/' + options.out;
const outputDirectory = (ctx.sourceDir || ctx.dir.source()) + '/' + options.out;

removeDir(outputDirectory);
removeDir(outputDirectory);

app = new Application();
app = new Application();

load(app);
load(app);

addOptions(app);
addOptions(app);

app.renderer.render = render;
app.renderer.render = render;

app.bootstrap(options);
app.bootstrap(options);

project = app.convert();
// if project is undefined typedoc has a problem - error logging will be supplied by typedoc.
if (!project) {
return;
}
project = app.convert();

// if project is undefined typedoc has a problem - error logging will be supplied by typedoc.
if (!project) {
return;
}

if (options.watch) {
app.convertAndWatch(async (project) => {
app.generateDocs(project, outputDirectory);
});
} else {
app.generateDocs(project, outputDirectory);
}

return {
name: 'vuepress-plugin-typedoc',

if (options.watch) {
app.convertAndWatch(async (project) => {
await app.generateDocs(project, outputDirectory);
});
} else {
await app.generateDocs(project, outputDirectory);
}
},
async enhanceAppFiles() {
if (!app || !options.sidebar) {
if (!options.sidebar) {
return;
}
const theme = app.renderer.theme as any;
Expand Down

0 comments on commit 53eff76

Please sign in to comment.