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.
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.
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.
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.
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.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With