Skip to content

Commit 086ee43

Browse files
committed
chore: add debugging console for testing
1 parent a930767 commit 086ee43

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/config.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { GitHooksConfig } from 'bun-git-hooks'
1+
import type { GitHooksConfig } from './types'
22
import { resolve } from 'node:path'
33
import { loadConfig } from 'bunfig'
44

src/git-hooks.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,7 @@ export function setHooksFromConfig(projectRootPath: string = process.cwd(), opti
208208
if (!config[hook])
209209
throw new Error(`[ERROR] Command for ${hook} is not set`)
210210

211+
console.log(`Hook ${hook}: `, config[hook])
211212
_setHook(hook, config[hook], projectRootPath)
212213
}
213214
else if (!preserveUnused.includes(hook))
@@ -234,10 +235,14 @@ function _setHook(hook: string, command: string, projectRoot: string = process.c
234235
const hookDirectory = path.join(gitRoot, 'hooks')
235236
const hookPath = path.normalize(path.join(hookDirectory, hook))
236237

238+
console.log('hook', { hookPath, hookCommand, hookDirectory })
237239
// Ensure hooks directory exists
238-
if (!fs.existsSync(hookDirectory))
240+
if (!fs.existsSync(hookDirectory)){
241+
console.log('hook folder not exists')
239242
fs.mkdirSync(hookDirectory, { recursive: true })
243+
}
240244

245+
console.log('Create/Write hook')
241246
fs.writeFileSync(hookPath, hookCommand, { mode: 0o755 })
242247
}
243248

0 commit comments

Comments
 (0)