Skip to content

Commit f3f212f

Browse files
committed
Fix build
1 parent 613e971 commit f3f212f

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

bin/data.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,18 @@ function convertToProperLangCode (code) {
4141

4242
function createLocaleData () {
4343
// languages
44-
const localeFolder = resolve(cwd, 'node_modules/@electerm/electerm-locales/dist')
44+
const localeFolder = resolve(cwd, 'node_modules/@electerm/electerm-locales/dist/cjs')
4545
const pre = process.env.HOST
4646
return fs.readdirSync(localeFolder)
4747
.reduce((prev, fileName) => {
48-
if (!fileName.endsWith('js')) {
48+
if (!fileName.endsWith('js') || fileName === 'index.js' || fileName === 'package.json') {
4949
return prev
5050
}
5151
const filePath = resolve(localeFolder, fileName)
52+
const stats = fs.statSync(filePath)
53+
if (!stats.isFile()) {
54+
return prev
55+
}
5256
const lang = j5.parse(fs.readFileSync(filePath, 'utf-8').replace('module.exports=exports.default=', ''))
5357
const id = fileName.replace('.js', '')
5458
const url = id === 'en_us' ? pre : pre + '/index-' + id + '.html'

0 commit comments

Comments
 (0)