File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import fs from 'node:fs'
2- import { cancel , intro } from '@clack/prompts'
2+ import { cancel , confirm , intro , isCancel } from '@clack/prompts'
33
44import {
55 finalizeAddOns ,
@@ -47,10 +47,15 @@ export async function promptForCreateOptions(
4747 fs . existsSync ( options . projectName ) &&
4848 fs . readdirSync ( options . projectName ) . length > 0
4949 ) {
50- cancel (
51- `The directory ${ options . projectName } is not empty. Please choose a different project name.` ,
52- )
53- process . exit ( 1 )
50+ const shouldContinue = await confirm ( {
51+ message : `Target directory ${ options . projectName } is not empty. Do you want to continue?` ,
52+ initialValue : true ,
53+ } )
54+
55+ if ( isCancel ( shouldContinue ) || ! shouldContinue ) {
56+ cancel ( 'Operation cancelled.' )
57+ process . exit ( 0 )
58+ }
5459 }
5560
5661 // Router type selection
You can’t perform that action at this time.
0 commit comments