Skip to content

Commit bd902ea

Browse files
authored
Add pre-commit dprint hook, fix post-checkout hook (microsoft#55799)
1 parent 190d709 commit bd902ea

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed

scripts/hooks/post-checkout

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
#!/bin/sh
2-
npm run npx hereby -- generate-diagnostics
2+
./node_modules/.bin/hereby generate-diagnostics || true

scripts/hooks/pre-commit

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
if git diff --name-only --cached --relative | xargs --no-run-if-empty ./node_modules/.bin/dprint fmt; then
3+
git diff --name-only --cached --relative | xargs --no-run-if-empty git add
4+
fi

scripts/link-hooks.mjs

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ const __dirname = path.dirname(__filename);
1111

1212
const hooks = [
1313
"post-checkout",
14+
"pre-commit",
1415
];
1516

1617
hooks.forEach(hook => {

0 commit comments

Comments
 (0)