From 296ba28ce9bb1924d264e9fac1224b98be5b33ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20P=C3=A4rsson?= Date: Thu, 1 Aug 2024 11:02:01 +0200 Subject: [PATCH] Use husky for pre-commit checks --- .husky/pre-commit | 3 +++ package-lock.json | 22 ++++++++++++++++++++++ package.json | 4 +++- 3 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 .husky/pre-commit diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100644 index 0000000..7ae9b92 --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1,3 @@ +npm run check +npm run build +npm run test diff --git a/package-lock.json b/package-lock.json index d26750a..904f0a6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -21,6 +21,7 @@ "@types/lodash": "^4.17.0", "@types/node": "^20.12.7", "@types/rimraf": "^4.0.5", + "husky": "^9.1.4", "jest": "^29.7.0", "prettier": "^3.0.3", "release-it": "^16.2.1", @@ -4642,6 +4643,21 @@ "node": ">=14.18.0" } }, + "node_modules/husky": { + "version": "9.1.4", + "resolved": "https://registry.npmjs.org/husky/-/husky-9.1.4.tgz", + "integrity": "sha512-bho94YyReb4JV7LYWRWxZ/xr6TtOTt8cMfmQ39MQYJ7f/YE268s3GdghGwi+y4zAeqewE5zYLvuhV0M0ijsDEA==", + "dev": true, + "bin": { + "husky": "bin.js" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/typicode" + } + }, "node_modules/ieee754": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", @@ -13871,6 +13887,12 @@ "integrity": "sha512-nZXjEF2nbo7lIw3mgYjItAfgQXog3OjJogSbKa2CQIIvSGWcKgeJnQlNXip6NglNzYH45nSRiEVimMvYL8DDqQ==", "dev": true }, + "husky": { + "version": "9.1.4", + "resolved": "https://registry.npmjs.org/husky/-/husky-9.1.4.tgz", + "integrity": "sha512-bho94YyReb4JV7LYWRWxZ/xr6TtOTt8cMfmQ39MQYJ7f/YE268s3GdghGwi+y4zAeqewE5zYLvuhV0M0ijsDEA==", + "dev": true + }, "ieee754": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", diff --git a/package.json b/package.json index 0d6fa37..60fc764 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,8 @@ "test": "jest", "release": "release-it", "build": "rollup --configPlugin @rollup/plugin-typescript -c rollup.config.ts", - "lint": "tslint -c tslint.json src/**/*.ts" + "lint": "tslint -c tslint.json src/**/*.ts", + "prepare": "husky" }, "repository": { "type": "git", @@ -43,6 +44,7 @@ "@types/lodash": "^4.17.0", "@types/node": "^20.12.7", "@types/rimraf": "^4.0.5", + "husky": "^9.1.4", "jest": "^29.7.0", "prettier": "^3.0.3", "release-it": "^16.2.1",