Skip to content

Commit df7c086

Browse files
committed
Change to confirm before exiting
1 parent 220d04f commit df7c086

1 file changed

Lines changed: 10 additions & 5 deletions

File tree

packages/cta-cli/src/options.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import fs from 'node:fs'
2-
import { cancel, intro } from '@clack/prompts'
2+
import { cancel, confirm, intro, isCancel } from '@clack/prompts'
33

44
import {
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

0 commit comments

Comments
 (0)