From 150f59a313590ffa6139d3ff9b2a4ede2debc2de Mon Sep 17 00:00:00 2001 From: JapSeyz Date: Wed, 9 Aug 2017 02:18:35 +0300 Subject: [PATCH] Fix issue where changing branches to one without node_modules would prevent you from committing. Simply added a statement checking whether or not the node_modules folder exists before trying to access it. --- install.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/install.js b/install.js index e24fc0d..feb6f9c 100644 --- a/install.js +++ b/install.js @@ -102,9 +102,11 @@ if(os.platform() === 'win32') { } var precommitContent = '#!/usr/bin/env bash' + os.EOL + + 'if [ -d "./node_modules" ]; then' + os.EOL + hookRelativeUnixPath + os.EOL + 'RESULT=$?' + os.EOL + '[ $RESULT -ne 0 ] && exit 1' + os.EOL + + 'fi' + os.EOL + 'exit 0' + os.EOL; //