ngast
1.0.0
This library provides user friendly API for parsing Angular projects.
$ npm i @angular/core @angular/compiler @angular/compiler-cli ngast --save
ngastis built on top of Ivy (ngtsc), make sure to compile your project withngcc(runng serve,ng buildornpx ngcc).
First you need connect the WorkspaceSymbols to the tsconfig.json root :
import { join } from 'path';
import { WorkspaceSymbols } from 'ngast';
const config = join(process.cwd(), 'tsconfig.json');
const workspace = new WorkspaceSymbols(config);From there you can find all the decorated classes in your project :
const modules = workspace.getAllModules();
const components = workspace.getAllComponents();
const directives = workspace.getAllDirectives();
const injectables = workspace.getAllInjectable();
const pipes = workspace.getAllPipes();The first time one of the method above is called, ngast will run the analysis of the workspace.
The analysis is currently quite long: >10sec for a small project can go beyond 2min for a very large project.
Version 0.4.0 is built on top of the ViewEngine, you can take a look at the documentation here.
Projects using ngast:
MIT