@@ -59,8 +59,6 @@ async function togglePromptIf(condition: boolean, message: string, initial = fal
59
59
type Config = {
60
60
scopedPackageName : string
61
61
unscopedPackageName : string
62
- shortUnscopedPackageName : string
63
- projectName : string
64
62
globalVariableName : string
65
63
targetDirName : string
66
64
targetDirPath : string
@@ -173,8 +171,6 @@ async function init() {
173
171
}
174
172
175
173
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 ( ' ' )
178
174
179
175
const targetDirName = await textPrompt ( 'Target directory' , unscopedPackageName )
180
176
@@ -203,7 +199,14 @@ async function init() {
203
199
process . exit ( 1 )
204
200
}
205
201
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 )
207
210
208
211
if ( ! / ^ [ a - z A - Z $ _ ] [ \w $ ] * $ / . test ( globalVariableName ) ) {
209
212
console . log ( 'Invalid variable name: ' + globalVariableName )
@@ -237,8 +240,6 @@ async function init() {
237
240
const config : Config = {
238
241
scopedPackageName,
239
242
unscopedPackageName,
240
- shortUnscopedPackageName,
241
- projectName,
242
243
globalVariableName,
243
244
targetDirName,
244
245
targetDirPath,
0 commit comments