fix: 编译错误
This commit is contained in:
18
bin/build.ts
18
bin/build.ts
@ -2,8 +2,8 @@
|
||||
* @Author: zhaojinfeng 121016171@qq.com
|
||||
* @Date: 2023-06-19 10:38:07
|
||||
* @LastEditors: zhaojinfeng 121016171@qq.com
|
||||
* @LastEditTime: 2023-06-20 16:41:47
|
||||
* @FilePath: \tianheng-design\bin\build.ts
|
||||
* @LastEditTime: 2023-07-21 04:26:58
|
||||
* @FilePath: \vue3\bin\build.ts
|
||||
* @Description:
|
||||
*
|
||||
*/
|
||||
@ -42,15 +42,25 @@ function buildAComponent(name: string) {
|
||||
})
|
||||
}
|
||||
|
||||
function dirPathToName(dirPath: string) {
|
||||
let component = ''
|
||||
|
||||
dirPath.split('-').forEach((name) => {
|
||||
const first = name[0]
|
||||
component += first.toUpperCase() + name.slice(1)
|
||||
})
|
||||
return component
|
||||
}
|
||||
|
||||
async function renderDTSwithESM(dir: string[]) {
|
||||
const text = await renderFile(resolve(process.cwd(), './ejs/index.esm.ts.ejs'), { dir })
|
||||
const text = await renderFile(resolve(process.cwd(), './ejs/index.esm.ts.ejs'), { dir, dirPathToName })
|
||||
return Promise.all([
|
||||
outputFile(resolve(process.cwd(), './es/index.mjs'), text),
|
||||
outputFile(resolve(process.cwd(), './es/index.d.ts'), text),
|
||||
])
|
||||
}
|
||||
async function renderDTSwithUMD(dir: string[]) {
|
||||
const text = await renderFile(resolve(process.cwd(), './ejs/index.umd.ts.ejs'), { dir })
|
||||
const text = await renderFile(resolve(process.cwd(), './ejs/index.umd.ts.ejs'), { dir, dirPathToName })
|
||||
return Promise.all([
|
||||
outputFile(resolve(process.cwd(), './lib/index.d.ts'), text),
|
||||
])
|
||||
|
Reference in New Issue
Block a user