Skip to content

Commit

Permalink
fix(postinstall): use node, more conditionals (#520)
Browse files Browse the repository at this point in the history
* fix(postinstall): use node, more conditionals

Closes #516

* chore: move fs-extra to devDependencies
  • Loading branch information
marcysutton authored and Marcy Sutton committed Sep 12, 2017
1 parent 35b598a commit f5b5299
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 9 deletions.
8 changes: 0 additions & 8 deletions bin/postinstall.sh

This file was deleted.

15 changes: 15 additions & 0 deletions build/utils/postinstall.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
var fs = require('fs')

if (fs.existsSync(".git/hooks")) {
let commitMsg = '.git/hooks/commit-msg'
if (!fs.existsSync(commitMsg)) {
let angularPrecommit = "./node_modules/angular-precommit/index.js"
if (fs.existsSync(angularPrecommit)) {
var fsExtra = require('fs-extra')
fsExtra.copy(angularPrecommit, commitMsg, (err) => {
if (err) throw err
console.log("Installing git pre-commit hook")
})
}
}
}
3 changes: 2 additions & 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": "./bin/postinstall.sh",
"postinstall": "node build/utils/postinstall.js",
"release": "standard-version"
},
"devDependencies": {
Expand All @@ -65,6 +65,7 @@
"chai": "~3.5.0",
"clone": "~1.0.2",
"dot": "~1.0.3",
"fs-extra": "^4.0.1",
"grunt": "^1.0.1",
"grunt-babel": "^6.0.0",
"grunt-contrib-clean": "^1.0.0",
Expand Down

0 comments on commit f5b5299

Please sign in to comment.