perf: 生成命名

This commit is contained in:
2023-06-25 10:50:20 +08:00
parent cedc2c61ed
commit d8a3c59e85

View File

@ -2,8 +2,8 @@
* @Author: zhaojinfeng 121016171@qq.com
* @Date: 2023-06-20 16:46:04
* @LastEditors: zhaojinfeng 121016171@qq.com
* @LastEditTime: 2023-06-21 10:56:31
* @FilePath: \tianheng-design\bin\GEN.TS
* @LastEditTime: 2023-06-25 10:47:14
* @FilePath: \uni\bin\gen.ts
* @Description:
*
*/
@ -32,13 +32,18 @@ async function rendenVUE(data: RenderData) {
}
co(function*() {
const name: string = yield coprompt('起一个组件英文名称(不区分大小写): ')
if (!name)
const input: string = yield coprompt('起一个组件英文名称(不区分大小写): ')
if (!input)
throw new Error('不能创建')
const lowerName = name.toLowerCase()
const first = lowerName[0]
const component = first.toUpperCase() + lowerName.slice(1)
const lowerName = input.toLowerCase()
let component = ''
input.split('-').forEach((name) => {
const first = name[0]
component += first.toUpperCase() + name.slice(1)
})
const data = { lowerName, component }
Promise
.all([rendenStories(data), rendenVUE(data)])