diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100755 index 0000000..84872c3 --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1,5 @@ +#!/usr/bin/env sh +. "$(dirname -- "$0")/_/husky.sh" + +npm run test +npm run lint diff --git a/package-lock.json b/package-lock.json index 53b2aca..d880551 100644 --- a/package-lock.json +++ b/package-lock.json @@ -19,6 +19,7 @@ "eslint-plugin-import": "^2.29.0", "eslint-plugin-n": "^16.3.1", "eslint-plugin-promise": "^6.1.1", + "husky": "^8.0.0", "jest": "^29.7.0", "ts-jest": "^29.1.1", "ts-node": "^10.9.2", @@ -5387,6 +5388,21 @@ "node": ">=10.17.0" } }, + "node_modules/husky": { + "version": "8.0.3", + "resolved": "https://registry.npmjs.org/husky/-/husky-8.0.3.tgz", + "integrity": "sha512-+dQSyqPh4x1hlO1swXBiNb2HzTDN1I2IGLQx1GrBuiqFJfoMrnZWwVmatvSiO+Iz8fBUnf+lekwNo4c2LlXItg==", + "dev": true, + "bin": { + "husky": "lib/bin.js" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/typicode" + } + }, "node_modules/ignore": { "version": "5.3.0", "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.0.tgz", diff --git a/package.json b/package.json index 928c2c9..155dc39 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,8 @@ "dev": "tsc --watch", "test": "jest", "test:dev": "jest --watch", - "lint": "eslint ." + "lint": "eslint .", + "prepare": "husky install" }, "files": [ "/dist" @@ -32,6 +33,7 @@ "jest": "^29.7.0", "ts-jest": "^29.1.1", "ts-node": "^10.9.2", - "typescript": "^5.3.3" + "typescript": "^5.3.3", + "husky": "^8.0.0" } }