@cisdi/pangu
Version:
develop tool for ui-engine project
28 lines (23 loc) • 630 B
JavaScript
const fs = require('fs')
const path = require('path')
const { entryPaths } = require('./paths')
const { supportTypeScript } = require('./language')
function findEntryPath() {
const filteredPaths = entryPaths.filter((entryPath) => {
return supportTypeScript
? path.extname(entryPath).includes('ts')
: path.extname(entryPath).includes('js')
})
let entryPath
for (let index = 0; index < filteredPaths.length; index++) {
const filePath = filteredPaths[index]
if (fs.existsSync(filePath)) {
entryPath = filePath
break
}
}
return entryPath
}
module.exports = {
findEntryPath,
}