Skip to content

Commit

Permalink
Fix husky crashing with old versions of Node (0.12)
Browse files Browse the repository at this point in the history
  • Loading branch information
typicode committed Jun 11, 2019
1 parent 8b9989f commit f336261
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
11 changes: 4 additions & 7 deletions husky.js
Original file line number Diff line number Diff line change
@@ -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')

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down

0 comments on commit f336261

Please sign in to comment.