Skip to content

Commit

Permalink
fix: properly check if git cliff exists or not
Browse files Browse the repository at this point in the history
  • Loading branch information
favna committed Apr 18, 2022
1 parent e33a98f commit 5ab2727
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/lib/gitCliffExists.ts
@@ -1,8 +1,12 @@
import { fromAsync, isOk } from '@sapphire/result';
import { execa } from 'execa';
import { fromAsync, isErr } from '@sapphire/result';
import { execa, type ExecaReturnValue } from 'execa';

export async function gitCliffExists(): Promise<boolean> {
const result = await fromAsync(() => execa('git', ['cliff']));

return isOk(result);
if (isErr(result) && (result.error as ExecaReturnValue).stderr.includes('is not a git command')) {
return false;
}

return true;
}

0 comments on commit 5ab2727

Please sign in to comment.