Closed bafolts closed 5 years ago
@marcosvrs I haven't added support for namespaces yet, but this pull request has the large refactor in place. After this it should be much simpler to add namespace. I will finish the work for namespace tomorrow. If this gets merged I will do it in a separate branch to create a smaller pull request otherwise I will continue the work on this branch.
I have some suggestions:
toString()
(or toPUML()
) to each component composites, so it can handle the conversion by their own. And convert their members without knowing their logic.generateDocumentation.ts
to component factories, for a better separation of concerns.interface IComponentComposite {
toPUML(): string;
}
class ClassComposite implements IComponentComposite {...}
interface IComponentFactory {
serialize(node: ts.Node): IComponentComposite | undefined;
}
class ClassFactory implements IComponentFactory {...}
Later, you can easily extend the logic for the NamespaceComposite
and NamespaceFactory
without much work.
At the end, you can even combine the generateDocumentation.ts
and the convertToPlant.ts
into one file with simple functions since they'll be smaller.
PS: we need to think already how to compile all TS files in just one JS file. Webpack? Gulp?
Webpack works fine. I will implement these suggestions, once they are in place the webpack work and other improvements can be done in separate pull requests.
@marcosvrs I have made the requested changes. This should be fine to merge now and then build upon the namespace support once merged.
This will add support for namespaces and close #13
Separate component classes will be created for
Namespace
,File
,Class
,Enum
,Interface
,Method
,Property
, etc. The first step will then walk the typescript abstract syntax tree and create the appropriate component classes toFile
. From there the second pass will convert eachFile
to it's corresponding plantuml.