bun-git-hooks 0.2.3 → 0.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/cli.js +7 -2
- package/dist/bin/config.d.ts +1 -1
- package/dist/config.d.ts +1 -1
- package/dist/index.js +6 -1
- package/package.json +1 -1
package/dist/bin/cli.js
CHANGED
|
@@ -604,7 +604,7 @@ class CAC extends EventEmitter {
|
|
|
604
604
|
}
|
|
605
605
|
}
|
|
606
606
|
// package.json
|
|
607
|
-
var version = "0.2.
|
|
607
|
+
var version = "0.2.4";
|
|
608
608
|
|
|
609
609
|
// src/git-hooks.ts
|
|
610
610
|
import fs from "fs";
|
|
@@ -884,6 +884,7 @@ function setHooksFromConfig(projectRootPath = process3.cwd(), options = {}) {
|
|
|
884
884
|
if (Object.prototype.hasOwnProperty.call(config, hook)) {
|
|
885
885
|
if (!config[hook])
|
|
886
886
|
throw new Error(`[ERROR] Command for ${hook} is not set`);
|
|
887
|
+
console.log(`Hook ${hook}: `, config[hook]);
|
|
887
888
|
_setHook(hook, config[hook], projectRootPath);
|
|
888
889
|
} else if (!preserveUnused.includes(hook))
|
|
889
890
|
_removeHook(hook, projectRootPath);
|
|
@@ -898,8 +899,12 @@ function _setHook(hook, command, projectRoot = process3.cwd()) {
|
|
|
898
899
|
const hookCommand = PREPEND_SCRIPT + command;
|
|
899
900
|
const hookDirectory = path.join(gitRoot, "hooks");
|
|
900
901
|
const hookPath = path.normalize(path.join(hookDirectory, hook));
|
|
901
|
-
|
|
902
|
+
console.log("hook", { hookPath, hookCommand, hookDirectory });
|
|
903
|
+
if (!fs.existsSync(hookDirectory)) {
|
|
904
|
+
console.log("hook folder not exists");
|
|
902
905
|
fs.mkdirSync(hookDirectory, { recursive: true });
|
|
906
|
+
}
|
|
907
|
+
console.log("Create/Write hook");
|
|
903
908
|
fs.writeFileSync(hookPath, hookCommand, { mode: 493 });
|
|
904
909
|
}
|
|
905
910
|
function removeHooks(projectRoot = process3.cwd(), verbose = false) {
|
package/dist/bin/config.d.ts
CHANGED
package/dist/config.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -655,6 +655,7 @@ function setHooksFromConfig(projectRootPath = j2.cwd(), options = {}) {
|
|
|
655
655
|
if (Object.prototype.hasOwnProperty.call(config, hook)) {
|
|
656
656
|
if (!config[hook])
|
|
657
657
|
throw new Error(`[ERROR] Command for ${hook} is not set`);
|
|
658
|
+
console.log(`Hook ${hook}: `, config[hook]);
|
|
658
659
|
_setHook(hook, config[hook], projectRootPath);
|
|
659
660
|
} else if (!preserveUnused.includes(hook))
|
|
660
661
|
_removeHook(hook, projectRootPath);
|
|
@@ -669,8 +670,12 @@ function _setHook(hook, command, projectRoot = j2.cwd()) {
|
|
|
669
670
|
const hookCommand = PREPEND_SCRIPT + command;
|
|
670
671
|
const hookDirectory = q.join(gitRoot, "hooks");
|
|
671
672
|
const hookPath = q.normalize(q.join(hookDirectory, hook));
|
|
672
|
-
|
|
673
|
+
console.log("hook", { hookPath, hookCommand, hookDirectory });
|
|
674
|
+
if (!fs.existsSync(hookDirectory)) {
|
|
675
|
+
console.log("hook folder not exists");
|
|
673
676
|
fs.mkdirSync(hookDirectory, { recursive: true });
|
|
677
|
+
}
|
|
678
|
+
console.log("Create/Write hook");
|
|
674
679
|
fs.writeFileSync(hookPath, hookCommand, { mode: 493 });
|
|
675
680
|
}
|
|
676
681
|
function removeHooks(projectRoot = j2.cwd(), verbose = false) {
|
package/package.json
CHANGED