From 62277936f290209267dd0e55332271be6b85c730 Mon Sep 17 00:00:00 2001 From: "Robert (Jamie) Munro" Date: Wed, 2 May 2018 09:39:26 +0100 Subject: [PATCH 1/8] Upgrade dev dependency chai --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index cf1ec90..c723b2c 100644 --- a/package.json +++ b/package.json @@ -48,7 +48,7 @@ "lib" ], "devDependencies": { - "chai": "2.3.0", + "chai": "4.1.2", "istanbul": "0.3.17", "jscs": "1.13.1", "jshint": "2.8.0", From b828e840b9ad4867cfc07a1ebde6d03c82b62021 Mon Sep 17 00:00:00 2001 From: "Robert (Jamie) Munro" Date: Wed, 2 May 2018 09:39:30 +0100 Subject: [PATCH 2/8] Upgrade dev dependency istanbul --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index c723b2c..35eb7dd 100644 --- a/package.json +++ b/package.json @@ -49,7 +49,7 @@ ], "devDependencies": { "chai": "4.1.2", - "istanbul": "0.3.17", + "istanbul": "0.4.5", "jscs": "1.13.1", "jshint": "2.8.0", "mocha": "2.2.5" From e4f07f604c7396e9488ebab1959f22fff2015c60 Mon Sep 17 00:00:00 2001 From: "Robert (Jamie) Munro" Date: Wed, 2 May 2018 09:43:52 +0100 Subject: [PATCH 3/8] Upgrade dev dependency jshint --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 35eb7dd..c1fca14 100644 --- a/package.json +++ b/package.json @@ -51,7 +51,7 @@ "chai": "4.1.2", "istanbul": "0.4.5", "jscs": "1.13.1", - "jshint": "2.8.0", + "jshint": "2.9.5", "mocha": "2.2.5" }, "license": "MIT" From 354470a7e555912b7fc3ca6d109a58e89318484b Mon Sep 17 00:00:00 2001 From: "Robert (Jamie) Munro" Date: Wed, 2 May 2018 09:43:56 +0100 Subject: [PATCH 4/8] Upgrade dev dependency mocha --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index c1fca14..080a2eb 100644 --- a/package.json +++ b/package.json @@ -52,7 +52,7 @@ "istanbul": "0.4.5", "jscs": "1.13.1", "jshint": "2.9.5", - "mocha": "2.2.5" + "mocha": "5.1.1" }, "license": "MIT" } From cf96dbad7c624ae6fcb39152dddfe490662ae44a Mon Sep 17 00:00:00 2001 From: "Robert (Jamie) Munro" Date: Wed, 2 May 2018 08:47:55 +0000 Subject: [PATCH 5/8] Upgrade dev dependency jscs But stick with a 2.x.x branch as upgrading to 3.x.x broke things. --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 080a2eb..dcd37d4 100644 --- a/package.json +++ b/package.json @@ -50,7 +50,7 @@ "devDependencies": { "chai": "4.1.2", "istanbul": "0.4.5", - "jscs": "1.13.1", + "jscs": "2.11.0", "jshint": "2.9.5", "mocha": "5.1.1" }, From f1da69e701bf6f75d7225c5d3ea7cf598a97966d Mon Sep 17 00:00:00 2001 From: "Robert (Jamie) Munro" Date: Wed, 2 May 2018 09:35:04 +0000 Subject: [PATCH 6/8] Only support node 5 and later Based on: https://github.com/nodejs/Release#release-schedule --- .travis.yml | 6 +++--- package.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 315b759..6895ccf 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,10 +1,10 @@ language: node_js node_js: -- "0.10" -- "0.12" -- "4" - "5" - "6" +- "7" +- "8" +- "9" sudo: false after_success: - "npm run coverage" diff --git a/package.json b/package.json index dcd37d4..8d833ba 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,7 @@ "prepare-commit-msg" ], "engines": { - "node": ">=0.8.x" + "node": ">=5" }, "engine-strict": true, "scripts": { From 7864743ca7f531084da50aa2b8fe0713b2c50cc6 Mon Sep 17 00:00:00 2001 From: "Robert (Jamie) Munro" Date: Thu, 3 May 2018 09:58:12 +0000 Subject: [PATCH 7/8] Simplify tests using execSync Now that we are on node 5 or later --- tests/uninstall.test.js | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/tests/uninstall.test.js b/tests/uninstall.test.js index 56fa421..5856ba7 100644 --- a/tests/uninstall.test.js +++ b/tests/uninstall.test.js @@ -1,5 +1,5 @@ require('chai').should(); -var exec = require('child_process').exec; +var execSync = require('child_process').execSync; var gitHooks = require('../lib/git-hooks'); var fsHelpers = require('../lib/fs-helpers'); @@ -9,14 +9,9 @@ var GIT_HOOKS = GIT_ROOT + 'hooks'; var GIT_HOOKS_OLD = GIT_ROOT + 'hooks.old'; describe('--uninstall', function () { - beforeEach(function (done) { + beforeEach(function () { fsHelpers.makeDir(SANDBOX_PATH); - exec('git init', {cwd: SANDBOX_PATH}, function (err) { - if (err) { - throw err; - } - done(); - }); + execSync('git init', {cwd: SANDBOX_PATH}); }); afterEach(function () { From a09af18e60d56243e096e5ddce2f99cdbdadaca2 Mon Sep 17 00:00:00 2001 From: "Robert (Jamie) Munro" Date: Thu, 3 May 2018 10:01:24 +0000 Subject: [PATCH 8/8] Remove polyfill code for old node JS versions --- lib/fs-helpers.js | 20 ++++++++------------ lib/git-hooks.js | 8 +------- 2 files changed, 9 insertions(+), 19 deletions(-) diff --git a/lib/fs-helpers.js b/lib/fs-helpers.js index 1a8fb90..abd9547 100644 --- a/lib/fs-helpers.js +++ b/lib/fs-helpers.js @@ -42,18 +42,14 @@ var helpers = { * * @param {String} path */ - exists: typeof fs.access === 'function' ? - function (path) { - try { - fs.accessSync(path); - return true; - } catch (err) { - return false; - } - } : - function (path) { - return fs.existsSync(path); - }, + exists: function (path) { + try { + fs.accessSync(path); + return true; + } catch (err) { + return false; + } + }, /** * @param {String} path diff --git a/lib/git-hooks.js b/lib/git-hooks.js index 37c55f1..1f98e63 100644 --- a/lib/git-hooks.js +++ b/lib/git-hooks.js @@ -62,13 +62,7 @@ module.exports = { fsHelpers.makeDir(hooksPath); HOOKS.forEach(function (hookName) { var hookPath = path.resolve(hooksPath, hookName); - try { - fs.writeFileSync(hookPath, hook, {mode: '0777'}); - } catch (e) { - // node 0.8 fallback - fs.writeFileSync(hookPath, hook, 'utf8'); - fs.chmodSync(hookPath, '0777'); - } + fs.writeFileSync(hookPath, hook, {mode: '0777'}); }); },