New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

grunt-jsdoc

Package Overview
Dependencies
Maintainers
1
Versions
41
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

grunt-jsdoc - npm Package Compare versions

Comparing version 0.2.3 to 0.2.4

4

Gruntfile.js

@@ -9,3 +9,5 @@ module.exports = function(grunt) {

src: ['tasks/*.js', 'test/*_test.js'],
dest: 'doc'
options: {
destination: 'doc'
}
}

@@ -12,0 +14,0 @@ },

{
"name": "grunt-jsdoc",
"description": "Integrates jsdoc3 generation into your Grunt build",
"version": "0.2.3",
"version": "0.2.4",
"homepage": "https://github.com/krampstudio/grunt-jsdoc-plugin",

@@ -38,4 +38,7 @@ "author": {

"dependencies": {
"jsdoc3": "git+https://github.com/jsdoc3/jsdoc.git"
"jsdoc3": "git+https://github.com/jsdoc3/jsdoc.git#v3.1.1"
},
"peerDependencies" : {
"grunt" : "0.4.x"
},
"keywords": [

@@ -42,0 +45,0 @@ "gruntplugin",

@@ -42,3 +42,5 @@ # grunt-jsdoc-plugin [![Build Status](https://travis-ci.org/krampstudio/grunt-jsdoc-plugin.png)](https://travis-ci.org/krampstudio/grunt-jsdoc-plugin)

src: ['src/*.js', 'test/*.js'],
dest: 'doc'
options{
destination: 'doc'
}
}

@@ -49,7 +51,13 @@ }

The only supported options are
The supported options are
* `src` : an array of pattern that matches the files to extract the documentation from. You can also add the pattern to a README.md file to include it in your doc as described [there](http://usejsdoc.org/about-including-readme.html).
* `dest`: the directory where the documentation will be generated (it will be created if needed).
* `config` : (optional) a path to a jsdoc config file (refer the [usejsdoc] documentation below for more information).
* `src` : (required) an array of pattern that matches the files to extract the documentation from. You can also add the pattern to a README.md file to include it in your doc as described [there](http://usejsdoc.org/about-including-readme.html).
* `dest` : (deprecated) to support the previous way to set up destination folder
* `jsdoc`: (optional) the path to the jsdoc bin (needed only for some boreder line cases)
* `options` : options used by jsdoc
* `destination`: (required) the folder where the doc is generated
* `congif` : (optionnal) path to a config file
* `template` : (optionnal)path or name to a different template
* `private` : (optionnal) include the private functions to the doc (`true` by default).
* ... refer the [usejsdocCli] documentation for all the available options.

@@ -97,2 +105,3 @@ Then, load the plugin

* _0.2.3_ Fix [bug #14](https://github.com/krampstudio/grunt-jsdoc-plugin/pull/14) and [bug #15](https://github.com/krampstudio/grunt-jsdoc-plugin/issues/15)
* _0.2.4_ Fix Jsdoc 3 dependency to 3.1.1 tag, enables jsdoc options [issue #19](https://github.com/krampstudio/grunt-jsdoc-plugin/issues/19), enable to add jsdoc path [issue #13](https://github.com/krampstudio/grunt-jsdoc-plugin/issues/13) and add peerDependencies

@@ -111,1 +120,2 @@ [jsdoc3]: https://github.com/jsdoc3/jsdoc

[usejsdoc]: http://usejsdoc.org
[usejsdocCli]: http://usejsdoc.org/about-commandline.html

@@ -30,23 +30,27 @@ /**

function registerJsdocTask() {
var fs = require('fs'),
path = require('path'),
options = grunt.task.current.options(),
done = grunt.task.current.async(),
srcs = grunt.task.current.filesSrc,
dest = grunt.task.current.files[0].dest || 'doc',
config = options.config,
javaHome = process.env.JAVA_HOME,
timeout = 60000, //todo implement and move in options
var fs = require('fs'),
path = require('path'),
options = grunt.task.current.options({'private': true}),
done = grunt.task.current.async(),
srcs = grunt.task.current.filesSrc,
javaHome = process.env.JAVA_HOME,
jsDocPath = grunt.task.current.data.jsdoc,
jsDocNpmPath = 'node_modules/jsdoc/jsdoc',
timeout = 60000, //todo implement and move in options
jsDoc;
if (!options.destination) {
// Support for old syntax where destination was provided through 'dest' key
options.destination = grunt.task.current.files[0].dest || 'doc';
}
/**
* Build and execute a child process using the spawn function
* @memberOf module:tasks/jsdoc-plugin#registerJsdocTask
* @param {String} script the script to run
* @param {Array} sources the list of sources files
* @param {String} destination the destination directory
* @param {String} [config] the path to a jsdoc config file
* @return {ChildProcess} from the spawn
* @memberOf module:tasks/jsdoc-plugin
* @param {String} script - the script to run
* @param {Array} sources - the list of sources files
* @param {Object} options - the list of JSDoc options
* @return {ChildProcess} from the spawn
*/
var buildSpawned = function(script, sources, destination, config){
var buildSpawned = function(script, sources, options){
var isWin = process.platform === 'win32',

@@ -57,8 +61,12 @@ cmd = (isWin) ? 'cmd' : script,

if (config !== undefined) {
args.push('-c');
args.push(config);
// Compute JSDoc options
for (var optionName in options) {
grunt.log.debug("Reading option: " + optionName);
args.push('--' + optionName);
if (options.hasOwnProperty(optionName) && typeof(options[optionName]) === 'string') {
grunt.log.debug(" > " + options[optionName]);
args.push(options[optionName]);
}
}
args.push('-d');
args.push(destination);
if(!util.isArray(sources)){

@@ -77,12 +85,19 @@ sources = [sources];

* @todo find a more elegant way to do that...
* @memberOf module:tasks/jsdoc-plugin#registerJsdocTask
* @memberOf module:tasks/jsdoc-plugin
* @param {String} base - the base path of jsdoc to look up in the different directories
* @param {String} [path] - a defined path to the jsdoc bin, in case of a non standard location
* @returns {String} the command absolute path
*/
var jsDocLookup = function(){
var jsDocLookup = function(base, extPath){
var base = 'node_modules/jsdoc/jsdoc',
paths = [ base, 'node_modules/grunt-jsdoc/' + base ],
var paths = [],
nodePath = process.env.NODE_PATH || '',
_ = grunt.util._;
if(extPath && typeof extPath === 'string'){
paths.push(extPath);
}
paths.push(base);
paths.push('node_modules/grunt-jsdoc/' + base);
_.map(nodePath.split(':'), function(p){

@@ -103,3 +118,3 @@ if(!/\/$/.test(p)){

};
jsDoc = jsDocLookup();
jsDoc = jsDocLookup(jsDocNpmPath, jsDocPath);

@@ -129,3 +144,3 @@ //check if java is set

//check if jsdoc config file path is provided and does exist
if (config !== undefined && !fs.existsSync(config)){
if (options.config && !fs.existsSync(options.config)){
grunt.log.error('jsdoc config file path does not exist');

@@ -135,10 +150,10 @@ grunt.fail.warn('Wrong configuration', errorCode.generic);

fs.exists(dest, function(exists){
fs.exists(options.destination, function(exists){
//if the destination don't exists, we create it
if(!exists){
grunt.file.mkdir(dest);
grunt.file.mkdir(options.destination);
}
//execution of the jsdoc command
var child = buildSpawned(jsDoc, srcs, dest, config);
var child = buildSpawned(jsDoc, srcs, options);
child.stdout.on('data', function (data) {

@@ -153,3 +168,3 @@ grunt.log.debug('jsdoc output : ' + data);

if(code === 0){
grunt.log.write('Documentation generated to ' + path.resolve(dest));
grunt.log.write('Documentation generated to ' + path.resolve(options.destination));
done(true);

@@ -156,0 +171,0 @@ } else {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc