diff --git a/services/web/modules/modules-ide.js b/services/web/modules/modules-ide.js new file mode 100644 index 0000000000..5b4b782a28 --- /dev/null +++ b/services/web/modules/modules-ide.js @@ -0,0 +1,25 @@ +const fs = require('fs') +const path = require('path') + +const MODULES_PATH = path.join(__dirname, './') + +const entryPoints = [] +if (fs.existsSync(MODULES_PATH)) { + fs.readdirSync(MODULES_PATH).reduce((acc, module) => { + const entryPath = path.join( + MODULES_PATH, + module, + '/public/src/ide/index.js' + ) + if (fs.existsSync(entryPath)) { + acc.push(entryPath) + } + return acc + }, entryPoints) +} + +module.exports = function() { + return { + code: `define(['${entryPoints.join("', '")}'], function() {})` + } +} diff --git a/services/web/modules/modules-main.js b/services/web/modules/modules-main.js new file mode 100644 index 0000000000..70eb4c0b15 --- /dev/null +++ b/services/web/modules/modules-main.js @@ -0,0 +1,25 @@ +const fs = require('fs') +const path = require('path') + +const MODULES_PATH = path.join(__dirname, './') + +const entryPoints = [] +if (fs.existsSync(MODULES_PATH)) { + fs.readdirSync(MODULES_PATH).reduce((acc, module) => { + const entryPath = path.join( + MODULES_PATH, + module, + '/public/src/main/index.js' + ) + if (fs.existsSync(entryPath)) { + acc.push(entryPath) + } + return acc + }, entryPoints) +} + +module.exports = function() { + return { + code: `define(['${entryPoints.join("', '")}'], function() {})` + } +}