Skip to content

Commit e66a3f9

Browse files
authored
feat: ask instead of bail when git has uncommited changes (#558)
* feat: ask instead of bail when git has uncommited changes * changeset
1 parent ee4e5d9 commit e66a3f9

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

.changeset/wise-rats-bow.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'create-rock': patch
3+
---
4+
5+
feat: ask instead of bail when git has uncommited changes

packages/create-app/src/lib/bin.ts

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import path from 'node:path';
33
import {
44
cancelPromptAndExit,
55
isInteractive,
6-
logger,
76
promptConfirm,
87
resolveAbsolutePath,
98
RockError,
@@ -91,7 +90,7 @@ export async function run() {
9190
await validateGitStatus(projectRoot);
9291

9392
const shouldInit = await promptConfirm({
94-
message: `Detected existing React Native project. Would you like to initialize Rock in this project?`,
93+
message: `Detected existing React Native project. Would you like to migrate it to Rock?`,
9594
confirmLabel: 'Yes',
9695
cancelLabel: 'No',
9796
});
@@ -219,10 +218,14 @@ async function validateGitStatus(dir: string) {
219218
});
220219

221220
if (output.trim() !== '') {
222-
logger.error(
223-
'Git has uncommitted changes. Please commit or stash your changes before continuing with initializing Rock in existing project.',
224-
);
225-
process.exit(1);
221+
const shouldContinue = await promptConfirm({
222+
message: `Git has uncommitted changes. Would you like to continue with initializing Rock in existing project?`,
223+
confirmLabel: 'Yes',
224+
cancelLabel: 'No',
225+
});
226+
if (!shouldContinue) {
227+
cancelPromptAndExit();
228+
}
226229
}
227230
}
228231
}

0 commit comments

Comments
 (0)