overleaf/services/web/modules/modules-ide.js
Alf Eaton 1ebc8a79cb Merge pull request #3495 from overleaf/ae-prettier-2
Upgrade Prettier to v2

GitOrigin-RevId: 85aa3fa1acb6332c4f58c46165a43d1a51471f33
2021-04-15 02:05:22 +00:00

25 lines
555 B
JavaScript

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,
'/frontend/js/ide/index.js'
)
if (fs.existsSync(entryPath)) {
acc.push(entryPath)
}
return acc
}, entryPoints)
}
module.exports = function () {
return {
code: entryPoints.map(entryPoint => `import '${entryPoint}'`).join('\n')
}
}