-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🤖 config(husky): Configure commit-msg hook.
These changes were automatically generated by a transform whose code can be found at: - https://github.com/aureooms/rejuvenate/blob/e086830dfe927964be93f46b8ecdacd2597eb487/src/transforms/husky:hook-configure-commit-msg.js Please contact the author of the transform if you believe there was an error.
- Loading branch information
1 parent
caad4f8
commit 9effecb
Showing
4 changed files
with
333 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports = { | ||
extends: ['@js-library'] | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
#!/bin/sh | ||
. "$(dirname "$0")/_/husky.sh" | ||
|
||
function ask () { | ||
|
||
# This is a general-purpose function to ask Yes/No questions in Bash, either | ||
# with or without a default answer. It keeps repeating the question until it | ||
# gets a valid answer. | ||
|
||
# http://djm.me/ask | ||
|
||
if [ "${2:-}" = "Y" ]; then | ||
prompt="Y/n" | ||
default=Y | ||
elif [ "${2:-}" = "N" ]; then | ||
prompt="y/N" | ||
default=N | ||
else | ||
prompt="y/n" | ||
default= | ||
fi | ||
|
||
while true; do | ||
|
||
# Ask the question (not using "read -p" as it uses stderr not stdout) | ||
echo -n "$1 [$prompt] " | ||
|
||
# Read the answer (use /dev/tty in case stdin is redirected from somewhere else) | ||
read REPLY </dev/tty | ||
|
||
# Default? | ||
if [ -z "$REPLY" ]; then | ||
REPLY=$default | ||
fi | ||
|
||
# Check if the reply is valid | ||
case "$REPLY" in | ||
Y*|y*) return 0 ;; | ||
N*|n*) return 1 ;; | ||
esac | ||
|
||
done | ||
|
||
} | ||
|
||
while ! npm run commit-msg -- "$1" ; do | ||
if [ -t 1 ] && ask 'There was an error. Do you wish to amend your commit message?' Y ; then | ||
${GIT_EDITOR:-$EDITOR} "$1" < /dev/tty | ||
else | ||
exit 1 | ||
fi | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.