Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use jsdoc with gulp?

How can I create a gulp command to build documentation using jsdoc?

I don't want to use the gulp-jsdoc package, as it is not maintained. And the package I had been using to call it from the command line, gulp-shell, is on the gulp blacklist.

like image 601
Racing Tadpole Avatar asked Nov 12 '15 05:11

Racing Tadpole


People also ask

What is the use of JSDoc?

JSDoc is a markup language used to annotate JavaScript source code files. Using comments containing JSDoc, programmers can add documentation describing the application programming interface of the code they're creating.

Where is JSDoc installed?

Installation and Usage JSDoc supports stable versions of Node. js 8.15. 0 and later. You can install JSDoc globally or in your project's node_modules folder.

Why is JSDoc important?

JSDoc's purpose is to document the API of your JavaScript application or library. It is assumed that you will want to document things like modules, namespaces, classes, methods, method parameters, and so on.


1 Answers

Use node's built-in child_process like this:

var child_exec = require('child_process').exec;

gulp.task('docs', function(done) {
    child_exec('node ./node_modules/jsdoc/jsdoc.js ./lib -c ./jsdoc.json', undefined, done);
});

(This example assumes you have a config file ./jsdoc.json, but it's easy to change the calling syntax.)

like image 148
Racing Tadpole Avatar answered Oct 12 '22 23:10

Racing Tadpole