From b3c5da595baed76f60b8f9eeb9b530fed36cc02f Mon Sep 17 00:00:00 2001 From: DoubleU23 <5007050+DoubleU23@users.noreply.github.com> Date: Mon, 27 Sep 2021 12:13:50 +0200 Subject: [PATCH] fix(husky): migrate to latest version (#6) * deps: update `husky` to latest version (v7) * config(npm): add `husky install` to prepare lifecycle * config(lint-staged): remove `git add` * config: add `yml` to prettiers `lint-staged` hook * config(husky): add pre-commit hook for `lint-staged` * config(husky): add pre-push hook for `npm test` --- .husky/pre-commit | 4 ++++ .husky/pre-push | 4 ++++ package-lock.json | 6 +++--- package.json | 16 ++++++++-------- 4 files changed, 19 insertions(+), 11 deletions(-) create mode 100644 .husky/pre-commit create mode 100644 .husky/pre-push diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100644 index 0000000..36af219 --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1,4 @@ +#!/bin/sh +. "$(dirname "$0")/_/husky.sh" + +npx lint-staged diff --git a/.husky/pre-push b/.husky/pre-push new file mode 100644 index 0000000..449fcde --- /dev/null +++ b/.husky/pre-push @@ -0,0 +1,4 @@ +#!/bin/sh +. "$(dirname "$0")/_/husky.sh" + +npm test diff --git a/package-lock.json b/package-lock.json index 1e8ff7d..d2a2b98 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7465,9 +7465,9 @@ "dev": true }, "husky": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/husky/-/husky-6.0.0.tgz", - "integrity": "sha512-SQS2gDTB7tBN486QSoKPKQItZw97BMOd+Kdb6ghfpBc0yXyzrddI0oDV5MkDAbuB4X2mO3/nj60TRMcYxwzZeQ==", + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/husky/-/husky-7.0.2.tgz", + "integrity": "sha512-8yKEWNX4z2YsofXAMT7KvA1g8p+GxtB1ffV8XtpAEGuXNAbCV5wdNKH+qTpw8SM9fh4aMPDR+yQuKfgnreyZlg==", "dev": true }, "iconv-lite": { diff --git a/package.json b/package.json index 56cd2ce..c9196e2 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,8 @@ "lint": "eslint --fix --ext \".js,.jsx,.ts,.tsx\" . --quiet --format pretty && prettier **/*.{css,scss,md,json} --write", "clean": "rimraf build", "build": "npm run clean && webpack -p --mode production --env production", - "start": "webpack-dev-server --open --mode development --env development_core" + "start": "webpack-dev-server --open --mode development --env development_core", + "prepare": "husky install" }, "repository": { "type": "git", @@ -22,17 +23,16 @@ "homepage": "https://github.com/stackr23/react-stack#readme", "husky": { "hooks": { - "pre-commit": "lint-staged" + "pre-commit": "lint-staged", + "pre-push": "npm test" } }, "lint-staged": { - "*.{css,scss,json,md}": [ - "prettier --write", - "git add" + "*.{css,scss,json,md,yml}": [ + "prettier --write" ], "*.{js,jsx,ts,tsx}": [ - "eslint --fix --quiet", - "git add" + "eslint --fix --quiet" ] }, "devDependencies": { @@ -46,7 +46,7 @@ "@stackr23/config-eslint": "^2.0.4", "@stackr23/webpack": "^2.1.1", "eslint": "^7.27.0", - "husky": "^6.0.0", + "husky": "^7.0.2", "karma": "^6.3.4", "lint-staged": "^11.0.0", "rimraf": "^3.0.2",