diff --git a/.husky/commit-msg b/.husky/commit-msg new file mode 100755 index 00000000..e8511eae --- /dev/null +++ b/.husky/commit-msg @@ -0,0 +1,4 @@ +#!/bin/sh +. "$(dirname "$0")/_/husky.sh" + +npx --no-install commitlint --edit $1 diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100755 index 00000000..d0612ad3 --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1,4 @@ +#!/bin/sh +. "$(dirname "$0")/_/husky.sh" + +npm run pre-commit diff --git a/package.json b/package.json index 353d38a5..0b3b945d 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,9 @@ "contrib:add": "all-contributors add", "contrib:generate": "all-contributors generate", "lint-staged": "lint-staged", - "docs": "lerna run docs" + "docs": "lerna run docs", + "prepare": "husky install", + "pre-commit": "run-s lint-staged test" }, "devDependencies": { "@commitlint/cli": "^8.1.0", @@ -24,7 +26,7 @@ "commitizen": "^3.1.1", "conventional-changelog-cli": "^2.1.0", "cz-conventional-changelog": "^2.1.0", - "husky": "^3.0.0", + "husky": "^7.0.0", "jest": "^26.2.2", "jest-express": "^1.10.1", "lerna": "^3.22.1", @@ -35,12 +37,6 @@ "ts-jest": "^26.0.0", "typescript": "^3.9.7" }, - "husky": { - "hooks": { - "pre-commit": "run-s lint-staged test", - "commit-msg": "commitlint -E HUSKY_GIT_PARAMS" - } - }, "lint-staged": { "*.{js,jsx,ts,tsx}": [ "prettier --write",