dimanche 15 mars 2015

How to parse JSDoc in multiple .js files

I have many javascript files. I need to extract jsdoc using some jsdoc parser (gulp-jsdoc, jsdoc-parse, or another).


Using the following approach I get one huge dist/documentation.json file, which contains JSON for all my scripts.



var jsdoc = require("gulp-jsdoc");
gulp.src("mysrc/*/*.js")
.pipe(jsdoc.parser({}, "documentation.json"))
.pipe(gulp.dest('dist'));


But I need as many small separated .json files as many .js files I have.


Second way. Using jsdoc-parse I get into another trouble. I don't know how to properly write result to files instead of process.stdout.



var parse = require("jsdoc-parse");
var tap = require('gulp-tap');
gulp.src("mysrc/*/*.js")
.pipe(tap(function(file) {
parse(file.path).pipe(process.stdout); // how to write it to file?
});


Help me to finish this Gulp task, please.


Aucun commentaire:

Enregistrer un commentaire