ci: fix npm run (#4849)

pull/4850/head^2
James Elliott 2023-01-30 09:59:32 +11:00 committed by GitHub
parent 8acc1053ed
commit 74e5272f33
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 19 additions and 13 deletions

View File

@ -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

3
.github/commit-msg vendored
View File

@ -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"

2
.github/pre-commit vendored
View File

@ -8,4 +8,4 @@ fi
. "$(dirname "$0")/required-apps"
golangci-lint run -v --fix && \
cd web && "${PMGR}" lint
cd web && ${PMGR_RUN} lint

23
.github/required-apps vendored
View File

@ -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