menu

Questions & Answers

List all dependencies between 2 folders/library in angular app

I have a huge angular project, and for some code refactoring, I need to list all dependencies between 2 specifics folders/libs (I'm using nx). With an example :

 /apps
     /lib-1
       a.service.ts
       b.component.ts
     /lib-2
       /services
          string-util.service.ts
       /models
          custom-a.model.ts
          custom-b.model.ts
          index.ts
     /lib-3
       date-util.service.ts
       custom-c.model.Ts

In a.service.ts :

import {StringUtilService} from '../lib-2/services/string-util.service.ts';
import {CustomA, CustomB} from '../lib-2/models';
import {CustomC} from '../lib-3/custom-c.model.ts';
import {DateUtilService} from '../lib-3/date-util.service.ts';

So, I would like a script, or something, if I provide "lib-1", and "lib-2", it can give me dependance between it and the result would be :

StringUtilService,
CustomAModel,
CustomBModel,

Do you have any plugin or Webstorm tools, that can do something close to this ?

Or another way to solve my problem would be : I provide "lib-2" to my tools, and it give me this result :

"StringUtilService" used in lib-1,
"CustomAModel" used in lib-1,
"CustomBModel" used in lib-1
Answers(1) :

We don't provide tooling that will list things down to the type level, but in the graph visualization you can click on any dependency and it will show the files causing it. See:

Example of visualized changes showing 1 file dependency