File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -41,14 +41,18 @@ function convertToProperLangCode (code) {
4141
4242function 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'
You can’t perform that action at this time.
0 commit comments