pistazie / cdk-dia

Automated diagrams of CDK provisioned infrastructure
MIT License
877 stars 37 forks source link

Command line option for `collapseDoubleClusters` #29

Closed alexpulver closed 1 year ago

alexpulver commented 1 year ago

Hi,

First, thanks a lot for this great tool! It helps a lot to visualize a solution architecture based on the actual implementation and keep it up to date :)

In my projects, I sometimes create custom constructs that wrap existing L2 constructs. The reason I am doing this is to express the function of the logical unit (example). cdk-dia collapses these constructs automatically: https://github.com/pistazie/cdk-dia/blob/dcd3237ee89deeccc8f29208e150ca0c959d1b30/src/diagram/aws/aws-diagram-generator.ts#L45

Showing the aforementioned logical units in the diagram helps with readability (see examples of before/after below). It would be helpful to have a separate option to toggle this behavior. If that sounds like a good idea, what do you think about renaming the existing --collapse option to --collapse-constructs and introducing a new --collapse-clusters option?

Before After
diagram diagram-clusters
pistazie commented 1 year ago

Hi Alex,

Sounds like a good idea as long as we keep the original functionality, and keep backward compatibility. Happy to hear CDK-Dia works well for you. Though I see a few icons are missing :)

alexpulver commented 1 year ago

Thanks :) So perhaps keep --collapse behavior for double clusters, and add --no-collapse-double-clusters option? I am not sure AppRegistry associations have icons, so maybe it's not missing :)

pistazie commented 1 year ago

Sounds great and simple to do. Do you want to make a PR? should I?

alexpulver commented 1 year ago

Thanks! I'll attempt a PR :)