Skip to content

Commit

Permalink
Remove husky.
Browse files Browse the repository at this point in the history
  • Loading branch information
raineorshine committed Dec 18, 2023
1 parent 7b72f2e commit 6e7260e
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 28 deletions.
6 changes: 2 additions & 4 deletions .husky/post-commit → .hooks/post-commit
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

#!/bin/bash
SHORT_SHA=$(git rev-parse HEAD)
LINT_LOG="$TMPDIR"/lint."$SHORT_SHA".log

Expand Down Expand Up @@ -42,4 +40,4 @@ fi
# first error shown.
# We pipe output so that the terminal (tmux, vim, emacs etc.) isn't borked by
# stray output.
npm run lint:src | strip &> "$LINT_LOG" || notify "Lint Error" &
npm run lint:src | strip &>"$LINT_LOG" || notify "Lint Error" &
9 changes: 9 additions & 0 deletions .hooks/pre-push
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash
fail=0

npm run lint || fail=1
npm run prettier -- --check || fail=1

if [ "$fail" -ne 0 ]; then
exit 1
fi
1 change: 0 additions & 1 deletion .husky/.gitignore

This file was deleted.

5 changes: 0 additions & 5 deletions .husky/pre-push

This file was deleted.

16 changes: 0 additions & 16 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"lint:lockfile": "lockfile-lint",
"lint:markdown": "markdownlint \"**/*.md\" --ignore node_modules --ignore build --config .markdownlint.js",
"lint:src": "eslint --cache --cache-location node_modules/.cache/.eslintcache --ignore-path .gitignore --report-unused-disable-directives .",
"prepare": "husky install && bash test/bun-setup.sh",
"prepare": "./src/scripts/install-hooks && bash test/bun-setup.sh",
"prepublishOnly": "npm run build",
"prettier": "prettier .",
"test": "mocha test test/package-managers/*",
Expand Down Expand Up @@ -131,7 +131,6 @@
"eslint-plugin-jsdoc": "^41.1.2",
"eslint-plugin-n": "^15.7.0",
"eslint-plugin-promise": "^6.1.1",
"husky": "^8.0.3",
"lockfile-lint": "^4.10.6",
"markdownlint-cli": "0.34.0",
"mocha": "^10.2.0",
Expand Down
8 changes: 8 additions & 0 deletions src/scripts/install-hooks
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash

# Use a simple bash script to install git hooks.
# husky was slow and did not play nice with nvm.
# lefthook suppressed the post-commit notification for some reason.

# change the git hook directory from .git/hooks to .hooks
git config core.hooksPath .hooks

0 comments on commit 6e7260e

Please sign in to comment.