We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent cf43fa8 commit b81d9c1Copy full SHA for b81d9c1
install.js
@@ -4,8 +4,17 @@ var chalk = require('chalk')
4
5
var options = require('./index.js').getOptions()
6
7
-if (options && options.nohook) {
8
- console.log('commitplease: package.json or .npmrc set to skip hook')
+// Is this a self-install? If so, do not copy hooks and quit early
+var pkgPath = path.join(options.projectPath, 'package.json')
9
+var pkg = fs.existsSync(pkgPath) && require(pkgPath)
10
+
11
+if (pkg && pkg.name && pkg.name === 'commitplease') {
12
+ console.log('commitplease: self-install detected, skipping hooks')
13
+ process.exit(0)
14
+}
15
16
+if (options.nohook) {
17
+ console.log('commitplease: package.json or .npmrc set to skip hooks')
18
process.exit(0)
19
}
20
0 commit comments