@@ -96,29 +96,38 @@ let vueVersion
9696try {
9797 vueVersion = requireInCwd ( 'vue/package.json' ) . version
9898 console . info ( dim ( `Detected Vue.js version: ${ vueVersion } ` ) )
99- } catch ( e ) {
100- // FIXME: warning that this only support Vue 3
99+ } catch { }
100+
101+ if ( ! vueVersion || ! / ^ 3 / . test ( vueVersion ) ) {
102+ const { continueAnyway } = await prompt ( {
103+ type : 'toggle' ,
104+ disabled : 'No' ,
105+ enabled : 'Yes' ,
106+ name : 'continueAnyway' ,
107+ message : 'Vue 3.x is required but not detected. Continue anyway?' ,
108+ initial : false
109+ } )
110+ if ( ! continueAnyway ) { abort ( ) }
101111}
102112
103113// 4. Check TypeScript
104114// 4.1 Allow JS?
105115// 4.2 Allow JS in Vue? Allow JSX (TSX, if answered no in 4.1) in Vue?
106- let hasTypeScript = false
116+ let detectedTypeScript = false
107117try {
108118 const tsVersion = requireInCwd ( 'typescript/package.json' ) . version
109119 console . info ( dim ( `Detected TypeScript version: ${ tsVersion } ` ) )
110- hasTypeScript = true
111- } catch ( e ) {
112- const anwsers = await prompt ( {
113- type : 'toggle' ,
114- disabled : 'No' ,
115- enabled : 'Yes' ,
116- name : 'hasTypeScript' ,
117- message : 'Does your project use TypeScript?' ,
118- initial : false
119- } )
120- hasTypeScript = anwsers . hasTypeScript
121- }
120+ detectedTypeScript = true
121+ } catch { }
122+
123+ const { hasTypeScript } = await prompt ( {
124+ type : 'toggle' ,
125+ disabled : 'No' ,
126+ enabled : 'Yes' ,
127+ name : 'hasTypeScript' ,
128+ message : 'Does your project use TypeScript?' ,
129+ initial : detectedTypeScript
130+ } )
122131
123132const supportedScriptLangs = { }
124133// FIXME: Use a multi-select prompt
0 commit comments