Skip to content

Commit

Permalink
refactor(debug): add logging
Browse files Browse the repository at this point in the history
  • Loading branch information
tusharmath committed Jul 14, 2018
1 parent 07a724c commit c43e188
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
"@types/yargs": "^11.1.0",
"chalk": "^2.4.1",
"fs-extra": "^6.0.1",
"yargs": "^12.0.1"
"yargs": "^12.0.1",
"debug": "^3.1.0"
}
}
4 changes: 4 additions & 0 deletions src/transform.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import * as ts from 'typescript'
import {forEachNode} from './for-each-node'
const debug = require('debug')('ts-codemod')

export abstract class Transformation<T = {}> {
constructor(
Expand Down Expand Up @@ -41,10 +42,13 @@ export const transform = <T>(
context,
transformationParams
)
debug(`PARAMS:`, transformationParams)
const visitor: ts.Visitor = (node: ts.Node) => {
debug(`NODE: ${node.kind}`)
const visitResult = transformer.visit(node)
return visitResult ? forEachNode(visitor, visitResult, context) : node
}
debug(`FILE: ${params.path}`)
return ts.visitEachChild(
transformer.visit(file) as ts.SourceFile,
visitor,
Expand Down

0 comments on commit c43e188

Please sign in to comment.