From f336261363a0092f721c62a3cc86280fd221f85b Mon Sep 17 00:00:00 2001 From: typicode Date: Wed, 12 Jun 2019 00:18:32 +0200 Subject: [PATCH] Fix husky crashing with old versions of Node (0.12) --- CHANGELOG.md | 4 ++++ husky.js | 11 ++++------- package.json | 2 +- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f394cf3eb..41e9e7164 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # CHANGELOG +## 2.4.1 + +* Fix husky crash on install/uninstall with very old Node versions + ## 2.4.0 * Add `HUSKY_SKIP_HOOKS` to skip all hooks diff --git a/husky.js b/husky.js index 386e992bd..41193f2ae 100644 --- a/husky.js +++ b/husky.js @@ -1,18 +1,15 @@ -/* eslint-disable @typescript-eslint/no-var-requires */ +/* eslint-disable */ const pleaseUpgradeNode = require('please-upgrade-node') const pkg = require('./package.json') // Node version isn't supported, skip install pleaseUpgradeNode(pkg, { exitCode: 0, - message(requiredVersion) { - return ( - 'Husky requires Node ' + - requiredVersion + - ', skipping Git hooks installation.' - ) + message: function(requiredVersion) { + return 'Husky requires Node ' + requiredVersion + ', skipping Git hooks installation.' } }) // Node version is supported, continue require('./lib/installer/bin') + diff --git a/package.json b/package.json index 97ecb62a6..125b79911 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,7 @@ "postversion": "git push && git push --tags", "prepublishOnly": "npm run test && npm run build && pinst --enable && pkg-ok", "postpublish": "pinst --disable", - "lint": "eslint . --ext .js,.jsx,.ts,.tsx --ignore-path .gitignore", + "lint": "eslint . --ext .js,.ts --ignore-path .gitignore", "fix": "npm run lint -- --fix" }, "repository": {