1
- import { red } from 'kleur' ;
2
- import prompts from 'prompts ' ;
1
+ import { grey , red } from 'kleur' ;
2
+ import { version } from '../package.json ' ;
3
3
import { installCliIfNecessary } from './services/cli.services' ;
4
4
import { generate } from './services/generate.services' ;
5
- import { promptDestination , promptStarter , promptTemplate } from './services/prompt.services' ;
6
- import type { GeneratorInput } from './types/generator' ;
5
+ import {
6
+ promptDestination ,
7
+ promptKind ,
8
+ promptStarter ,
9
+ promptTemplate
10
+ } from './services/prompt.services' ;
7
11
import { checkNodeVersion } from './utils/env.utils' ;
8
- import { assertAnswerCtrlC } from './utils/prompts.utils' ;
9
- import { grey } from 'kleur' ;
10
- import { version } from '../package.json' ;
11
12
12
13
const JUNO_LOGO = ` __ __ __ __ _ ____
13
14
__) || | || \\| |/ \\
@@ -29,28 +30,17 @@ export const run = async () => {
29
30
30
31
const { destination} = await promptDestination ( ) ;
31
32
32
- const { action} : Pick < GeneratorInput , 'action' > = await prompts ( {
33
- type : 'select' ,
34
- name : 'action' ,
35
- message : 'What kind of project are you starting?' ,
36
- choices : [
37
- { title : `A static website` , value : `website` } ,
38
- { title : `An application` , value : `app` }
39
- ]
40
- } ) ;
33
+ const { kind} = await promptKind ( ) ;
41
34
42
- assertAnswerCtrlC ( action ) ;
43
-
44
- if ( action === 'website' ) {
35
+ if ( kind === 'website' ) {
45
36
console . warn ( '🚧 This feature is not yet implemented. Please try again later.' ) ;
46
37
return ;
47
-
48
38
}
49
- const template = await promptTemplate ( action ) ;
50
- const starter = action === 'app' ? await promptStarter ( ) : null ;
39
+ const template = await promptTemplate ( kind ) ;
40
+ const starter = kind === 'app' ? await promptStarter ( ) : null ;
51
41
52
42
await generate ( {
53
- action ,
43
+ kind : kind ,
54
44
destination,
55
45
template,
56
46
starter
0 commit comments