deshaw/gulp-jsdoc3

Task completed before output files being written

Closed this issue · 6 comments

bbert commented

I notice that the output generated files are not completely written on disk while the task is considered as done.
Then if we want to post-process a generated file, the file does not yet exists on disk.

For example, in the following case, the second task will fail since the output index.html file does not exist while the first task is completed.
Also, the debug trace 'Documented N files!' will appear after both tasks are completed.

gulp.task('generateDoc', function() {
    return gulp.src([<source_files>], {read: true})
        .pipe(jsdoc(config))
        .on('end', function() {
            console.log("DONE!!!!!!!!");
    });
});

gulp.task('doc', ['generateDoc'], function() {
    return gulp.src([<ouput_dir>/'index.html'], {base: './'})
        .pipe(htmlReplace({...})
        .pipe(gulp.dest('./'));
});

Used versions:

  • node: 4.2.6
  • jsdoc: 3.4.3
  • gulp-jsdoc3: 1.0.1

Hi,

Per the documentation this does not use a steam so you cannot pipe from it. In other words, the end test is invalid. The callback happens when the jsdoc exits, so I don't have much I can do there. I would think about polling possibly if you have a problem as it could be related to whatever filesystem you are using.

bbert commented

Hi,
OK, so as far as I understand, gulp-jsdoc3 runs a jsdoc process which exits before output file are completely written on disk.
Why gulp-jsdoc3 runs differently than gulp-jsdoc, since with gulp-jsdoc we could pipe the output stream?

This was a technological tradeoff to expose all options and work for 99% of cases. gulp-jsdoc's stream functionality limited its ability to use all of jsdoc3's options, so this thin wrapper (gulp-jsdoc3) was written over jsdoc3 CLI. The problem lies mostly in how jdoc3 is designed in that there is no good way to use it from anything but CLI so we have no way to stream it's output.

bbert commented

OK I see.
I will manage to get around this issue.
Thanks

Any progress on this?

@nnmrts Per my last update, there is no intent to fix this. I am happy to look at a PR if you have a better idea.