@@ -194,33 +194,23 @@ export function setHooksFromConfig(projectRootPath: string = process.cwd(), opti
194194 if ( ! config || Object . keys ( config ) . length === 0 )
195195 throw new Error ( '[ERROR] Config was not found! Please add `.git-hooks.config.{ts,js,mjs,cjs,mts,cts,json}` or `git-hooks.config.{ts,js,mjs,cjs,mts,cts,json}` or the `git-hooks` entry in package.json.\r\nCheck README for details' )
196196
197-
198- console . log ( 'setHooksFromConfig config' , config )
199197 // Only validate hook names that aren't options
200198 const hookKeys = Object . keys ( config ) . filter ( key => key !== 'preserveUnused' && key !== 'verbose' )
201-
202- console . log ( 'hookKeys' , hookKeys )
203199 const isValidConfig = hookKeys . every ( key => VALID_GIT_HOOKS . includes ( key as typeof VALID_GIT_HOOKS [ number ] ) )
204200
205- console . log ( 'isValidConfig' , isValidConfig )
206-
207201 if ( ! isValidConfig )
208202 throw new Error ( '[ERROR] Config was not in correct format. Please check git hooks or options name' )
209203
210204 const preserveUnused = Array . isArray ( config . preserveUnused ) ? config . preserveUnused : config . preserveUnused ? VALID_GIT_HOOKS : [ ]
211205
212206 for ( const hook of VALID_GIT_HOOKS ) {
213- console . log ( 'hook' , hook )
214207 if ( Object . prototype . hasOwnProperty . call ( config , hook ) ) {
215- console . log ( 'hook in config' )
216208 if ( ! config [ hook ] )
217209 throw new Error ( `[ERROR] Command for ${ hook } is not set` )
218210
219- console . log ( `Hook ${ hook } : ` , config [ hook ] )
220211 _setHook ( hook , config [ hook ] , projectRootPath )
221212 }
222213 else if ( ! preserveUnused . includes ( hook ) ) {
223- console . log ( 'Remove hook' , hook )
224214 _removeHook ( hook , projectRootPath )
225215 }
226216 }
@@ -245,14 +235,11 @@ function _setHook(hook: string, command: string, projectRoot: string = process.c
245235 const hookDirectory = path . join ( gitRoot , 'hooks' )
246236 const hookPath = path . normalize ( path . join ( hookDirectory , hook ) )
247237
248- console . log ( 'hook' , { hookPath, hookCommand, hookDirectory } )
249238 // Ensure hooks directory exists
250239 if ( ! fs . existsSync ( hookDirectory ) ) {
251- console . log ( 'hook folder not exists' )
252240 fs . mkdirSync ( hookDirectory , { recursive : true } )
253241 }
254242
255- console . log ( 'Create/Write hook' )
256243 fs . writeFileSync ( hookPath , hookCommand , { mode : 0o755 } )
257244}
258245
0 commit comments