diff --git a/.husky/commit-msg b/.husky/commit-msg index f5f8917b72..fb0bea1b3c 100755 --- a/.husky/commit-msg +++ b/.husky/commit-msg @@ -1 +1,14 @@ -pnpm commitlint --edit --config=commitlint.config.cjs +#! /usr/bin/env sh +set -o errexit -o nounset + +runner=$( + command -v pnpm || + command -v npm || + true +) + +if [ -n "$runner" ]; then + exec "$runner" commitlint --edit --config=commitlint.config.cjs +else + echo 'Neither pnpm nor npm was found. Skip linting.' >&2 +fi diff --git a/.husky/pre-push b/.husky/pre-push index 701e0fbce4..6a8fb70d0f 100755 --- a/.husky/pre-push +++ b/.husky/pre-push @@ -1 +1,14 @@ -pnpm run lint --quiet +#! /usr/bin/env sh +set -o errexit -o nounset + +runner=$( + command -v pnpm || + command -v npm || + true +) + +if [ -n "$runner" ]; then + exec "$runner" run lint --quiet +else + echo 'Neither pnpm nor npm was found. Skip linting.' >&2 +fi