diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100755 index 00000000..6bacdb2e --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1,4 @@ +#!/bin/sh +. "$(dirname "$0")/_/husky.sh" + +# empty for now diff --git a/.husky/pre-push b/.husky/pre-push new file mode 100755 index 00000000..299c6894 --- /dev/null +++ b/.husky/pre-push @@ -0,0 +1,12 @@ +#!/bin/sh +. "$(dirname "$0")/_/husky.sh" + +# Check if there are any outstanding changes +# NOTE: This is necessary as husky will run checks on pushing, +# while there might be changes that are not yet committed interfering +# with the tests and linter +npx husky-init && npm install + +npm run lint +npm run make +npm test diff --git a/package-lock.json b/package-lock.json index 828f9995..af138a69 100644 --- a/package-lock.json +++ b/package-lock.json @@ -89,6 +89,7 @@ "eslint-import-resolver-typescript": "2.5.0", "eslint-plugin-import": "2.25.3", "eslint-plugin-react": "7.27.1", + "husky": "7.0.4", "mini-css-extract-plugin": "2.4.5", "node-loader": "2.0.0", "playwright": "1.17.1", @@ -8998,6 +8999,21 @@ "ms": "^2.0.0" } }, + "node_modules/husky": { + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/husky/-/husky-7.0.4.tgz", + "integrity": "sha512-vbaCKN2QLtP/vD4yvs6iz6hBEo6wkSzs8HpRah1Z6aGmF2KW5PdYuAd7uX5a+OyBZHBhd+TFLqgjUgytQr4RvQ==", + "dev": true, + "bin": { + "husky": "lib/bin.js" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/typicode" + } + }, "node_modules/iconv-lite": { "version": "0.6.3", "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz", @@ -23776,6 +23792,12 @@ "ms": "^2.0.0" } }, + "husky": { + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/husky/-/husky-7.0.4.tgz", + "integrity": "sha512-vbaCKN2QLtP/vD4yvs6iz6hBEo6wkSzs8HpRah1Z6aGmF2KW5PdYuAd7uX5a+OyBZHBhd+TFLqgjUgytQr4RvQ==", + "dev": true + }, "iconv-lite": { "version": "0.6.3", "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz", diff --git a/package.json b/package.json index 54b960c5..4ec3a493 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,8 @@ "test": "playwright test", "prepare:nodegit": "node scripts/prepareNodegit.js", "rebuild:native-modules": "electron-rebuild", - "postinstall": "npm run prepare:nodegit" + "postinstall": "npm run prepare:nodegit", + "prepare": "husky install" }, "keywords": [], "author": { @@ -64,6 +65,7 @@ "eslint-import-resolver-typescript": "2.5.0", "eslint-plugin-import": "2.25.3", "eslint-plugin-react": "7.27.1", + "husky": "7.0.4", "mini-css-extract-plugin": "2.4.5", "node-loader": "2.0.0", "playwright": "1.17.1",