gulp-typedoc icon indicating copy to clipboard operation
gulp-typedoc copied to clipboard

Generating doc and json for multiple sets of files leads to no output

Open youngderekm opened this issue 3 years ago • 1 comments

I'm using gulp-typedoc 3.0.1. We run two gulp-typedoc on two different sets of files and for each set generate both json and doc output. What I've found is that when both tasks run (effectively in parallel), I only get output for one of the tasks. The output directory for the other is empty. I've found that if I either disable json output or set the typedoc cleanOutputDir=false setting, then I get output for both sets of files.

Looking at the code, I suspect it's because doc output is generated, then json is generated immediately afterwards, without using await for the doc output to complete:

if (out) app.generateDocs(project, out);  // TODO promisified!!
if (json) app.generateJson(project, json); // TODO promisified!!

In the typedoc cli code, this uses await:

const out = app.options.getValue("out");
if (out) {
    await app.generateDocs(project, out);
}
const json = app.options.getValue("json");
if (json) {
    await app.generateJson(project, json);
}

I believe running the generateJson while generateDocs is running causes some state to get confused inside of typedoc.

youngderekm avatar Sep 23 '21 20:09 youngderekm

I think you're right. I am stopping all NPM development, so if you would like to submit a PR or take ownership of this package please go ahead. If you submit a PR I will be happy to merge it.

rogierschouten avatar Sep 24 '21 15:09 rogierschouten