Skip to content

Commit

Permalink
fix: only run postinstall if .git exists
Browse files Browse the repository at this point in the history
  • Loading branch information
Marcy Sutton authored and marcysutton committed Aug 18, 2017
1 parent 16f2f76 commit 1107783
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions bin/postinstall.sh
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 1107783

Please sign in to comment.