From 08a7d469fbb595eae05a02d48225002177b62973 Mon Sep 17 00:00:00 2001 From: Pascal Jufer Date: Tue, 3 Jan 2023 19:03:10 +0100 Subject: [PATCH] Switch from 'simple-git-hooks' to 'husky' To be able to get rid of the workaround introduced in dbad2246bd5d9e14645cef651a3e0fc3cf878587 --- .husky/pre-commit | 4 ++++ .npmrc | 1 - package.json | 10 ++++------ pnpm-lock.yaml | 16 ++++++++-------- 4 files changed, 16 insertions(+), 15 deletions(-) create mode 100755 .husky/pre-commit delete mode 100644 .npmrc diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100755 index 00000000..58b1861c --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1,4 @@ +#!/usr/bin/env sh +. "$(dirname -- "$0")/_/husky.sh" + +pnpm exec lint-staged diff --git a/.npmrc b/.npmrc deleted file mode 100644 index bc63bba6..00000000 --- a/.npmrc +++ /dev/null @@ -1 +0,0 @@ -side-effects-cache=false diff --git a/package.json b/package.json index c89a872b..8c7d2e30 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,8 @@ "lint:fix": "pnpm run lint --fix", "prepublishOnly": "safe-publish-latest --force-in-publish && pnpm run build", "report-coverage": "cat coverage/lcov.info | coveralls", - "test": "jest" + "test": "jest", + "prepare": "husky install" }, "repository": { "type": "git", @@ -80,12 +81,12 @@ "eslint-plugin-jest": "^27.0.4", "eslint-plugin-prettier": "^4.0.0", "eslint-plugin-simple-import-sort": "^8.0.0", + "husky": "^8.0.3", "jest": "^29.3.1", "jest-create-mock-instance": "^2.0.0", "lint-staged": "^13.0.4", "prettier": "^2.6.2", "safe-publish-latest": "^2.0.0", - "simple-git-hooks": "^2.7.0", "string-argv": "^0.3.1", "typescript": "~4.9.3" }, @@ -97,11 +98,8 @@ "!**/*.spec.js", "!**/*.spec.d.ts" ], - "simple-git-hooks": { - "pre-commit": "pnpm exec lint-staged" - }, "lint-staged": { - "*.m?{js,ts}": "eslint --fix", + "*.?(m){js,ts}": "eslint --fix", "*.{json,y?(a)ml,md}": "prettier --write" } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 59e912ff..cdecd4b9 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -23,6 +23,7 @@ specifiers: eslint-plugin-jest: ^27.0.4 eslint-plugin-prettier: ^4.0.0 eslint-plugin-simple-import-sort: ^8.0.0 + husky: ^8.0.3 jest: ^29.3.1 jest-create-mock-instance: ^2.0.0 lint-staged: ^13.0.4 @@ -31,7 +32,6 @@ specifiers: rxjs: ^7.0.0 safe-publish-latest: ^2.0.0 shell-quote: ^1.7.3 - simple-git-hooks: ^2.7.0 spawn-command: ^0.0.2-1 string-argv: ^0.3.1 supports-color: ^8.1.0 @@ -71,12 +71,12 @@ devDependencies: eslint-plugin-jest: 27.1.6_lsjj2z7a4kjjp7e3mfcearu7cq eslint-plugin-prettier: 4.2.1_cwlo2dingkvfydnaculr42urve eslint-plugin-simple-import-sort: 8.0.0_eslint@8.28.0 + husky: 8.0.3 jest: 29.3.1_cvzxrhsdh5neg66abxdhqik6tu jest-create-mock-instance: 2.0.0 lint-staged: 13.0.4_supports-color@8.1.1 prettier: 2.8.0 safe-publish-latest: 2.0.0 - simple-git-hooks: 2.8.1 string-argv: 0.3.1 typescript: 4.9.3 @@ -2598,6 +2598,12 @@ packages: engines: {node: '>=12.20.0'} dev: true + /husky/8.0.3: + resolution: {integrity: sha512-+dQSyqPh4x1hlO1swXBiNb2HzTDN1I2IGLQx1GrBuiqFJfoMrnZWwVmatvSiO+Iz8fBUnf+lekwNo4c2LlXItg==} + engines: {node: '>=14'} + hasBin: true + dev: true + /ignore/5.2.1: resolution: {integrity: sha512-d2qQLzTJ9WxQftPAuEQpSPmKqzxePjzVbpAVv62AQ64NTL+wR4JkrVqR/LqFsFEUsHDAiId52mJteHDFuDkElA==} engines: {node: '>= 4'} @@ -3961,12 +3967,6 @@ packages: resolution: {integrity: sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==} dev: true - /simple-git-hooks/2.8.1: - resolution: {integrity: sha512-DYpcVR1AGtSfFUNzlBdHrQGPsOhuuEJ/FkmPOOlFysP60AHd3nsEpkGq/QEOdtUyT1Qhk7w9oLmFoMG+75BDog==} - hasBin: true - requiresBuild: true - dev: true - /sisteransi/1.0.5: resolution: {integrity: sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg==} dev: true