From 32a77747ab7f8abffc13954201a61d76cd14c6b5 Mon Sep 17 00:00:00 2001 From: DavideViolante Date: Sat, 31 Aug 2024 15:08:07 +0200 Subject: [PATCH] chore(deps): add husky and pre-commit hook to lint and build --- .husky/pre-commit | 2 ++ package-lock.json | 17 +++++++++++++++++ package.json | 4 +++- 3 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 .husky/pre-commit diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100644 index 00000000..5e5b9769 --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1,2 @@ +npm run lint +npm run build \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index ea2250ef..21282491 100644 --- a/package-lock.json +++ b/package-lock.json @@ -47,6 +47,7 @@ "concurrently": "^8.2.2", "eslint": "^9.9.0", "htmlhint": "^1.1.4", + "husky": "^9.1.5", "jasmine-core": "~5.2.0", "jest": "^29.7.0", "karma": "~6.4.0", @@ -11882,6 +11883,22 @@ "node": ">=10.17.0" } }, + "node_modules/husky": { + "version": "9.1.5", + "resolved": "https://registry.npmjs.org/husky/-/husky-9.1.5.tgz", + "integrity": "sha512-rowAVRUBfI0b4+niA4SJMhfQwc107VLkBUgEYYAOQAbqDCnra1nYh83hF/MDmhYs9t9n1E3DuKOrs2LYNC+0Ag==", + "dev": true, + "license": "MIT", + "bin": { + "husky": "bin.js" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/typicode" + } + }, "node_modules/hyperdyperid": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/hyperdyperid/-/hyperdyperid-1.2.0.tgz", diff --git a/package.json b/package.json index 7f17b439..e39ff1cf 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,8 @@ "test:be": "tsc -p server && jest", "test:becov": "tsc -p server && jest --coverage", "lint": "ng lint && htmlhint \"client/**/*.html\" && sass-lint \"client/**/*.scss\" -v", - "lint:fix": "ng lint --fix" + "lint:fix": "ng lint --fix", + "prepare": "husky || true" }, "private": true, "dependencies": { @@ -62,6 +63,7 @@ "concurrently": "^8.2.2", "eslint": "^9.9.0", "htmlhint": "^1.1.4", + "husky": "^9.1.5", "jasmine-core": "~5.2.0", "jest": "^29.7.0", "karma": "~6.4.0",