-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhk.pkl
More file actions
125 lines (117 loc) · 3.33 KB
/
Copy pathhk.pkl
File metadata and controls
125 lines (117 loc) · 3.33 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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
// hk configuration — https://hk.jdx.dev
//
// hk replaces husky + lint-staged for this repo. The hooks below mirror the
// previous .husky/* scripts but run with hk's parallel scheduling and
// read/write file locking.
//
// Tools are pinned by mise.toml. Setting HK_MISE=1 in mise.toml makes the
// installed hooks run via `mise x` so contributors who haven't activated
// mise in their shell still get the right versions.
amends "package://github.com/jdx/hk/releases/download/v1.9.2/hk@1.9.2#/Config.pkl"
local biomeGlobs = List(
"*.js",
"*.jsx",
"*.ts",
"*.tsx",
"*.svelte",
"*.css",
"*.json",
"*.jsonc"
)
// Linters run on individual file changes during pre-commit (with auto-fix)
// and as read-only checks on pre-push.
local linters = new Mapping<String, Step> {
["biome"] {
glob = biomeGlobs
// `npx` so the pinned node_modules biome resolves under `mise x` (which
// doesn't add node_modules/.bin to PATH) — matches the danger/commitlint
// steps below.
check = "npx biome check --no-errors-on-unmatched {{files}}"
fix = "npx biome check --write --no-errors-on-unmatched {{files}}"
batch = true
}
// Workspace-aware type checks. They run only when files in the matching
// workspace are staged, mirroring the lint-staged config in package.json.
["frontend-type-check"] {
glob = List(
"apps/frontend/**/*.ts",
"apps/frontend/**/*.js",
"apps/frontend/**/*.svelte"
)
check = "aube --filter @freundebuch/frontend run type-check"
exclusive = true
}
["backend-type-check"] {
glob = List("apps/backend/**/*.ts", "apps/backend/**/*.js")
check = "aube --filter @freundebuch/backend run type-check"
exclusive = true
}
["shared-build"] {
glob = List("packages/shared/**/*.ts", "packages/shared/**/*.js")
check = "aube --filter @freundebuch/shared run build && aube type-check"
exclusive = true
}
}
hooks {
["pre-commit"] {
fix = true
stash = "git"
steps = linters
}
// pre-push mirrors CI. Steps must run in this order; `depends` enforces it.
["pre-push"] {
steps {
["danger"] {
check = "npx danger local --base main"
exclusive = true
}
["check"] {
check = "aube check"
exclusive = true
depends = List("danger")
}
["type-check"] {
check = "aube type-check"
exclusive = true
depends = List("check")
}
["test"] {
check = "aube --recursive run test"
exclusive = true
depends = List("type-check")
}
["test-php"] {
check = """
if [ ! -d apps/sabredav/vendor ]; then
(cd apps/sabredav && composer install --no-interaction --prefer-dist --quiet)
fi
aube test:php
"""
exclusive = true
depends = List("test")
}
["build"] {
check = "aube build"
exclusive = true
depends = List("test-php")
}
}
}
// Validate commit messages against commitlint.config.mjs.
["commit-msg"] {
steps {
["commitlint"] {
check = "npx commitlint --edit {{commit_msg_file}}"
}
}
}
// `hk fix` and `hk check` re-use the same linters so contributors can run
// them ad-hoc without going through git.
["fix"] {
fix = true
steps = linters
}
["check"] {
steps = linters
}
}