Skip to content
This repository has been archived by the owner on Jan 16, 2024. It is now read-only.

Commit

Permalink
chore: migrate to husky v7
Browse files Browse the repository at this point in the history
  • Loading branch information
vladholubiev committed Dec 16, 2021
1 parent 4fb061f commit f552c6d
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 9 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ yarn.lock
*.log
.DS_Store
dist/
!.husky/_/husky.sh
31 changes: 31 additions & 0 deletions .husky/_/husky.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/sh
if [ -z "$husky_skip_init" ]; then
debug () {
if [ "$HUSKY_DEBUG" = "1" ]; then
echo "husky (debug) - $1"
fi
}

readonly hook_name="$(basename "$0")"
debug "starting $hook_name..."

if [ "$HUSKY" = "0" ]; then
debug "HUSKY env variable is set to 0, skipping hook"
exit 0
fi

if [ -f ~/.huskyrc ]; then
debug "sourcing ~/.huskyrc"
. ~/.huskyrc
fi

export readonly husky_skip_init=1
sh -e "$0" "$@"
exitCode="$?"

if [ $exitCode != 0 ]; then
echo "husky - $hook_name hook exited with code $exitCode (error)"
fi

exit $exitCode
fi
3 changes: 3 additions & 0 deletions .husky/post-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
git update-index --again
3 changes: 3 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
yarn lint-staged
13 changes: 4 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,6 @@
"lint:ci": "eslint . --ext .js,.ts,.json",
"test": "export ENVIRONMENT=local && jest ."
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"lint-staged": {
"*.{html,md,yml}": [
"prettier --write",
Expand All @@ -50,7 +45,7 @@
},
"dependencies": {
"cwd": "0.10.0",
"debug": "4.1.1",
"debug": "4.3.3",
"dynamodb-local": "0.0.31"
},
"devDependencies": {
Expand All @@ -59,11 +54,11 @@
"@aws-sdk/util-dynamodb": "^3.26.0",
"@shelf/eslint-config": "0.19.0",
"@shelf/prettier-config": "0.0.7",
"eslint": "7.6.0",
"husky": "4.2.5",
"eslint": "8.4.1",
"husky": "7.0.4",
"jest": "26.2.2",
"lint-staged": "10.2.11",
"prettier": "2.0.5"
"prettier": "2.5.1"
},
"peerDependencies": {
"@aws-sdk/client-dynamodb": "3.x.x",
Expand Down

0 comments on commit f552c6d

Please sign in to comment.