From 59b6edb49c19a4ea66dfed2872b32ca8bbdbbb89 Mon Sep 17 00:00:00 2001 From: di-sukharev Date: Sun, 8 Jun 2025 10:41:16 +0300 Subject: [PATCH] format --- src/commands/commit.ts | 27 ++++++++++++++++----------- src/utils/git.ts | 2 +- 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/src/commands/commit.ts b/src/commands/commit.ts index 1e7f2af..5edce61 100644 --- a/src/commands/commit.ts +++ b/src/commands/commit.ts @@ -138,7 +138,8 @@ ${chalk.grey('——————————————————')}` ]); pushSpinner.stop( - `${chalk.green('✔')} Successfully pushed all commits to ${remotes[0] + `${chalk.green('✔')} Successfully pushed all commits to ${ + remotes[0] }` ); @@ -148,23 +149,26 @@ ${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 })), + options: [...remotes, skipOption].map((remote) => ({ + value: remote, + label: remote + })) })) as string; if (isCancel(selectedRemote)) process.exit(1); 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( '✔' @@ -235,8 +239,9 @@ export async function commit( stagedFilesSpinner.start('Counting staged files'); - if (!stagedFiles.length) { + if (stagedFiles.length === 0) { stagedFilesSpinner.stop('No files are staged'); + const isStageAllAndCommitConfirmedByUser = await confirm({ message: 'Do you want to stage all files and generate commit message?' }); @@ -245,7 +250,7 @@ export async function commit( if (isStageAllAndCommitConfirmedByUser) { await commit(extraArgs, context, true, fullGitMojiSpec); - process.exit(1); + process.exit(0); } if (stagedFiles.length === 0 && changedFiles.length > 0) { @@ -257,13 +262,13 @@ export async function commit( })) })) as string[]; - if (isCancel(files)) process.exit(1); + if (isCancel(files)) process.exit(0); await gitAdd({ files }); } await commit(extraArgs, context, false, fullGitMojiSpec); - process.exit(1); + process.exit(0); } stagedFilesSpinner.stop( diff --git a/src/utils/git.ts b/src/utils/git.ts index 80afdd8..56ed987 100644 --- a/src/utils/git.ts +++ b/src/utils/git.ts @@ -80,7 +80,7 @@ export const gitAdd = async ({ files }: { files: string[] }) => { await execa('git', ['add', ...files]); - gitAddSpinner.stop('Done'); + gitAddSpinner.stop(`Done adding ${files.length} files`); }; export const getDiff = async ({ files }: { files: string[] }) => {