File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed
src/webview/create-component/pages Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -135,7 +135,14 @@ export function FromLocalCodebase(props: FromLocalCodebaseProps) {
135135 if ( props . rootFolder && props . rootFolder . length != 0 ) {
136136 setProjectFolder ( props . rootFolder ) ;
137137 const isWindowsPath = props . rootFolder . charAt ( 1 ) === ':' ;
138- const componentNameFromFolder : string = props . rootFolder . substring ( props . rootFolder . lastIndexOf ( isWindowsPath ? '\\' : '/' ) + 1 ) ;
138+ let componentNameFromFolder : string = props . rootFolder //
139+ . substring ( props . rootFolder . lastIndexOf ( isWindowsPath ? '\\' : '/' ) + 1 )
140+ . toLocaleLowerCase ( )
141+ . replace ( / [ ^ a - z 0 - 9 - ] + / g, '-' )
142+ . replace ( / - + / g, '-' )
143+ . replace ( / - $ / , '' )
144+ . replace ( / ^ [ 0 - 9 ] + / , '' ) ;
145+ componentNameFromFolder = componentNameFromFolder . length ? componentNameFromFolder : 'component' ;
139146 setComponentName ( componentNameFromFolder ) ;
140147 window . vscodeApi . postMessage ( {
141148 action : 'validateComponentName' ,
You can’t perform that action at this time.
0 commit comments