From da44097872563a430aa5fdd75a0a4ccae9aa944a Mon Sep 17 00:00:00 2001 From: mkholjur Date: Sun, 25 Dec 2022 18:49:41 +0100 Subject: [PATCH 1/2] Keep calm and commit --- .husky/pre-commit | 4 ++++ 1 file changed, 4 insertions(+) create mode 100755 .husky/pre-commit diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100755 index 000000000..610c2a54f --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1,4 @@ +#!/usr/bin/env sh +. "$(dirname -- "$0")/_/husky.sh" + +npm test From 20380f2b18090bb6879790e5af169e154b603496 Mon Sep 17 00:00:00 2001 From: mkholjur Date: Tue, 3 Jan 2023 21:05:52 +0100 Subject: [PATCH 2/2] chore: introduce husky to run test before each commit --- .husky/pre-commit | 2 +- package-lock.json | 22 ++++++++++++++++++++++ package.json | 4 +++- 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/.husky/pre-commit b/.husky/pre-commit index 610c2a54f..910e8ef14 100755 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1,4 +1,4 @@ #!/usr/bin/env sh . "$(dirname -- "$0")/_/husky.sh" -npm test +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": {