Skip to content

Commit

Permalink
MDL-79003 js: Use our own jsdoc wrapper
Browse files Browse the repository at this point in the history
grunt-jsdoc is abandoned and only works with an older version of jsdoc.

This is a very simple wrapper around jsdoc itself.

This commit also includes a fix for broken docs.
  • Loading branch information
andrewnicols committed Jan 30, 2024
1 parent 527944c commit 00a7b14
Show file tree
Hide file tree
Showing 5 changed files with 125 additions and 9,827 deletions.
40 changes: 28 additions & 12 deletions .grunt/tasks/jsdoc.js
Expand Up @@ -20,17 +20,33 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

module.exports = grunt => {
// Project configuration.
grunt.config.merge({
jsdoc: {
dist: {
options: {
configure: ".grunt/jsdoc/jsdoc.conf.js",
},
},
},
});
module.exports = (grunt) => {
const path = require('path');

grunt.registerTask('jsdoc', 'Generate JavaScript documentation using jsdoc', function() {
const done = this.async();
const configuration = path.resolve('.grunt/jsdoc/jsdoc.conf.js');

grunt.loadNpmTasks('grunt-jsdoc');
grunt.util.spawn({
cmd: 'jsdoc',
args: [
'--configure',
configuration,
]
}, function(error, result, code) {
if (result.stdout) {
grunt.log.write(result.stdout);
}

if (result.stderr) {
grunt.log.error(result.stderr);
}
if (error) {
grunt.fail.fatal(`JSDoc failed with error code ${code}`);
} else {
grunt.log.write('JSDoc completed successfully'.green);
}
done();
});
});
};

0 comments on commit 00a7b14

Please sign in to comment.