-
Notifications
You must be signed in to change notification settings - Fork 16
/
husky.node.txt
58 lines (39 loc) · 3.75 KB
/
husky.node.txt
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
HUSKY
VERSION ==> #9.1.1
#Allows git hooks directory to be committed
/=+===============================+=\
/ : : \
)==: INIT :==(
\ :_______________________________: /
\=+===============================+=/
husky init #Adds `husky` to PACKAGE.scripts.prepare, then run `husky`
husky [HOOKS_DIR] #Initializes HOOKS_DIR
HOOKS_DIR #Def: './.husky'
#Must be git committed
/=+===============================+=\
/ : : \
)==: HOOK :==(
\ :_______________________________: /
\=+===============================+=/
HOOKS_DIR/HOOK #Run on specific HOOK (pre-commit, etc.)
#sh file, but no need for shebang
#Receive same argument as normal git hook
#Has ./node_modules/.bin/ in ENVVAR PATH
HOOKS_DIR/pre-commit #`husky init` initializes it with "npm test"
~/.config/husky/init.sh #Run on any HOOK
$XDG_CONFIG_HOME/husky/init.sh #No need for shebang
#Receive no argument
ENVVAR HUSKY=0 #Make `husky` and HOOKS_DIR/HOOK a noop, but not init.sh
ENVVAR HUSKY=2 #Use `set -x` on HOOKS_DIR/HOOK and init.sh
/=+===============================+=\
/ : : \
)==: INTERNAL :==(
\ :_______________________________: /
\=+===============================+=/
HOOKS_DIR/_ #Internal files
#`husky` sets it as git hooks path using: git config core.hooksPath HOOKS_DIR/_
#Git ignored, using HOOKS_DIR/_/.gitignore with contents '*'
HOOKS_DIR/_/HOOK #Actual git hook, which forwards to HOOKS_DIR/_/h
HOOKS_DIR/_/h #Runs init.sh and HOOKS_DIR/HOOK