Skip to content

Commit

Permalink
fix(husky): shebang and dirname in hook shell scripts (#1256)
Browse files Browse the repository at this point in the history
  • Loading branch information
ybiquitous authored May 10, 2022
1 parent 7719870 commit ee70357
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 12 deletions.
4 changes: 2 additions & 2 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npx --no-install commitlint --edit "$1"
4 changes: 2 additions & 2 deletions .husky/post-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npm run release:dry-run
4 changes: 2 additions & 2 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npx --no-install lint-staged
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@
"deps-dev",
"editorconfig",
"eslint",
"husky",
"init",
"lint-staged",
"package",
Expand Down
12 changes: 6 additions & 6 deletions test/__snapshots__/init.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -256,24 +256,24 @@ jobs:
`;

exports[`write ".husky/commit-msg" 1`] = `
"#!/bin/sh
. \\"$(dirname \\"$0\\")/_/husky.sh\\"
"#!/usr/bin/env sh
. \\"$(dirname -- \\"$0\\")/_/husky.sh\\"
npx --no-install commitlint --edit \\"$1\\"
"
`;

exports[`write ".husky/post-commit" 1`] = `
"#!/bin/sh
. \\"$(dirname \\"$0\\")/_/husky.sh\\"
"#!/usr/bin/env sh
. \\"$(dirname -- \\"$0\\")/_/husky.sh\\"
npm run release:dry-run
"
`;

exports[`write ".husky/pre-commit" 1`] = `
"#!/bin/sh
. \\"$(dirname \\"$0\\")/_/husky.sh\\"
"#!/usr/bin/env sh
. \\"$(dirname -- \\"$0\\")/_/husky.sh\\"
npx --no-install lint-staged
"
Expand Down

0 comments on commit ee70357

Please sign in to comment.