Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: properly check if git cliff exists or not
- Loading branch information
Showing
1 changed file
with
7 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} |