-
Notifications
You must be signed in to change notification settings - Fork 342
/
external.js
29 lines (27 loc) · 916 Bytes
/
external.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
const fs = require('fs')
const path = require('path')
function collectModules(basePath, namespaceDir = null) {
let paths = {}
for (const dirName of fs.readdirSync(
path.join(basePath, namespaceDir || ''),
)) {
if (dirName.startsWith('@')) {
paths = { ...collectModules(basePath, dirName), ...paths }
} else if (dirName === 'ui-logic') {
continue
} else if (namespaceDir) {
const namespacedDir = [namespaceDir, dirName].join('/')
paths[namespacedDir] = namespacedDir
} else {
paths[dirName] = dirName
}
}
if (!namespaceDir) {
paths['ui-logic-core'] = 'ui-logic/packages/ui-logic-core'
paths['ui-logic-react'] = 'ui-logic/packages/ui-logic-react'
}
return paths
}
module.exports = {
externalTsModules: collectModules(path.join(__dirname, '..', 'external')),
}