1 // This file is part of Moodle - http://moodle.org/
3 // Moodle is free software: you can redistribute it and/or modify
4 // it under the terms of the GNU General Public License as published by
5 // the Free Software Foundation, either version 3 of the License, or
6 // (at your option) any later version.
8 // Moodle is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 // GNU General Public License for more details.
13 // You should have received a copy of the GNU General Public License
14 // along with Moodle. If not, see <http://www.gnu.org/licenses/>.
17 * Helper functions for working with Moodle component names, directories, and sources.
19 * @copyright 2019 Andrew Nicols <andrew@nicols.co.uk>
20 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
26 // Do not include any plugins as stanard.
29 plugins.push('plugins/markdown');
32 * Get the source configuration.
36 const getSource = () => {
37 const glob = require('glob');
38 const path = require('path');
39 const ComponentList = require(path.resolve('.grunt/components.js'));
40 const thirdPartyPaths = ComponentList.getThirdPartyPaths();
44 includePattern: ".+\\.js$",
49 ComponentList.getAmdSrcGlobList().forEach(async pattern => {
50 includeList.push(...glob.sync(pattern));
53 const cwdLength = process.cwd().length + 1;
54 includeList.forEach(path => {
55 if (source.include.indexOf(path) !== -1) {
56 // Ensure no duplicates.
60 const relPath = path.substring(cwdLength);
61 if (thirdPartyPaths.indexOf(relPath) !== -1) {
65 source.include.push(path);
68 source.include.push('.grunt/jsdoc/README.md');
73 // Allow the use of unknown tags.
74 // We have a lot of legacy uses of these.
75 allowUnknownTags: true,
77 // We make use of jsdoc and closure dictionaries as standard.
84 // Template configuraiton.
87 monospaceLinks: false,
92 destination: "./jsdoc/",
93 template: "node_modules/docdash",
117 href: "https://moodledev.io",
119 "class": "menu-item",
123 href: "https://developer.mozilla.org/en-US/docs/Web/JavaScript",
125 "class": "menu-item",