diff --git a/.editorconfig b/.editorconfig index 11e3deb80..29857d335 100644 --- a/.editorconfig +++ b/.editorconfig @@ -11,6 +11,10 @@ insert_final_newline = true indent_style = space indent_size = 2 +[{.github/pre-commit,.github/required-apps,.github/commit-msg}] +indent_style = space +indent_size = 2 + [.buildkite/hooks/**] indent_style = space indent_size = 2 diff --git a/.github/commit-msg b/.github/commit-msg index 25d5e7b1a..30e10b039 100755 --- a/.github/commit-msg +++ b/.github/commit-msg @@ -1,5 +1,6 @@ #!/bin/sh + . "$(dirname "$0")/_/husky.sh" . "$(dirname "$0")/required-apps" -cd web && ${PMGR} commitlint --edit "$1" +cd web && ${PMGR_EXEC} commitlint --edit "$1" diff --git a/.github/pre-commit b/.github/pre-commit index 8ed8ea753..b7347e9ed 100755 --- a/.github/pre-commit +++ b/.github/pre-commit @@ -8,4 +8,4 @@ fi . "$(dirname "$0")/required-apps" golangci-lint run -v --fix && \ -cd web && "${PMGR}" lint +cd web && ${PMGR_RUN} lint diff --git a/.github/required-apps b/.github/required-apps index f4d8368db..6b28c999c 100644 --- a/.github/required-apps +++ b/.github/required-apps @@ -1,19 +1,20 @@ #!/bin/sh -export PMGR=pnpm - if [ ! -x "$(command -v golangci-lint)" ]; then echo "You must install golangci-lint." exit 1 fi -if [ ! -x "$(command -v pnpm)" ]; then - export PMGR=yarn - if [ ! -x "$(command -v yarn)" ]; then - export PMGR=npm - if [ ! -x "$(command -v npm)" ]; then - echo "You must install a node package manager." - exit 1 - fi - fi +if [ -x "$(command -v pnpm)" ]; then + export PMGR_RUN="pnpm" + export PMGR_EXEC="pnpm" +elif [ -x "$(command -v yarn)" ]; then + export PMGR_RUN="yarn run" + export PMGR_EXEC="yarn dlx" +elif [ -x "$(command -v npm)" ]; then + export PMGR_RUN="npm run" + export PMGR_EXEC="npx" +else + echo "You must install a node package manager (pnpm, yarn, or npm)." + exit 1 fi