feat: change to contains to match scoped modules

replace recursive function with loop
v1.18.x
Barış Soner Uşaklı 5 years ago
parent e327d1247e
commit 6108064ea8

@ -179,23 +179,22 @@ module.exports = function (grunt) {
}; };
function addBaseThemes(plugins) { function addBaseThemes(plugins) {
const themeId = plugins.find(p => p.startsWith('nodebb-theme-')); let themeId = plugins.find(p => p.contains('nodebb-theme-'));
if (!themeId) { if (!themeId) {
return plugins; return plugins;
} }
function getBaseRecursive(themeId) { let baseTheme;
do {
try { try {
const baseTheme = require(themeId + '/theme').baseTheme; baseTheme = require(themeId + '/theme').baseTheme;
if (baseTheme) {
plugins.push(baseTheme);
getBaseRecursive(baseTheme);
}
} catch (err) { } catch (err) {
console.log(err); console.log(err);
} }
}
getBaseRecursive(themeId); if (baseTheme) {
plugins.push(baseTheme);
themeId = baseTheme;
}
} while (baseTheme);
return plugins; return plugins;
} }

Loading…
Cancel
Save