File tree 2 files changed +59
-12
lines changed
2 files changed +59
-12
lines changed Original file line number Diff line number Diff line change @@ -49,12 +49,38 @@ import * as p from '@clack/prompts';
49
49
] ,
50
50
} )
51
51
)
52
- . step ( 'install' , ( { results } ) =>
52
+ . step ( 'install' , ( ) =>
53
53
p . confirm ( {
54
54
message : 'Install dependencies?' ,
55
55
initialValue : false ,
56
56
} )
57
57
)
58
+ . step ( 'fork' , ( { results } ) => {
59
+ if ( results . install === true ) {
60
+ return p
61
+ . workflow ( )
62
+ . step ( 'package' , ( ) =>
63
+ p . select ( {
64
+ message : 'Which package do you want to user?' ,
65
+ options : [
66
+ {
67
+ label : 'npm' ,
68
+ value : 'npm' ,
69
+ } ,
70
+ {
71
+ label : 'yarn' ,
72
+ value : 'yarn' ,
73
+ } ,
74
+ {
75
+ label : 'pnpm' ,
76
+ value : 'pnpm' ,
77
+ } ,
78
+ ] ,
79
+ } )
80
+ )
81
+ . run ( ) ;
82
+ }
83
+ } )
58
84
. run ( ) ;
59
85
60
86
await p
Original file line number Diff line number Diff line change @@ -166,22 +166,43 @@ import * as p from '@clack/prompts';
166
166
167
167
const results = await p
168
168
.workflow ()
169
- .step (' name' , () => p .text ({ message: ' What is your name?' }))
170
- .step (' age' , () => p .text ({ message: ' What is your age?' }))
171
- .step (' color' , ({ results }) =>
172
- p .multiselect ({
173
- message: ` What is your favorite color ${ results .name } ?` ,
174
- options: [
175
- { value: ' red' , label: ' Red' },
176
- { value: ' green' , label: ' Green' },
177
- { value: ' blue' , label: ' Blue' },
178
- ],
169
+ .step (' name' , () => p .text ({ message: ' What is your package name?' }))
170
+ .step (' install' , () =>
171
+ p .confirm ({
172
+ message: ' Install dependencies?' ,
173
+ initialValue: false ,
179
174
})
180
175
)
176
+ .step (' fork' , ({ results }) => {
177
+ if (results .install === true ) {
178
+ return p
179
+ .workflow ()
180
+ .step (' package' , () =>
181
+ p .select ({
182
+ message: ' Which package do you want to user?' ,
183
+ options: [
184
+ {
185
+ label: ' npm' ,
186
+ value: ' npm' ,
187
+ },
188
+ {
189
+ label: ' yarn' ,
190
+ value: ' yarn' ,
191
+ },
192
+ {
193
+ label: ' pnpm' ,
194
+ value: ' pnpm' ,
195
+ },
196
+ ],
197
+ })
198
+ )
199
+ .run ();
200
+ }
201
+ })
181
202
.onCancel (() => {
182
203
p .cancel (' Workflow canceled' );
183
204
process .exit (0 );
184
205
})
185
206
.run ();
186
- console .log (results . name , results . age , results . color );
207
+ console .log (results);
187
208
```
You can’t perform that action at this time.
0 commit comments