-
-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathpatch-ghooks.sh
executable file
·32 lines (29 loc) · 932 Bytes
/
patch-ghooks.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/bin/bash
# fixes the following node error when running `yarn commit` via the standalone cz-customizable:
# "TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension "" for ..."
# which is caused by extensionless js files generated by ghooks, so this script adds the js extension
files=(
"./.git/hooks/applypatch-msg"
"./.git/hooks/commit-msg"
"./.git/hooks/post-applypatch"
"./.git/hooks/post-checkout"
"./.git/hooks/post-commit"
"./.git/hooks/post-merge"
"./.git/hooks/post-receive"
"./.git/hooks/post-rewrite"
"./.git/hooks/post-update"
"./.git/hooks/pre-applypatch"
"./.git/hooks/pre-auto-gc"
"./.git/hooks/pre-commit"
"./.git/hooks/pre-push"
"./.git/hooks/pre-rebase"
"./.git/hooks/pre-receive"
"./.git/hooks/prepare-commit-msg"
"./.git/hooks/push-to-checkout"
"./.git/hooks/update"
)
for file in "${files[@]}"; do
if [ -w "$file" ]; then
mv -v "$file" "$file.js"
fi
done