cleversoap / grunt-esdoc

ES6 Documentation tool ESDoc Grunt Plugin
MIT License
3 stars 3 forks source link

Reduce output #2

Closed AmyAmy closed 8 years ago

AmyAmy commented 8 years ago

There is a load of output, such as a complete list of generated files, which i only expect when the verbose flag is on.

Would it be possible to only output a simple "done" (and perhaps the coverage), and use grunt.verbose.writeln for the list of files?

cleversoap commented 8 years ago

Thanks - this is definitely a good idea! Will get right on it

cleversoap commented 8 years ago

It seems that ESDoc itself has issues (104, 83, 208) with logging and the developer is thankfully aware, however this means that unless there's a patch to ESDoc I can't really do anything to the output. This appears to also be an issue for gulp-esdoc too.

That said, I've come up with a solution that does accomplish what is needed, even if it probably is bad practice.

If I temporarily override console.log to capture and parse the output from the call to esdoc.generate (and then obviously return it to its original state) then it works as desired. Normally overriding a global, especially one like console.log, is unequivocally bad behaviour but I think we're safe in Grunt because:

cleversoap commented 8 years ago

The output will now be determined by the following:

cleversoap commented 8 years ago

grunt-esdoc@0.0.3 includes the requested changes, note that this version also requires version 4 or greater of Node

AmyAmy commented 8 years ago

Works like charm!

one tiny issue, my coverage is currently reported as Coverage: 17.89% (158/883) and the current regex doesn't account for non-integer coverage, I've made a pull-request with the fix.