christopherthielen / typedoc-plugin-external-module-name

Specify the Typedoc Module of a file using @module annotation

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

What would you say to implement Angular2 NgModules logic?

mlc-mlapis opened this issue · comments

Hi,

recently, A2 (developed on TS) team introduced NgModule concept for A2. It organizes the application and extend it with capabilities from external libraries (components, directives and pipes). Because of the fact that most of developed app code is created in the schema 1 class = 1 file, NgModules describe main relations among them.

I tested your plugin and it seams that there would be a great befefit to implement NgModules logic and have automaticaly defined relations among classes. The final result of docs would be that NgModules will be taken as root classes and others nested and linked by defined rules.

What is your opinion about this idea?

Seems like a good idea, if it's feasible to implement!

I have no idea about typedoc API in this moment so it is hard to me to say anything serious about the impementation. I know the rules that are defined by NgModules. Do you think that there is chance to work on it together?

I have some (limited) knowledge of typedoc API. I don't have much time to work on this feature, but I'd be happy to help point in the right direction.

However, the more I think about this, the more difficult I think it might be. I think we'd have to run the code through a compile step of some sort to fully analyze an NgModule.

My idea for the first version was to use the fact that a component (directive, pipe) should be placed to "declarations" only once = in only one module and suppose that there is the schema 1 class = 1 file used. The rest are only relations (imports, exports) among modules which are recognizable via @NgModule decorators. It would be true that one module = top level class that includes its components, directives, pipes and providers. Typedoc "Globals" = set of modules then.

I know that A2 compiler knows how to find components/modules dependencies just on the base of defined routes + is able also to create relations on analyzing templates and selectors, but this could be ommited now because those who will want to use typedoc for auto-generated documentation (based on NgModules) will fulfill presumtions above without any problems.

Any news?

@emilianosantucci I don't have the time to work on this idea, sorry