From 1107783124c5d7c2195e2fedb005558208e8db18 Mon Sep 17 00:00:00 2001 From: Marcy Sutton Date: Tue, 15 Aug 2017 13:14:04 -0700 Subject: [PATCH] fix: only run postinstall if .git exists --- bin/postinstall.sh | 8 ++++++++ package.json | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100755 bin/postinstall.sh diff --git a/bin/postinstall.sh b/bin/postinstall.sh new file mode 100755 index 0000000000..d6a0fb45b0 --- /dev/null +++ b/bin/postinstall.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +if [ -d ".git" ]; then + if [ ! -f ".git/hooks/commit-msg" ]; then + echo "Installing pre-commit hook" + cd .git/hooks/ && cp ../../node_modules/angular-precommit/index.js commit-msg && cd ../../ + fi +fi \ No newline at end of file diff --git a/package.json b/package.json index 66b84a9f1a..68bd753d8b 100644 --- a/package.json +++ b/package.json @@ -52,7 +52,7 @@ "test-fast": "grunt test-fast", "version": "node build/sri-update", "prepublishOnly": "grunt build && node build/sri-update --validate", - "postinstall": "cd .git/hooks/ && cp ../../node_modules/angular-precommit/index.js commit-msg && cd ../../" + "postinstall": "./bin/postinstall.sh" }, "devDependencies": { "angular-precommit": "^1.0.3",