Skip to content

Commit 1107783

Browse files
Marcy Suttonmarcysutton
authored andcommitted
fix: only run postinstall if .git exists
1 parent 16f2f76 commit 1107783

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

bin/postinstall.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/sh
2+
3+
if [ -d ".git" ]; then
4+
if [ ! -f ".git/hooks/commit-msg" ]; then
5+
echo "Installing pre-commit hook"
6+
cd .git/hooks/ && cp ../../node_modules/angular-precommit/index.js commit-msg && cd ../../
7+
fi
8+
fi

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
"test-fast": "grunt test-fast",
5353
"version": "node build/sri-update",
5454
"prepublishOnly": "grunt build && node build/sri-update --validate",
55-
"postinstall": "cd .git/hooks/ && cp ../../node_modules/angular-precommit/index.js commit-msg && cd ../../"
55+
"postinstall": "./bin/postinstall.sh"
5656
},
5757
"devDependencies": {
5858
"angular-precommit": "^1.0.3",

0 commit comments

Comments
 (0)