Skip to content

Commit ce1e027

Browse files
committed
chore(scripts): 修复new-component脚本在组件名有'-'字符连接时错误命名的问题
1 parent 69cf18a commit ce1e027

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

scripts/new-component.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { prompt } from 'enquirer';
2-
import { capitalize } from '@tool-pack/basic';
2+
import { pascalCase } from '@tool-pack/basic';
33
import * as Path from 'path';
44
import Fse from 'fs-extra';
55
import chalk from 'chalk';
@@ -46,7 +46,7 @@ async function getConfig() {
4646
},
4747
}));
4848

49-
config.componentName = capitalize(config.name);
49+
config.componentName = pascalCase(config.name);
5050

5151
const { confirm } = await prompt<{ confirm: boolean }>({
5252
type: 'confirm',
@@ -187,7 +187,7 @@ function getFilename(
187187
{
188188
doc: 'index.zh-CN.md',
189189
scss: 'index.scss',
190-
component: `${capitalize(name)}.tsx`,
190+
component: `${config.componentName}.tsx`,
191191
index: 'index.ts',
192192
types: `${name}.types.ts`,
193193
demo: 'demo/basic.tsx',

0 commit comments

Comments
 (0)