Skip to content

Commit c877816

Browse files
authored
chore: added husky integration (#1090)
1 parent 9b686a3 commit c877816

File tree

3 files changed

+31
-1
lines changed

3 files changed

+31
-1
lines changed

.husky/pre-commit

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/usr/bin/env sh
2+
. "$(dirname -- "$0")/_/husky.sh"
3+
4+
branch="$(git rev-parse --abbrev-ref HEAD)"
5+
6+
if [ "$branch" = "master" ]; then
7+
echo "You can't commit directly to master branch"
8+
exit 1
9+
fi
10+
11+
npm run format
12+
npm run lint

package-lock.json

Lines changed: 17 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"scripts": {
2222
"prebuild": "rimraf lib",
2323
"build": "tsc",
24-
"prepare": "tsc",
24+
"prepare": "tsc && husky",
2525
"dev:yalc": "nodemon --watch src --ext ts --exec 'npm run build && yalc push'",
2626
"format": "prettier --write \"src/**/*.ts\"",
2727
"format:ci": "prettier --list-different \"src/**/*.ts\"",
@@ -46,6 +46,7 @@
4646
"eslint-config-prettier": "^9.1.0",
4747
"eslint-plugin-prettier": "^5.2.3",
4848
"fastify": "^5.2.1",
49+
"husky": "^9.1.7",
4950
"jest": "^29.7.0",
5051
"mysql2": "^3.14.0",
5152
"pg": "^8.14.0",

0 commit comments

Comments
 (0)