Skip to content

Commit

Permalink
Show CWD in debug messages (#509)
Browse files Browse the repository at this point in the history
  • Loading branch information
typicode committed Jun 23, 2019
1 parent e081063 commit 4079060
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 15 deletions.
41 changes: 30 additions & 11 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions src/debug.ts
@@ -0,0 +1,5 @@
export default function debug(...args: string[]): void {
if (['1', 'true'].includes(process.env.HUSKY_DEBUG || '')) {
console.log('husky:debug', ...args)
}
}
8 changes: 4 additions & 4 deletions src/installer/bin.ts
@@ -1,11 +1,11 @@
import isCI from 'is-ci'
import path from 'path'
import debug from '../debug'
import { install, uninstall } from './'

// Just for testing
if (process.env.HUSKY_DEBUG === 'true' || process.env.HUSKY_DEBUG === '1') {
console.log(`husky:debug INIT_CWD=${process.env.INIT_CWD}`)
}
// Debug
debug(`CWD=${process.env.CWD}`)
debug(`INIT_CWD=${process.env.INIT_CWD}`)

// Action can be "install" or "uninstall"
// huskyDir is ONLY used in dev, don't use this arguments
Expand Down
5 changes: 5 additions & 0 deletions src/runner/bin.ts
@@ -1,5 +1,10 @@
import index from './'
import debug from '../debug'

// Debug
debug(`CWD=${process.env.CWD}`)

// Run hook
index(process.argv)
.then((status: number): void => process.exit(status))
.catch(
Expand Down

0 comments on commit 4079060

Please sign in to comment.