如何使用angular project运行ngast库?
我找到了angular的ngast库(),但不知道如何使用它。 说明书上说:如何使用angular project运行ngast库?,angular,parsing,Angular,Parsing,我找到了angular的ngast库(),但不知道如何使用它。 说明书上说: 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');
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.
但我不知道该把代码放在哪里,以及如何运行。有什么帮助吗?
如果有帮助,示例项目: