@@ -59,8 +59,6 @@ async function togglePromptIf(condition: boolean, message: string, initial = fal
5959type Config = {
6060 scopedPackageName : string
6161 unscopedPackageName : string
62- shortUnscopedPackageName : string
63- projectName : string
6462 globalVariableName : string
6563 targetDirName : string
6664 targetDirPath : string
@@ -173,8 +171,6 @@ async function init() {
173171 }
174172
175173 const unscopedPackageName = scopedPackageName . replace ( / .* \/ / , '' )
176- const shortUnscopedPackageName = unscopedPackageName . replace ( / ^ v u e - / , '' )
177- const projectName = unscopedPackageName . replace ( / - + / g, ' ' ) . trim ( ) . split ( ' ' ) . map ( s => s [ 0 ] . toUpperCase ( ) + s . slice ( 1 ) ) . join ( ' ' )
178174
179175 const targetDirName = await textPrompt ( 'Target directory' , unscopedPackageName )
180176
@@ -203,7 +199,14 @@ async function init() {
203199 process . exit ( 1 )
204200 }
205201
206- const globalVariableName = await textPromptIf ( extended , 'Global variable name' , projectName . replace ( / / g, '' ) )
202+ const defaultGlobalVariableName = unscopedPackageName
203+ . replace ( / \W + / g, ' ' )
204+ . trim ( )
205+ . split ( ' ' )
206+ . map ( s => s [ 0 ] . toUpperCase ( ) + s . slice ( 1 ) )
207+ . join ( '' )
208+
209+ const globalVariableName = await textPromptIf ( extended , 'Global variable name' , defaultGlobalVariableName )
207210
208211 if ( ! / ^ [ a - z A - Z $ _ ] [ \w $ ] * $ / . test ( globalVariableName ) ) {
209212 console . log ( 'Invalid variable name: ' + globalVariableName )
@@ -237,8 +240,6 @@ async function init() {
237240 const config : Config = {
238241 scopedPackageName,
239242 unscopedPackageName,
240- shortUnscopedPackageName,
241- projectName,
242243 globalVariableName,
243244 targetDirName,
244245 targetDirPath,
0 commit comments