This commit is contained in:
Eloy Lafuente (stronk7) 2019-08-05 13:30:46 +02:00
commit 0e5f6317c1

View File

@ -36,6 +36,7 @@
module.exports = ({ template, types }) => {
const fs = require('fs');
const path = require('path');
const glob = require('glob');
const cwd = process.cwd();
@ -72,7 +73,7 @@ module.exports = ({ template, types }) => {
var rawContents = fs.readFileSync(file);
var subplugins = JSON.parse(rawContents);
for (const [component, path] of Object.entries(subplugins)) {
for (const [component, path] of Object.entries(subplugins.plugintypes)) {
if (path) {
moodlePlugins[path] = component;
}
@ -92,7 +93,7 @@ module.exports = ({ template, types }) => {
*/
function getModuleNameFromFileName(searchFileName) {
searchFileName = fs.realpathSync(searchFileName);
const relativeFileName = searchFileName.replace(`${cwd}/`, '');
const relativeFileName = searchFileName.replace(`${cwd}${path.sep}`, '').replace(/\\/g, '/');
const [componentPath, file] = relativeFileName.split('/amd/src/');
const fileName = file.replace('.js', '');
@ -202,4 +203,4 @@ module.exports = ({ template, types }) => {
}
}
};
};
};