MDL-79003 js: Use our own jsdoc wrapper

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.
This commit is contained in:
Andrew Nicols 2023-02-03 22:48:04 +08:00
parent f9bd195365
commit f457725b3a
No known key found for this signature in database
GPG Key ID: 6D1E3157C8CFBF14
5 changed files with 126 additions and 9828 deletions

View File

@ -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.loadNpmTasks('grunt-jsdoc');
grunt.registerTask('jsdoc', 'Generate JavaScript documentation using jsdoc', function() {
const done = this.async();
const configuration = path.resolve('.grunt/jsdoc/jsdoc.conf.js');
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();
});
});
};

9901
npm-shrinkwrap.json generated

File diff suppressed because it is too large Load Diff

View File

@ -14,7 +14,7 @@
"babel-plugin-transform-es2015-modules-amd-lazy": "2.0.1",
"babel-preset-minify": "0.5.1",
"cross-env": "^7.0.3",
"docdash": "^1.2.0",
"docdash": "^2.0.2",
"eslint": "^8.56.0",
"eslint-plugin-jsdoc": "^48.0.4",
"eslint-plugin-promise": "6.0.0",
@ -26,14 +26,13 @@
"grunt-contrib-uglify": "5.0.1",
"grunt-contrib-watch": "1.1.0",
"grunt-eslint": "24.0.0",
"grunt-jsdoc": "^2.4.1",
"grunt-rollup": "^11.9.0",
"grunt-sass": "3.1.0",
"grunt-stylelint": "0.15.0",
"hugo-bin": "^0.80.2",
"hugo-lunr-indexer": "^1.1.3",
"jsdoc": "^3.6.10",
"jsdoc-to-markdown": "^7.1.1",
"jsdoc": "^4.0.2",
"jsdoc-to-markdown": "^8.0.0",
"jshint": "^2.13.4",
"jstoxml": "^3.2.3",
"npm-run-all": "^4.1.5",

View File

@ -1 +1 @@
{"version":3,"file":"feedback.min.js","sources":["../src/feedback.js"],"sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see <http://www.gnu.org/licenses/>.\n\n/**\n * Backward compatibility file for the old popover.js\n *\n * @module qtype_multianswer/feedback\n * @copyright 2023 Jun Pataleta <jun@moodle.com>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nimport 'theme_boost/popover';\nimport $ from 'jquery';\n\n/** @type {object} Contains the list of selectors for this module. */\nconst SELECTORS = {\n FEEDBACK_TRIGGER: '.feedbacktrigger[data-toggle=\"popover\"]',\n};\n\n/** @type {boolean} Flag to indicate whether the feedback popovers have been already initialised. */\nlet feedbackInitialised = false;\n\n/**\n * Function to initialise the feedback popovers.\n */\nconst initPopovers = () => {\n if (!feedbackInitialised) {\n $(SELECTORS.FEEDBACK_TRIGGER).popover();\n\n document.addEventListener('click', (e) => {\n if (e.target.closest(SELECTORS.FEEDBACK_TRIGGER)) {\n e.preventDefault();\n }\n });\n feedbackInitialised = true;\n }\n};\n\nexport default {\n initPopovers: initPopovers,\n};\n"],"names":["SELECTORS","feedbackInitialised","initPopovers","popover","document","addEventListener","e","target","closest","preventDefault"],"mappings":";;;;;;;mJA2BMA,2BACgB,8CAIlBC,qBAAsB,eAkBX,CACXC,aAdiB,KACZD,0CACCD,4BAA4BG,UAE9BC,SAASC,iBAAiB,SAAUC,IAC5BA,EAAEC,OAAOC,QAAQR,6BACjBM,EAAEG,oBAGVR,qBAAsB"}
{"version":3,"file":"feedback.min.js","sources":["../src/feedback.js"],"sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see <http://www.gnu.org/licenses/>.\n\n/**\n * Backward compatibility file for the old popover.js\n *\n * @module qtype_multianswer/feedback\n * @copyright 2023 Jun Pataleta <jun@moodle.com>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nimport 'theme_boost/popover';\nimport $ from 'jquery';\n\n/** @property {object} Contains the list of selectors for this module. */\nconst SELECTORS = {\n FEEDBACK_TRIGGER: '.feedbacktrigger[data-toggle=\"popover\"]',\n};\n\n/** @property {boolean} Flag to indicate whether the feedback popovers have been already initialised. */\nlet feedbackInitialised = false;\n\n/**\n * Function to initialise the feedback popovers.\n */\nconst initPopovers = () => {\n if (!feedbackInitialised) {\n $(SELECTORS.FEEDBACK_TRIGGER).popover();\n\n document.addEventListener('click', (e) => {\n if (e.target.closest(SELECTORS.FEEDBACK_TRIGGER)) {\n e.preventDefault();\n }\n });\n feedbackInitialised = true;\n }\n};\n\nexport default {\n initPopovers: initPopovers,\n};\n"],"names":["SELECTORS","feedbackInitialised","initPopovers","popover","document","addEventListener","e","target","closest","preventDefault"],"mappings":";;;;;;;mJA2BMA,2BACgB,8CAIlBC,qBAAsB,eAkBX,CACXC,aAdiB,KACZD,0CACCD,4BAA4BG,UAE9BC,SAASC,iBAAiB,SAAUC,IAC5BA,EAAEC,OAAOC,QAAQR,6BACjBM,EAAEG,oBAGVR,qBAAsB"}

View File

@ -24,12 +24,12 @@
import 'theme_boost/popover';
import $ from 'jquery';
/** @type {object} Contains the list of selectors for this module. */
/** @property {object} Contains the list of selectors for this module. */
const SELECTORS = {
FEEDBACK_TRIGGER: '.feedbacktrigger[data-toggle="popover"]',
};
/** @type {boolean} Flag to indicate whether the feedback popovers have been already initialised. */
/** @property {boolean} Flag to indicate whether the feedback popovers have been already initialised. */
let feedbackInitialised = false;
/**