Skip to content

Commit

Permalink
fix: cli cancel not working
Browse files Browse the repository at this point in the history
changeset
  • Loading branch information
programming-with-ia committed Nov 26, 2024
1 parent d22a0bf commit e24e1b7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
5 changes: 5 additions & 0 deletions .changeset/gold-beans-kiss.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"create-t3-app": patch
---

fix: cli cancel not working
16 changes: 8 additions & 8 deletions cli/src/helpers/scaffoldProject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,22 +53,22 @@ export const scaffoldProject = async ({
],
initialValue: "abort",
});
if (overwriteDir === "abort") {

if (p.isCancel(overwriteDir) || overwriteDir === "abort") {
spinner.fail("Aborting installation...");
process.exit(1);
}

const overwriteAction =
overwriteDir === "clear"
? "clear the directory"
: "overwrite conflicting files";

const confirmOverwriteDir = await p.confirm({
message: `Are you sure you want to ${overwriteAction}?`,
message: `Are you sure you want to ${
overwriteDir === "clear"
? "clear the directory"
: "overwrite conflicting files"
}?`,
initialValue: false,
});

if (!confirmOverwriteDir) {
if (p.isCancel(confirmOverwriteDir) || !confirmOverwriteDir) {
spinner.fail("Aborting installation...");
process.exit(1);
}
Expand Down

0 comments on commit e24e1b7

Please sign in to comment.