web-component-analyzer icon indicating copy to clipboard operation
web-component-analyzer copied to clipboard

Feature request: analyzeProject()

Open justinfagnani opened this issue 4 years ago • 1 comments

For programmatic use, one of the simplest APIs I can think of would be to analyze a TypeScript project either by folder, or by reference to tsconfig.json file. The entrypoint, rather than the caller, would create the TypeScript program and checker.

justinfagnani avatar Dec 20 '19 02:12 justinfagnani

Thanks for the suggestion! I already have functionality in the CLI to analyze a glob/directory called analyzeGlob. This function creates a program and checker.

https://github.com/runem/web-component-analyzer/blob/4f3b5ad4a9c26cb4270519d4153089914da3c1d1/src/cli/util/analyze-globs.ts#L33-L37

It's not aware any tsconfig.json files, so I'm thinking about supporting giving a path to the tsconfig through the config AnalyzerCliConfig. This would add/exclude root files in the program by adding include, exclude and files from the tsconfig.json to the array of globs. It might also be relevant to auto-discover the tsconfig.json :-)

runem avatar Dec 27 '19 12:12 runem