I'm trying to write a grunt
task in a Typescript project to measure some statistics of the source files. To do that, I have a function that takes a single source file, runs typescript.createSourceFile
from it, and does some stuff to the returned AST. The problem is finding all the files to iterate over: I'd like to get exactly the same list of files that tsc -p tsconfig.json
will compile later. The intention is to filter out some files from that list and then iterate over the filtered list.
I imagine I'd use the typescript
module to do this, but I can't find a function to do it. I found the place in the tsc
source that turns tsconfig into a list of files, and it seems to be using a function that's not exported.
tsc --listFiles --noEmit
This will list the files that tsc will compile based on the tsconfig.json
it uses.