This commit is contained in:
di-sukharev
2025-06-08 10:41:16 +03:00
parent 7683004464
commit 59b6edb49c
2 changed files with 17 additions and 12 deletions
+16 -11
View File
@@ -138,7 +138,8 @@ ${chalk.grey('——————————————————')}`
]); ]);
pushSpinner.stop( 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); process.exit(0);
} }
} else { } else {
const skipOption = `don't push` const skipOption = `don't push`;
const selectedRemote = (await select({ const selectedRemote = (await select({
message: 'Choose a remote to push to', 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; })) as string;
if (isCancel(selectedRemote)) process.exit(1); if (isCancel(selectedRemote)) process.exit(1);
if (selectedRemote !== skipOption) { if (selectedRemote !== skipOption) {
const pushSpinner = spinner(); const pushSpinner = spinner();
pushSpinner.start(`Running 'git push ${selectedRemote}'`); pushSpinner.start(`Running 'git push ${selectedRemote}'`);
const { stdout } = await execa('git', ['push', selectedRemote]); const { stdout } = await execa('git', ['push', selectedRemote]);
if (stdout) outro(stdout); if (stdout) outro(stdout);
pushSpinner.stop( pushSpinner.stop(
`${chalk.green( `${chalk.green(
'✔' '✔'
@@ -235,8 +239,9 @@ export async function commit(
stagedFilesSpinner.start('Counting staged files'); stagedFilesSpinner.start('Counting staged files');
if (!stagedFiles.length) { if (stagedFiles.length === 0) {
stagedFilesSpinner.stop('No files are staged'); stagedFilesSpinner.stop('No files are staged');
const isStageAllAndCommitConfirmedByUser = await confirm({ const isStageAllAndCommitConfirmedByUser = await confirm({
message: 'Do you want to stage all files and generate commit message?' message: 'Do you want to stage all files and generate commit message?'
}); });
@@ -245,7 +250,7 @@ export async function commit(
if (isStageAllAndCommitConfirmedByUser) { if (isStageAllAndCommitConfirmedByUser) {
await commit(extraArgs, context, true, fullGitMojiSpec); await commit(extraArgs, context, true, fullGitMojiSpec);
process.exit(1); process.exit(0);
} }
if (stagedFiles.length === 0 && changedFiles.length > 0) { if (stagedFiles.length === 0 && changedFiles.length > 0) {
@@ -257,13 +262,13 @@ export async function commit(
})) }))
})) as string[]; })) as string[];
if (isCancel(files)) process.exit(1); if (isCancel(files)) process.exit(0);
await gitAdd({ files }); await gitAdd({ files });
} }
await commit(extraArgs, context, false, fullGitMojiSpec); await commit(extraArgs, context, false, fullGitMojiSpec);
process.exit(1); process.exit(0);
} }
stagedFilesSpinner.stop( stagedFilesSpinner.stop(
+1 -1
View File
@@ -80,7 +80,7 @@ export const gitAdd = async ({ files }: { files: string[] }) => {
await execa('git', ['add', ...files]); await execa('git', ['add', ...files]);
gitAddSpinner.stop('Done'); gitAddSpinner.stop(`Done adding ${files.length} files`);
}; };
export const getDiff = async ({ files }: { files: string[] }) => { export const getDiff = async ({ files }: { files: string[] }) => {