chore: 🤖 gen-type el-locale to locale (#1720)

gen-type el-locale to locale

Co-authored-by: wukang <wukang@yuzhilin.net.cn>
This commit is contained in:
wukang0718 2021-04-06 11:41:25 +08:00 committed by GitHub
parent 87a16f24d3
commit 7b7ec8d5c8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -14,7 +14,7 @@ fs.copyFileSync(
const newIndexPath = path.resolve(__dirname, '../lib/index.d.ts')
fs.copyFileSync(path.resolve(__dirname, '../lib/element-plus/index.d.ts'), newIndexPath)
const index = fs.readFileSync(newIndexPath)
const newIndex = index.toString().replace(/@element-plus\//g, './el-').replace('el-utils', 'utils')
const newIndex = index.toString().replace(/@element-plus\//g, './el-').replace('el-utils', 'utils').replace('el-locale', 'locale')
fs.writeFileSync(newIndexPath, newIndex)
// remove ep
@ -37,7 +37,7 @@ fs.readdirSync(libDirPath).forEach(comp => {
if(outsideImport.test(imp) || imp.includes('@element-plus/')) {
const newImp = imp.replace(outsideImport, (i, c) => {
return i.replace(`../${c}`, `../el-${c}`)
}).replace('@element-plus/', '../el-').replace('el-utils', 'utils')
}).replace('@element-plus/', '../el-').replace('el-utils', 'utils').replace('el-locale', 'locale')
fs.writeFileSync(path.resolve(__dirname, '../lib', newCompName, 'index.d.ts'), newImp)
}
}
@ -57,7 +57,7 @@ fs.readdirSync(libDirPath).forEach(comp => {
if (!fs.lstatSync(path.resolve(srcPath, f)).isDirectory()) {
const imp = fs.readFileSync(path.resolve(srcPath, f)).toString()
if (imp.includes('@element-plus/')) {
const newImp = imp.replace(/@element-plus\//g, '../../el-')
const newImp = imp.replace(/@element-plus\//g, '../../el-').replace('el-utils', 'utils').replace('el-locale', 'locale')
fs.writeFileSync(path.resolve(srcPath, f), newImp)
}
}