diff --git a/scripts/hooks/post-checkout b/scripts/hooks/post-checkout index 0e6180067de..918df5b413b 100755 --- a/scripts/hooks/post-checkout +++ b/scripts/hooks/post-checkout @@ -1,2 +1,2 @@ #!/bin/sh -npm run npx hereby -- generate-diagnostics +./node_modules/.bin/hereby generate-diagnostics || true diff --git a/scripts/hooks/pre-commit b/scripts/hooks/pre-commit new file mode 100755 index 00000000000..976ca534eb7 --- /dev/null +++ b/scripts/hooks/pre-commit @@ -0,0 +1,4 @@ +#!/bin/sh +if git diff --name-only --cached --relative | xargs --no-run-if-empty ./node_modules/.bin/dprint fmt; then + git diff --name-only --cached --relative | xargs --no-run-if-empty git add +fi diff --git a/scripts/link-hooks.mjs b/scripts/link-hooks.mjs index 6d5594b4906..61c39d242a3 100644 --- a/scripts/link-hooks.mjs +++ b/scripts/link-hooks.mjs @@ -11,6 +11,7 @@ const __dirname = path.dirname(__filename); const hooks = [ "post-checkout", + "pre-commit", ]; hooks.forEach(hook => {