diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100755 index 00000000..f15e97a1 --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1,4 @@ +#!/usr/bin/env sh +. "$(dirname -- "$0")/_/husky.sh" + +npm run fmt diff --git a/package-lock.json b/package-lock.json index 395632f8..3aca23c0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -27,6 +27,7 @@ "@semantic-release/git": "^10.0.1", "@types/inquirer": "^9.0.7", "@types/node": "^20.0.0", + "husky": "^8.0.0", "prettier": "^3.1.0", "semantic-release": "^22.0.8", "ts-node": "^10.8.0", @@ -3586,6 +3587,21 @@ "node": ">=16.17.0" } }, + "node_modules/husky": { + "version": "8.0.3", + "resolved": "https://registry.npmjs.org/husky/-/husky-8.0.3.tgz", + "integrity": "sha512-+dQSyqPh4x1hlO1swXBiNb2HzTDN1I2IGLQx1GrBuiqFJfoMrnZWwVmatvSiO+Iz8fBUnf+lekwNo4c2LlXItg==", + "dev": true, + "bin": { + "husky": "lib/bin.js" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/typicode" + } + }, "node_modules/iconv-lite": { "version": "0.6.3", "license": "MIT", diff --git a/package.json b/package.json index a1720b71..8c8947f7 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,8 @@ "prettier": "^3.1.0", "semantic-release": "^22.0.8", "ts-node": "^10.8.0", - "typescript": "^5.0.0" + "typescript": "^5.0.0", + "husky": "^8.0.0" }, "scripts": { "semantic-release": "semantic-release", @@ -36,7 +37,8 @@ "test": "echo \"No test specified, please create tests.\" && exit 0", "build": "tsc", "fmt": "prettier --write .", - "prettier:check": "prettier --check ." + "prettier:check": "prettier --check .", + "prepare": "husky install" }, "author": "It's not you it's me", "license": "ISC"