-
Notifications
You must be signed in to change notification settings - Fork 183
Expand file tree
/
Copy pathsnap.txt
More file actions
90 lines (78 loc) · 2.22 KB
/
snap.txt
File metadata and controls
90 lines (78 loc) · 2.22 KB
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
> git init
> vp migrate --no-interactive # migration should add git hooks setup
VITE+ - The Unified Toolchain for the Web
◇ Migrated . to Vite+<repeat>
• Node <semver> pnpm <semver>
• 2 config updates applied
• Git hooks configured
> cat package.json # check package.json has prepare script and lint-staged config
{
"name": "migration-add-git-hooks",
"devDependencies": {
"vite": "catalog:",
"vite-plus": "catalog:"
},
"packageManager": "pnpm@<semver>",
"scripts": {
"prepare": "vp config"
}
}
> cat pnpm-workspace.yaml # check pnpm-workspace.yaml has overrides and catalog
catalog:
vite: npm:@voidzero-dev/vite-plus-core@latest
vitest: npm:@voidzero-dev/vite-plus-test@latest
vite-plus: latest
overrides:
vite: 'catalog:'
vitest: 'catalog:'
peerDependencyRules:
allowAny:
- vite
- vitest
allowedVersions:
vite: '*'
vitest: '*'
> cat .vite-hooks/pre-commit # check pre-commit hook
vp staged
> test -d .vite-hooks/_ && echo 'hook shims exist' || echo 'no hook shims' # check vp config ran
hook shims exist
> git config --local core.hooksPath # should be set to .vite-hooks/_
.vite-hooks/_
> cat .vite-hooks/_/.gitignore # internal gitignore should exclude all files
*
> cat .vite-hooks/_/h # hook dispatcher script content
#!/usr/bin/env sh
{ [ "$HUSKY" = "2" ] || [ "$VITE_GIT_HOOKS" = "2" ]; } && set -x
n=$(basename "$0")
s=$(dirname "$(dirname "$0")")/$n
[ ! -f "$s" ] && exit 0
i="${XDG_CONFIG_HOME:-$HOME/.config}/vite-plus/hooks-init.sh"
[ ! -f "$i" ] && i="${XDG_CONFIG_HOME:-$HOME/.config}/husky/init.sh"
[ -f "$i" ] && . "$i"
{ [ "${HUSKY-}" = "0" ] || [ "${VITE_GIT_HOOKS-}" = "0" ]; } && exit 0
d="$(dirname "$(dirname "$(dirname "$0")")")"
export PATH="$d/node_modules/.bin:$PATH"
sh -e "$s" "$@"
c=$?
[ $c != 0 ] && echo "VITE+ - $n script failed (code $c)"
[ $c = 127 ] && echo "VITE+ - command not found in PATH=$PATH"
exit $c
> cat .vite-hooks/_/pre-commit # hook shim should source the dispatcher
#!/usr/bin/env sh
. "$(dirname "$0")/h"
> ls .vite-hooks/_/ | sort # list all generated hook shims
applypatch-msg
commit-msg
h
post-applypatch
post-checkout
post-commit
post-merge
post-rewrite
pre-applypatch
pre-auto-gc
pre-commit
pre-merge-commit
pre-push
pre-rebase
prepare-commit-msg