From 85173329c0c1ab180e6df2a34336ec3acfc61a35 Mon Sep 17 00:00:00 2001 From: Takanori Matsumoto Date: Thu, 28 Nov 2024 16:22:05 +0900 Subject: [PATCH 1/2] feat(commit.ts): add option to skip pushing commits to a remote repository to enhance user flexibility during commit process --- src/commands/commit.ts | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/src/commands/commit.ts b/src/commands/commit.ts index 0707ea94..8efa062e 100644 --- a/src/commands/commit.ts +++ b/src/commands/commit.ts @@ -148,26 +148,29 @@ ${chalk.grey('——————————————————')}` process.exit(0); } } else { + const skipOption = `Don't push` const selectedRemote = (await select({ message: 'Choose a remote to push to', - options: remotes.map((remote) => ({ value: remote, label: remote })) + options: [...remotes, skipOption].map((remote) => ({ value: remote, label: remote })), })) as string; if (isCancel(selectedRemote)) process.exit(1); - const pushSpinner = spinner(); - - pushSpinner.start(`Running 'git push ${selectedRemote}'`); - - const { stdout } = await execa('git', ['push', selectedRemote]); - - if (stdout) outro(stdout); - - pushSpinner.stop( - `${chalk.green( - '✔' - )} successfully pushed all commits to ${selectedRemote}` - ); + if (selectedRemote !== skipOption) { + const pushSpinner = spinner(); + + pushSpinner.start(`Running 'git push ${selectedRemote}'`); + + const { stdout } = await execa('git', ['push', selectedRemote]); + + if (stdout) outro(stdout); + + pushSpinner.stop( + `${chalk.green( + '✔' + )} successfully pushed all commits to ${selectedRemote}` + ); + } } } else { const regenerateMessage = await confirm({ From cf6631f961642b091041b9023cfba0ac4c9e96e4 Mon Sep 17 00:00:00 2001 From: GPT8 <57486732+di-sukharev@users.noreply.github.com> Date: Thu, 28 Nov 2024 11:16:33 +0100 Subject: [PATCH 2/2] Update src/commands/commit.ts --- src/commands/commit.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/commands/commit.ts b/src/commands/commit.ts index 8efa062e..1e7f2af6 100644 --- a/src/commands/commit.ts +++ b/src/commands/commit.ts @@ -148,7 +148,7 @@ ${chalk.grey('——————————————————')}` process.exit(0); } } else { - const skipOption = `Don't push` + const skipOption = `don't push` const selectedRemote = (await select({ message: 'Choose a remote to push to', options: [...remotes, skipOption].map((remote) => ({ value: remote, label: remote })),