-
-
Notifications
You must be signed in to change notification settings - Fork 132
Expand file tree
/
Copy pathmise.toml
More file actions
418 lines (374 loc) · 14.5 KB
/
Copy pathmise.toml
File metadata and controls
418 lines (374 loc) · 14.5 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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
# Require a mise new enough for the [deps] providers and the [hooks.postinstall]
# table form used below; older versions fail to parse this file. Environments
# that intentionally ship an older mise and don't need this tooling (e.g. the
# Netlify build for the static schema site) opt out by setting
# MISE_IGNORED_CONFIG_PATHS to this file's path; see schema/netlify.toml.
min_version = "2026.6.12"
[settings]
# Required by the [deps] dependency providers below, which are still an
# experimental mise feature.
experimental = true
[tools]
bun = "1.2.22"
deno = "2.8.3"
node = "22"
pnpm = "10.28.0"
"aqua:dahlia/hongdown" = "0.5.3"
# Nushell powers the cross-platform orchestration tasks (prepare-each,
# check-each, test-each, check-versions) so they run identically on Windows,
# macOS, and Linux without Bash.
"aqua:nushell/nushell" = "0.114.0"
"github:dahlia/sacho" = "0.3.2"
# Dependency providers <https://mise.jdx.dev/dev-tools/deps.html>
#
# These replace the old hand-rolled `install` task. With `auto = true` mise
# runs them automatically before any `mise run`/`mise x`, and the
# `sources`/`outputs` make each one a no-op once it is up to date. The
# `postinstall` hook below also runs them, so a fresh checkout is fully set up
# by a single `mise install`.
# Generate the ActivityPub vocabulary types from their YAML definitions.
[deps.codegen]
auto = true
env = { DENO_LOG = "error" }
sources = [
# loadSchemaFiles() matches /\.ya?ml$/i, so track both extensions: a schema
# added or renamed with the .yml spelling must still invalidate this cache.
"packages/vocab/src/**/*.yaml",
"packages/vocab/src/**/*.yml",
"packages/vocab/scripts/codegen.ts",
# The generator itself: changes to @fedify/vocab-tools (its code or its
# schema) change the generated vocab.ts, so track its sources too.
"packages/vocab-tools/src/**/*.ts",
"packages/vocab-tools/src/**/*.yaml",
"packages/vocab-tools/src/**/*.yml",
]
outputs = ["packages/vocab/src/vocab.ts"]
run = "deno --quiet task -f @fedify/vocab compile"
# Pre-cache every workspace member's Deno exports (writes a freshness stamp).
[deps.deno-cache]
auto = true
depends = ["codegen"]
sources = [
"deno.lock",
"deno.json",
"packages/*/deno.json",
"examples/*/deno.json",
"examples/*/*/deno.json",
"test/smoke/harness/deno.json",
]
outputs = ["node_modules/.cache/fedify-deno-precache.stamp"]
run = "deno run --allow-read --allow-env --allow-run --allow-write scripts/install.ts"
# Install Node.js dependencies with pnpm. pnpm's root `prepare` lifecycle
# script builds all packages, so this also produces the initial dist/ output.
# Depend on `deno-cache` (which depends on `codegen`) so the providers run
# serially (codegen, then the Deno pre-cache, then pnpm install) instead of pnpm
# racing codegen over node_modules under Deno's `nodeModulesDir: auto`.
#
# This is a custom provider (not named `pnpm`, which is a reserved built-in
# provider whose freshness only watches the root package.json and lockfile) so
# its freshness tracks every workspace manifest. Otherwise a change to a
# `packages/*/package.json` or to `pnpm-workspace.yaml` (e.g. before the lockfile
# is regenerated) would be missed and `mise deps` would wrongly skip the install.
[deps.pnpm-install]
auto = true
depends = ["deno-cache"]
sources = [
"package.json",
"pnpm-workspace.yaml",
"pnpm-lock.yaml",
"packages/*/package.json",
"docs/package.json",
"examples/*/package.json",
"examples/*/*/package.json",
]
outputs = ["node_modules/.modules.yaml"]
run = "pnpm install"
# Hooks <https://mise.jdx.dev/hooks.html>
#
# After tools are installed/updated, finish bootstrapping the checkout so that
# `mise install` alone leaves a fresh clone ready to use:
#
# 1. install project dependencies via the deps providers above, and
# 2. install the Git pre-commit hook, but only when one is not already present
# -- this keeps repeat `mise install` runs quiet and never clobbers an
# existing hook. Use `mise run hooks:install` to (re)install it explicitly.
[hooks.postinstall]
shell = "nu -c"
run = '''
mise deps
sacho init --no-interactive
# Only touch the Git hook when git is actually available; in minimal
# environments (e.g. some containers) git may be missing, and invoking it
# unguarded would fail the whole postinstall hook.
if (which git | is-not-empty) {
if (git rev-parse --is-inside-work-tree | complete | get exit_code) == 0 {
let hook = (git rev-parse --git-path hooks/pre-commit | str trim)
if not ($hook | path exists) {
print "Installing Git pre-commit hook..."
mise generate git-pre-commit --write --task=check
}
}
}
'#!/bin/sh
sacho hook-commit-msg "$1"' | save --force .git/hooks/commit-msg
'#!/bin/sh
if test "$1" = prepared; then
sacho_state=$(git rev-parse --git-path sacho-commit-state) || exit $?
if test -f "$sacho_state"; then
sacho hook-reference-transaction "$1"
fi
fi' | save --force .git/hooks/reference-transaction
if $nu.os-info.name != 'windows' {
chmod +x .git/hooks/commit-msg .git/hooks/reference-transaction
}
'''
# Code generation
[tasks.codegen]
description = "Generate ActivityPub vocabulary types from YAML definitions"
# Delegate to the [deps.codegen] provider above rather than repeating its
# sources/outputs here, so the freshness inputs live in one place. --force
# re-runs the provider even when mise considers it fresh; the codegen script
# itself still self-skips when vocab.ts is already up to date, so an explicit
# `mise run codegen` stays fast.
run = "mise deps --force codegen"
# Build
#
# No explicit `depends = ["codegen"]`: the auto [deps.codegen] provider already
# ensures vocab.ts exists before any task, and @fedify/vocab's own `build:self`
# regenerates it. Depending on `codegen` here would defeat the
# `sources`/`outputs` cache below, because the codegen script self-skips without
# rewriting its output, so mise always considers that task non-fresh and would
# re-run this build with it. The outputs glob ends in `/**/*` (not a bare
# `/**`) so mise's freshness check matches the emitted files.
[tasks.build]
description = "Build all packages"
env = { CI = "true" } # Prevent pnpm from prompting for confirmation
# Run through Nushell so the single-quoted pnpm filter is parsed consistently on
# every platform. With the default shell, Windows `cmd` does not strip the
# single quotes, so pnpm would receive the literal `'!./examples/**'`, match no
# projects, and turn the build into a silent no-op.
shell = "nu -c"
sources = [
# Everything under src/, not just *.ts(x): some packages copy non-TypeScript
# assets into dist (e.g. @fedify/init's templates and @fedify/fixture's JSON
# fixtures), and those are real build inputs too.
"packages/*/src/**/*",
"packages/*/tsdown.config.ts",
"packages/*/package.json",
"packages/*/deno.json",
]
outputs = ["packages/*/dist/**/*"]
run = "pnpm --recursive --filter='!./examples/**' run build:self"
[tasks.prepare-each]
description = "Build specific package(s)"
usage = 'arg "<packages>" help="Package name(s) (without @fedify/ prefix)" var=#true var_min=1'
env = { CI = "true" }
shell = "nu -c"
run = '''
for pkg in ($env.usage_packages | split row " " | where ($it | is-not-empty)) {
print $"Preparing package: ($pkg)"
pnpm --filter $"@fedify/($pkg)" build
}
'''
# Code quality
[tasks.check]
description = "Check code formatting, linting, and type checking"
depends = [
"check:fmt",
"check:lint",
"check:types",
"check:md",
"check-versions",
"check:workspace-protocol",
"check:fixture-usage",
]
run = "sacho check"
[tasks."check:fmt"]
description = "Check code formatting"
run = "deno fmt --check"
[tasks."check:lint"]
description = "Check code linting"
run = "deno --quiet lint"
[tasks."check:types"]
description = "Check TypeScript types"
depends = ["codegen"]
env = { DENO_LOG = "error" }
run = "deno --quiet run --allow-read --allow-env --allow-run --allow-sys scripts/check_types.ts"
[tasks."check:md"]
description = "Check Markdown formatting"
run = "hongdown --check"
[tasks.check-versions]
description = "Check that all package versions are consistent across the monorepo"
usage = """
flag "--fix" help="Automatically fix package metadata version mismatches"
flag "--skip-next" help="Skip checking changes.d/next.txt"
"""
shell = "nu -c"
run = '''
let fix_args = if (($env.usage_fix? | default "false") == "true") { ["--fix"] } else { [] }
let skip_next_args = if (($env.usage_skip_next? | default "false") == "true") { ["--skip-next"] } else { [] }
deno run --allow-read --allow-write scripts/check_versions.ts ...$fix_args ...$skip_next_args
'''
[tasks."check:fixture-usage"]
description = "Ensure @fedify/fixture is only used in **/*.test.ts files"
run = "deno run --allow-read scripts/check_fixture_usage.ts"
[tasks."check:workspace-protocol"]
description = "Check for invalid workspace: specifiers without version (*, ^, ~)"
run = "deno run --allow-read scripts/check_workspace_protocol.ts"
[tasks.fmt]
description = "Format the codebase"
run = ["deno fmt", "hongdown --write", "sacho fmt"]
[tasks.check-each]
description = "Check code quality for specific package(s)"
usage = 'arg "<packages>" help="Package name(s) (without @fedify/ prefix)" var=#true var_min=1'
shell = "nu -c"
run = '''
for pkg in ($env.usage_packages | split row " " | where ($it | is-not-empty)) {
print $"Checking package: ($pkg)"
let dir = $"packages/($pkg)"
if not ($dir | path exists) {
print --stderr $"Error: Package directory ($dir) not found"
exit 1
}
deno fmt --check $dir
deno lint $dir
# Guard against an empty glob: `deno check` with no file arguments would
# fall back to type-checking the whole workspace, which is slow and not
# what a per-package check intends.
let ts_files = ((glob $"($dir)/**/*.ts") ++ (glob $"($dir)/**/*.tsx"))
if ($ts_files | is-not-empty) { deno check ...$ts_files }
}
'''
# Testing
[tasks."test:deno"]
wait_for = ["build"]
description = "Run the test suite using Deno"
run = "deno test --check --doc --allow-all --unstable-kv --trace-leaks --parallel"
[tasks."test:node"]
description = "Run the test suite using Node.js"
depends = ["build"]
# See the note on `build`: Nushell keeps the single-quoted pnpm filter working
# on Windows, where `cmd` would otherwise pass it through literally.
shell = "nu -c"
run = "pnpm run --recursive --parallel --filter '!{docs}' --config.enable-pre-post-scripts=false test"
[tasks."test:bun"]
description = "Run the test suite using Bun"
depends = ["build"]
shell = "nu -c"
run = "pnpm run --recursive --parallel --filter '!{docs}' --config.enable-pre-post-scripts=false test:bun"
[tasks.test]
description = "Run the test suite across all environments (Deno, Node.js, Bun)"
depends = [
"check",
"test:deno",
"test:node",
"test:bun",
"test:astro-compat",
"test:temporal-polyfill",
]
[tasks."test:temporal-polyfill"]
description = "Check Temporal polyfill packaging"
depends = ["build"]
run = "deno run --allow-read --allow-write --allow-run scripts/check_temporal_polyfill.ts"
[tasks.test-each]
description = "Run tests for a specific package across all environments"
usage = 'arg "<packages>" help="Package name(s) (without @fedify/ prefix)" var=#true var_min=1'
shell = "nu -c"
run = '''
let pkgs = ($env.usage_packages | split row " " | where ($it | is-not-empty))
mise run prepare-each ...$pkgs
for pkg in $pkgs {
if ($"packages/($pkg)/deno.json" | path exists) {
mise run check-each $pkg
print $"Running Deno tests for package: ($pkg)"
deno task --filter $"@fedify/($pkg)" test
}
if ($"packages/($pkg)/package.json" | path exists) {
print $"Running Node.js tests for package: ($pkg)"
pnpm --filter $"@fedify/($pkg)" test
print $"Running Bun tests for package: ($pkg)"
pnpm --filter $"@fedify/($pkg)" test:bun
}
}
'''
[tasks."test:examples"]
description = "Run tests for all example projects"
# `build` produces @fedify/lint's dist/oxlint.js loader and provisions the
# prebuilt oxlint native binary into node_modules (via the pnpm deps provider) —
# both are needed by the lint/oxlint example.
depends = ["build"]
run = "deno run -A examples/test-examples/mod.ts"
[tasks."test:astro-compat"]
description = "Test @fedify/astro against supported Astro and runtime versions"
depends = ["build"]
run = "deno run -A packages/astro/compat/run.ts"
[tasks."test:monitoring"]
description = "Validate the monitoring example configuration"
run = "deno run -A examples/monitoring/validate.ts"
[tasks."test:init"]
description = "Run tests for the init package"
depends = ["build"]
run = "deno task -f @fedify/init test-init"
# Snapshot updates
# Note: vocab uses @std/testing/snapshot which only works on Deno
# vocab-tools has separate snapshots for each runtime
[tasks."test:deno:update_snapshots"]
description = "Update test snapshots for Deno"
run = [
"deno task -f @fedify/vocab-tools test -- --update",
"deno task -f @fedify/vocab test -- --update",
]
[tasks."test:node:update_snapshots"]
description = "Update test snapshots for Node.js"
run = "pnpm --filter @fedify/vocab-tools test:update_snapshots"
[tasks."test:bun:update_snapshots"]
description = "Update test snapshots for Bun"
run = "pnpm --filter @fedify/vocab-tools test:bun:update_snapshots"
[tasks."test:update_snapshots"]
description = "Update test snapshots for all environments (Deno, Node.js, Bun)"
depends = [
"test:deno:update_snapshots",
"test:node:update_snapshots",
"test:bun:update_snapshots",
]
# Documentation
[tasks.docs]
description = "Start the documentation development server"
run = "pnpm -C docs dev"
[tasks."docs:build"]
description = "Build the documentation for production"
run = "pnpm -C docs build"
[tasks."docs:preview"]
description = "Preview the built documentation"
run = "pnpm -C docs preview"
# Benchmarks
[tasks.bench]
description = "Run benchmarks"
run = "deno task -f @fedify/fedify bench"
# CLI and utilities
[tasks.cli]
description = "Run the Fedify CLI tool"
run = "deno task -f @fedify/cli run"
[tasks.tunnel]
description = "Tunnel port with the Fedify CLI"
run = "deno task -f @fedify/cli run tunnel"
[tasks.update-init-deps]
description = "Update third-party dependency versions in fedify init templates"
run = "deno task -f @fedify/init update-init-deps"
[tasks."hooks:install"]
description = "Install Git hooks for pre-commit checks"
run = "mise generate git-pre-commit --write --task=check"
[tasks.bump-version]
description = "Bump the version of all packages in the monorepo"
usage = """
arg "<version>" help="New version (e.g., 1.2.3, major, minor, patch)"
"""
shell = "nu -c"
run = """
sacho next $env.usage_version
open packages/fedify/deno.json |
upsert version $env.usage_version |
save --force packages/fedify/deno.json
mise run check-versions --fix
mise run fmt
"""