gram/lefthook.yml
abiwab 744f57f058
All checks were successful
CI / ci (push) Successful in 2m24s
fix(vscode-extension): keep build artifacts in sync with source (#18)
The VS Code extension ships two committed files (media/gantt-webview.js,
media/preview.css) that are supposed to be generated from the renderer
source, but nothing actually enforced that. I found a stale copy by
accident.

Now `package` always rebuilds first, and a pre-commit hook catches it
if the generated files fall out of sync again.

Reviewed-on: #18
2026-08-25 07:54:46 +02:00

42 lines
1.9 KiB
YAML

pre-commit:
parallel: true
commands:
biome:
glob: "packages/*/{src,tests}/**"
run: bunx biome check --write --no-errors-on-unmatched {staged_files}
stage_fixed: true
grammar-sync:
glob: "packages/parser/grammar.ohm"
run: |
node packages/parser/scripts/build-grammar.cjs
git diff --exit-code packages/parser/src/grammar-content.ts || {
echo "grammar.ohm changed but packages/parser/src/grammar-content.ts wasn't regenerated/staged.";
echo "Run 'bun run build' and 'git add packages/parser/src/grammar-content.ts', then commit again.";
exit 1;
}
vscode-webview-sync:
glob:
- "packages/renderer/src/**"
- "packages/renderer/gram.css"
- "packages/vscode-extension/src/**"
- "packages/vscode-extension/build.cjs"
run: |
bunx turbo run build --filter=gram-lang
git diff --exit-code packages/vscode-extension/media/gantt-webview.js packages/vscode-extension/media/preview.css || {
echo "packages/renderer or packages/vscode-extension changed but the committed build artifacts (media/gantt-webview.js, media/preview.css) weren't regenerated/staged.";
echo "Run 'bunx turbo run build --filter=gram-lang' and 'git add packages/vscode-extension/media/gantt-webview.js packages/vscode-extension/media/preview.css', then commit again.";
exit 1;
}
changeset-reminder:
glob: "packages/{analyzer,cli,format,i18n,kitchen,language-server,parser,renderer}/src/**"
run: |
if ! git diff --cached --name-only | grep -q '^\.changeset/.*\.md$'; then
echo "Published package(s) modified without a new .changeset/*.md — run 'bun run change' if this affects the public API/behavior.";
fi
lockfile-dedupe:
glob: "{bun.lock,package.json}"
run: bun dedupe --check