Skip to content

Commit

Permalink
add more debug messages
Browse files Browse the repository at this point in the history
  • Loading branch information
typicode committed Jun 26, 2019
1 parent 1255096 commit 0f68515
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -2,6 +2,7 @@

## Unreleased

* Add more debug information
* Show a warning for Node `<= 8.6.0`

## 2.5.0
Expand Down
8 changes: 6 additions & 2 deletions src/installer/bin.ts
Expand Up @@ -5,8 +5,8 @@ import { install, uninstall } from './'
import gitRevParse from './gitRevParse'

// Debug
debug(`CWD=${process.env.CWD}`)
debug(`INIT_CWD=${process.env.INIT_CWD}`)
debug(`cwd: ${process.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 All @@ -23,6 +23,10 @@ try {
// Get top level and git dir
const { topLevel, gitDir } = gitRevParse()

// Debug
debug(`topLevel: ${topLevel}`)
debug(`gitDir: ${gitDir}`)

// Install or uninstall
if (action === 'install') {
install(topLevel, gitDir, huskyDir, isCI)
Expand Down
4 changes: 4 additions & 0 deletions src/runner/bin.ts
@@ -1,4 +1,8 @@
import index from './'
import debug from '../debug'

// Debug
debug(`cwd: ${process.cwd()}`)

// Run hook
index(process.argv)
Expand Down
3 changes: 2 additions & 1 deletion src/runner/index.ts
Expand Up @@ -18,10 +18,11 @@ export default async function run(
[, scriptPath, hookName = '', HUSKY_GIT_PARAMS]: string[],
getStdinFn: () => Promise<string> = getStdin
): Promise<number> {
// Update CWD
const cwd = path.resolve(scriptPath.split('node_modules')[0])

// Debug
debug(`CWD=${cwd}`)
debug(`cwd: ${cwd} (updated)`)

// In some cases, package.json may not exist
// For example, when switching to gh-page branch
Expand Down

0 comments on commit 0f68515

Please sign in to comment.