diff --git a/tools/my-plugin/src/generators/utils/get-source-file.ts b/tools/my-plugin/src/generators/utils/get-source-file.ts new file mode 100644 index 0000000..a6b3bc0 --- /dev/null +++ b/tools/my-plugin/src/generators/utils/get-source-file.ts @@ -0,0 +1,7 @@ +import { Tree } from '@nx/devkit'; +import { createSourceFile, ScriptTarget } from 'typescript'; + +export function getSourceFile(tree: Tree, filePath: string) { + const moduleSrc = tree.read(filePath, 'utf-8'); + return createSourceFile(filePath, moduleSrc, ScriptTarget.Latest, true); +}