Krishnan Mudaliar
1 min readMay 1, 2019

--

Nevermind. I think I found what I was looking for.

@schematics/angular contains a library called ast-util.ts. You will see it being used in a lot of examples and articles about Schematics, like even this one here, but they are not talked about much, in general.

I found a function in there called findNodes that can parse through a TS file and get you the Nodes (type: typescript/Node) you are looking for. Once the nodes are found, you can then use classes like InsertChange to edit the existing file.

Cool stuff. Just takes a lot of time to dig in and learn about them. :D

--

--

Krishnan Mudaliar
Krishnan Mudaliar

Written by Krishnan Mudaliar

Loves the web • DIY • DRY • ASP.NET • JavaScript • Angular • NodeJS (i/bitsy) • Believer of great UX

No responses yet