0

I'm trying to look for automation solutions for refactoring an Angular app as it is really tedious to manually refactor.

As we try to lighten our app's shared module by treeshaking components/directives into their own module, there is a need to go through every feature module in the app and check if a directive or component selector exist in the template. If it does, the module the template is in must import the new directive's/component's module that was treeshaken from the shared module. Are there any refactor tools that can help with this? It feels like a very common task.


Alternatively if no general solution exist, I'd still like to find a way to programmatically at least list all absolute paths of components in any given .module.ts file's declarations array.

The resolution issues I'm facing now are,

  • The components file names can be different from the Class
  • They are sometimes in deeply nested in multiple barrels references
  • TsConfig paths is also customizing imports of the project.
Jonathan002
  • 9,639
  • 8
  • 37
  • 58
  • I don't know if it fit, but. https://github.com/mgechev/ngrev: Graphical tool for reverse engineering of Angular projects https://github.com/angular-eslint/angular-eslint: Angular eslint. – Hoch Jun 14 '21 at 20:28
  • Can't this be implemented using Angular's schematics tools? – Shy Agam Jun 15 '21 at 21:19

1 Answers1

1

This is a really good question, but I'm sure that at the moment there is no ready-to-go tool that can solve your problem.

What I can suggest:

nickbullock
  • 6,424
  • 9
  • 27