Skip to content

Commit

Permalink
Merge pull request #97 from 10up/feature/husky-anywhere
Browse files Browse the repository at this point in the history
allow husky to install properly regardless of where wp-scaffold is used
  • Loading branch information
darylldoyle authored Mar 14, 2024
2 parents f4de58b + 3770319 commit 77b0f58
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 7 additions & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
#!/bin/sh
#!/bin/bash
. "$(dirname "$0")/_/husky.sh"

PARENT_DIR="$(git rev-parse --show-toplevel)"
SCAFFOLD_PATH=$(grep hooksPath "${PARENT_DIR}"/.git/config | awk '{print $3}')

if [ ! -z "${SCAFFOLD_PATH}" ]; then
cd "${PARENT_DIR}/${SCAFFOLD_PATH}/.."
fi
npx lint-staged
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"mu-plugins/10up-plugin"
],
"scripts": {
"prepare": "husky install",
"prepare": "TEN=\"$(pwd)\"; UP=\"$(git rev-parse --show-toplevel)\"; TENUP=\"${TEN#\"$UP\"}\"; cd \"$(git rev-parse --show-toplevel)\"; husky install .\"${TENUP}\"/.husky",
"build": "npm run build --workspaces --if-present",
"start": "npm run watch",
"watch:theme": "npm run watch -w=tenup-theme",
Expand Down

0 comments on commit 77b0f58

Please sign in to comment.