Skip to content

Commit

Permalink
feat(hooks): add support for husky v6
Browse files Browse the repository at this point in the history
  • Loading branch information
jegli committed Jun 3, 2021
1 parent c45d98f commit 32d9ab5
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/hooks-installed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,17 @@ export const getHooksInstalledChecker = async () => {
if (gitRootDirectory.error) {
return gitRootDirectory;
}
const hooksInstalled = await Promise.all([
const husky4HooksInstalled = await Promise.all([
isHookInstalled(`${gitRootDirectory.text}/.git/hooks/commit-msg`),
isHookInstalled(`${gitRootDirectory.text}/.git/hooks/pre-commit`),
]);
const areAllHooksInstalled = hooksInstalled.every((hookInstalled) => hookInstalled);
const husky6HooksInstalled = await Promise.all([
isHookInstalled(`${gitRootDirectory.text}/.husky/commit-msg`),
isHookInstalled(`${gitRootDirectory.text}/.husky/pre-commit`),
]);
const areAllHooksInstalled =
husky4HooksInstalled.every((hookInstalled) => hookInstalled) ||
husky6HooksInstalled.every((hookInstalled) => hookInstalled);
return areAllHooksInstalled
? { error: false, text: logMessages.success.gitHooksAreInstalled() }
: { error: true, text: logMessages.error.gitHooksNotInstalledError() };
Expand Down

0 comments on commit 32d9ab5

Please sign in to comment.