Skip to content

Commit a6d95fc

Browse files
committed
fix(git): tighten pre-push formatting enforcement
- switch the pre-push hook to pnpm format:check so pushes fail before unformatted commits are sent - remove deprecated husky bootstrap lines from the hook file for v9-style hooks - report skipped grammar sync files separately from successful updates
1 parent b9381d7 commit a6d95fc

2 files changed

Lines changed: 11 additions & 7 deletions

File tree

.husky/pre-push

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
#!/usr/bin/env sh
2-
. "$(dirname -- "$0")/_/husky.sh"
3-
4-
echo "Running pnpm format before push..."
5-
pnpm format
1+
echo "Checking formatting before push..."
2+
pnpm format:check
63

scripts/sync-grammars.mjs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ const destDir = path.resolve('grammars');
3232
fs.mkdirSync(destDir, { recursive: true });
3333

3434
let copied = 0;
35+
let skipped = 0;
3536

3637
for (const wasm of CURATED_WASMS) {
3738
const src = path.join(sourceDir, wasm);
@@ -48,6 +49,7 @@ for (const wasm of CURATED_WASMS) {
4849

4950
try {
5051
fs.renameSync(tmp, dest);
52+
copied++;
5153
} catch (error) {
5254
try {
5355
fs.rmSync(tmp, { force: true });
@@ -56,12 +58,17 @@ for (const wasm of CURATED_WASMS) {
5658
}
5759

5860
if (error && typeof error === 'object' && 'code' in error && (error.code === 'EPERM' || error.code === 'EBUSY')) {
61+
skipped++;
5962
console.warn(`sync-grammars: skipped updating ${wasm} due to file lock (${error.code})`);
6063
} else {
6164
throw error;
6265
}
6366
}
64-
copied++;
6567
}
6668

67-
console.log(`sync-grammars: ${copied} wasm files → ${destDir}`);
69+
const summary =
70+
skipped > 0
71+
? `sync-grammars: ${copied} wasm files updated, ${skipped} skipped → ${destDir}`
72+
: `sync-grammars: ${copied} wasm files → ${destDir}`;
73+
74+
console.log(summary);

0 commit comments

Comments
 (0)