diff options
author | Kitson Kelly <me@kitsonkelly.com> | 2019-03-08 00:53:56 +1100 |
---|---|---|
committer | Ryan Dahl <ry@tinyclouds.org> | 2019-03-07 08:53:56 -0500 |
commit | 0473d832c138a7acc25372441cfa01848e6b9915 (patch) | |
tree | 94c920433911fd05772fc85cd1efb06d3da894d0 /tools/ts_library_builder/ast_util.ts | |
parent | 535037b519711d238dc0bfa2c4d2ffb4b17dec53 (diff) |
Cleanup node_modules, update packages (#1894)
And fix new lint issues.
Diffstat (limited to 'tools/ts_library_builder/ast_util.ts')
-rw-r--r-- | tools/ts_library_builder/ast_util.ts | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/tools/ts_library_builder/ast_util.ts b/tools/ts_library_builder/ast_util.ts index 58aa7fb9c..f18daa398 100644 --- a/tools/ts_library_builder/ast_util.ts +++ b/tools/ts_library_builder/ast_util.ts @@ -15,7 +15,21 @@ import { TypeGuards, VariableStatement, VariableDeclarationKind -} from "ts-simple-ast"; +} from "ts-morph"; + +let silent = false; + +/** Logs a message to the console. */ +export function log(message: any = "", ...args: any[]) { + if (!silent) { + console.log(message, ...args); + } +} + +/** Sets the silent flag which impacts logging to the console. */ +export function setSilent(value = false): void { + silent = value; +} /** Add a property to an interface */ export function addInterfaceProperty( @@ -169,8 +183,12 @@ export function flattenNamespace({ } sourceFiles.add(currentSourceFile); - const currentSourceFilePath = currentSourceFile.getFilePath(); + const currentSourceFilePath = currentSourceFile + .getFilePath() + .replace(/(\.d)?\.ts$/, ""); + log("Process source file:", currentSourceFilePath); if (customSources && currentSourceFilePath in customSources) { + log(" Using custom source."); output += customSources[currentSourceFilePath]; return; } |