node-git-hooks
Advanced tools
Comparing version 1.0.6 to 1.0.7
@@ -10,5 +10,11 @@ const fs = require("fs"); | ||
let repoPath = "./"; | ||
let gitHooksPath = "./.githooks"; | ||
if (package["node-git-hooks"] && package["node-git-hooks"]["repo-path"]) { | ||
repoPath = package["node-git-hooks"]["repo-path"]; | ||
if (package["node-git-hooks"]) { | ||
if (package["node-git-hooks"]["repo-path"]) { | ||
repoPath = package["node-git-hooks"]["repo-path"]; | ||
} | ||
if (package["node-git-hooks"]["githooks-path"]) { | ||
gitHooksPath = package["node-git-hooks"]["githooks-path"]; | ||
} | ||
} | ||
@@ -21,3 +27,3 @@ | ||
if (!fs.existsSync("./.githooks")) { | ||
if (!fs.existsSync(gitHooksPath)) { | ||
console.log("No .githooks folder found. Skipping hooks installation."); | ||
@@ -29,3 +35,3 @@ return 0; | ||
try { | ||
copyDir("./.githooks", `${repoPath}.git/hooks`); | ||
copyDir(gitHooksPath, `${repoPath}.git/hooks`); | ||
} catch (error) { | ||
@@ -32,0 +38,0 @@ console.error("Error copying Git hooks: ", error); |
{ | ||
"name": "node-git-hooks", | ||
"version": "1.0.6", | ||
"version": "1.0.7", | ||
"description": "Automate git hook deployment", | ||
@@ -5,0 +5,0 @@ "main": "install-git-hook.js", |
@@ -36,6 +36,6 @@ # Cross-Platform Installation of Git Hooks | ||
Add the following `postinstall` script to package.json: | ||
Add the following `prepare` script to package.json: | ||
``` | ||
"scripts": { | ||
"postinstall": "node-git-hooks" | ||
"prepare": "node-git-hooks" | ||
}, | ||
@@ -57,1 +57,10 @@ ``` | ||
``` | ||
It is also possible to set the githooks folder path following the same logic: | ||
``` | ||
{ | ||
"node-git-hooks": { | ||
"githooks-path": "../" | ||
} | ||
} | ||
``` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5345
56
65