diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100755 index 000000000..910e8ef14 --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1,4 @@ +#!/usr/bin/env sh +. "$(dirname -- "$0")/_/husky.sh" + +npm run test && npm run test:ct && npm run lint diff --git a/package-lock.json b/package-lock.json index eaba1c14c..5291f9f3d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -78,6 +78,7 @@ "eslint-plugin-cypress": "^2.12.1", "eslint-plugin-react": "^7.22.0", "glob": "^7.1.6", + "husky": "^8.0.2", "identity-obj-proxy": "^3.0.0", "jest": "^26.6.3", "node-sass": "^7.0.1", @@ -13224,6 +13225,21 @@ "ms": "^2.0.0" } }, + "node_modules/husky": { + "version": "8.0.2", + "resolved": "https://registry.npmjs.org/husky/-/husky-8.0.2.tgz", + "integrity": "sha512-Tkv80jtvbnkK3mYWxPZePGFpQ/tT3HNSs/sasF9P2YfkMezDl3ON37YN6jUUI4eTg5LcyVynlb6r4eyvOmspvg==", + "dev": true, + "bin": { + "husky": "lib/bin.js" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/typicode" + } + }, "node_modules/iconv-lite": { "version": "0.4.24", "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", @@ -39919,6 +39935,12 @@ "ms": "^2.0.0" } }, + "husky": { + "version": "8.0.2", + "resolved": "https://registry.npmjs.org/husky/-/husky-8.0.2.tgz", + "integrity": "sha512-Tkv80jtvbnkK3mYWxPZePGFpQ/tT3HNSs/sasF9P2YfkMezDl3ON37YN6jUUI4eTg5LcyVynlb6r4eyvOmspvg==", + "dev": true + }, "iconv-lite": { "version": "0.4.24", "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", diff --git a/package.json b/package.json index ecc261edf..31bffaf4e 100644 --- a/package.json +++ b/package.json @@ -95,6 +95,7 @@ "eslint-plugin-cypress": "^2.12.1", "eslint-plugin-react": "^7.22.0", "glob": "^7.1.6", + "husky": "^8.0.2", "identity-obj-proxy": "^3.0.0", "jest": "^26.6.3", "node-sass": "^7.0.1", @@ -149,7 +150,8 @@ "translations:compile": "npx formatjs compile ./build/messages/src/Messages.json --out-file ./locales/en.json", "test:ct": "BABEL_ENV=componentTest cypress run --component", "test:openct": "cypress open --component", - "coverage": "bash coverage.sh" + "coverage": "bash coverage.sh", + "prepare": "husky install" }, "release": { "analyzeCommits": {