Comparing version 0.7.1 to 0.8.0
@@ -33,5 +33,6 @@ #!/usr/bin/env node | ||
return (0, yargs_1.default)(process.argv.slice(2)).options({ | ||
'cdk-tree-path': { type: 'string', alias: 'tree', default: 'cdk.out/tree.json', describe: 'Path of synthesized cdk cloud assembly' }, | ||
'cdk-tree-path': { type: 'string', alias: 'tree', default: 'cdk.out/tree.json', describe: 'Path of synthesized CDK cloud assembly' }, | ||
'target-path': { type: 'string', alias: 'target', default: 'diagram.png', describe: 'Target path for rendered PNG' }, | ||
'collapse': { type: 'boolean', default: true, describe: 'Collapse CDK Constructs' }, | ||
'collapse': { type: 'boolean', default: true, describe: 'Collapse CDK constructs' }, | ||
'collapse-double-clusters': { type: 'boolean', default: true, describe: 'Collapse CDK constructs with one child that is a cluster itself' }, | ||
'stacks': { type: 'array', describe: 'Stacks to include (if not specified all stacks are diagramed)' }, | ||
@@ -48,3 +49,3 @@ 'rendering': { type: 'string', choices: [cdk_dia_1.Renderers.GRAPHVIZ, cdk_dia_1.Renderers.CYTOSCAPE], default: cdk_dia_1.Renderers.GRAPHVIZ, describe: 'The rendering engine to use' } | ||
const packageBasePath = path.dirname(require.resolve('../../package.json')); | ||
cdkDia.generateDiagram(args["cdk-tree-path"], args["target-path"], args.collapse, packageBasePath, includedStacks, args["rendering"]) | ||
cdkDia.generateDiagram(args["cdk-tree-path"], args["target-path"], args.collapse, args["collapse-double-clusters"], packageBasePath, includedStacks, args["rendering"]) | ||
.then((output) => output.userOutput()) | ||
@@ -51,0 +52,0 @@ .catch(e => { |
@@ -8,3 +8,3 @@ import * as graphviz from "../src/render/graphviz"; | ||
export declare class CdkDia { | ||
generateDiagram(treeJsonPath: string, targetPath: string, collapse: boolean, cdkBasePath: string, includedStacks: string[] | false, renderer: Renderers): Promise<graphviz.GraphvizRenderingOutput | cytoscape.CytoscapeJsOutput>; | ||
generateDiagram(treeJsonPath: string, targetPath: string, collapse: boolean, collapseDoubleClusters: boolean, cdkBasePath: string, includedStacks: string[] | false, renderer: Renderers): Promise<graphviz.GraphvizRenderingOutput | cytoscape.CytoscapeJsOutput>; | ||
} |
@@ -34,6 +34,6 @@ "use strict"; | ||
class CdkDia { | ||
async generateDiagram(treeJsonPath, targetPath, collapse, cdkBasePath = require.resolve('cdk-dia/package.json'), includedStacks = false, renderer) { | ||
async generateDiagram(treeJsonPath, targetPath, collapse, collapseDoubleClusters, cdkBasePath = require.resolve('cdk-dia/package.json'), includedStacks = false, renderer) { | ||
const cdkTree = cdk.TreeJsonLoader.load(path.isAbsolute(treeJsonPath) ? treeJsonPath : path.join(process.cwd(), treeJsonPath)); | ||
const generator = new diagrams.AwsDiagramGenerator(new diagrams.AwsEdgeResolver(), new diagrams.AwsIconSupplier(`${cdkBasePath}`)); | ||
const diagram = generator.generate(cdkTree, collapse, includedStacks); | ||
const diagram = generator.generate(cdkTree, collapse, collapseDoubleClusters, includedStacks); | ||
switch (renderer) { | ||
@@ -40,0 +40,0 @@ case Renderers.GRAPHVIZ: |
@@ -8,3 +8,3 @@ import * as cdk from "../../cdk"; | ||
constructor(edgeResolver: AwsEdgeResolver, iconSupplier: AwsIconSupplier); | ||
generate(cdkTree: cdk.Tree, collapse: boolean, includedStacks?: string[] | false): Diagram; | ||
generate(cdkTree: cdk.Tree, collapse: boolean, collapseDoubleClusters: boolean, includedStacks?: string[] | false): Diagram; | ||
private generateComponentsTree; | ||
@@ -11,0 +11,0 @@ private generateSubTree; |
@@ -34,3 +34,3 @@ "use strict"; | ||
} | ||
generate(cdkTree, collapse, includedStacks = false) { | ||
generate(cdkTree, collapse, collapseDoubleClusters, includedStacks = false) { | ||
const diagram = new __1.Diagram(); | ||
@@ -45,3 +45,4 @@ const cdkRoot = cdkTree.tree; | ||
this.removeCdkAssets(diagram.root); | ||
diagram.root = this.collapseDoubleClusters(diagram.root); | ||
if (collapseDoubleClusters) | ||
diagram.root = this.collapseDoubleClusters(diagram.root); | ||
this.removeCrossStackEdges(diagram.root); | ||
@@ -48,0 +49,0 @@ this.removeSelfLinks(diagram.root); |
@@ -47,3 +47,4 @@ "use strict"; | ||
cdkTreePath: "src/test-fixtures/", | ||
collapsed: true | ||
collapsed: true, | ||
collapsedDoubleClusters: true | ||
}; | ||
@@ -69,3 +70,4 @@ it(`it only diagrams the "microservice1" stack`, () => { | ||
cdkTreePath: "src/test-fixtures/", | ||
collapsed: false | ||
collapsed: false, | ||
collapsedDoubleClusters: true | ||
}; | ||
@@ -154,5 +156,5 @@ it(`use can use a path of a stack which is nested`, () => { | ||
const generator = new diagrams.AwsDiagramGenerator(new __1.AwsEdgeResolver(), new aws_icon_supplier_1.AwsIconSupplier("")); | ||
return generator.generate(cdkTree, testConf.collapsed, includedStacks); | ||
return generator.generate(cdkTree, testConf.collapsed, testConf.collapsedDoubleClusters, includedStacks); | ||
} | ||
exports.givenDiagram = givenDiagram; | ||
//# sourceMappingURL=generator.test.js.map |
@@ -7,2 +7,3 @@ export declare const testCases: TestConf[]; | ||
collapsed: boolean; | ||
collapsedDoubleClusters: boolean; | ||
} |
@@ -9,3 +9,4 @@ "use strict"; | ||
cdkTreePath: "src/test-fixtures/", | ||
collapsed: true | ||
collapsed: true, | ||
collapsedDoubleClusters: true | ||
}, | ||
@@ -16,3 +17,4 @@ { | ||
cdkTreePath: "src/test-fixtures/", | ||
collapsed: false | ||
collapsed: false, | ||
collapsedDoubleClusters: true | ||
}, | ||
@@ -23,3 +25,4 @@ { | ||
cdkTreePath: "src/test-fixtures/", | ||
collapsed: true | ||
collapsed: true, | ||
collapsedDoubleClusters: true | ||
}, | ||
@@ -30,3 +33,4 @@ { | ||
cdkTreePath: "src/test-fixtures/", | ||
collapsed: false | ||
collapsed: false, | ||
collapsedDoubleClusters: true | ||
}, | ||
@@ -37,3 +41,4 @@ { | ||
cdkTreePath: "src/test-fixtures/", | ||
collapsed: false | ||
collapsed: false, | ||
collapsedDoubleClusters: true | ||
}, | ||
@@ -44,3 +49,4 @@ { | ||
cdkTreePath: "src/test-fixtures/", | ||
collapsed: true | ||
collapsed: true, | ||
collapsedDoubleClusters: true | ||
}, | ||
@@ -51,3 +57,4 @@ { | ||
cdkTreePath: "src/test-fixtures/", | ||
collapsed: false | ||
collapsed: false, | ||
collapsedDoubleClusters: true | ||
}, | ||
@@ -58,3 +65,4 @@ { | ||
cdkTreePath: "src/test-fixtures/", | ||
collapsed: true | ||
collapsed: true, | ||
collapsedDoubleClusters: true | ||
}, | ||
@@ -65,3 +73,4 @@ { | ||
cdkTreePath: "src/test-fixtures/", | ||
collapsed: false | ||
collapsed: false, | ||
collapsedDoubleClusters: true | ||
}, | ||
@@ -72,3 +81,4 @@ { | ||
cdkTreePath: "src/test-fixtures/", | ||
collapsed: true | ||
collapsed: true, | ||
collapsedDoubleClusters: true | ||
}, | ||
@@ -79,3 +89,4 @@ { | ||
cdkTreePath: "src/test-fixtures/", | ||
collapsed: false | ||
collapsed: false, | ||
collapsedDoubleClusters: true | ||
}, | ||
@@ -86,3 +97,4 @@ { | ||
cdkTreePath: "src/test-fixtures/", | ||
collapsed: true | ||
collapsed: true, | ||
collapsedDoubleClusters: true | ||
}, | ||
@@ -93,3 +105,4 @@ { | ||
cdkTreePath: "src/test-fixtures/", | ||
collapsed: false | ||
collapsed: false, | ||
collapsedDoubleClusters: true | ||
}, | ||
@@ -100,3 +113,4 @@ { | ||
cdkTreePath: "src/test-fixtures/", | ||
collapsed: true | ||
collapsed: true, | ||
collapsedDoubleClusters: true | ||
}, | ||
@@ -107,3 +121,4 @@ { | ||
cdkTreePath: "src/test-fixtures/", | ||
collapsed: false | ||
collapsed: false, | ||
collapsedDoubleClusters: true | ||
}, | ||
@@ -114,3 +129,4 @@ { | ||
cdkTreePath: "src/test-fixtures/", | ||
collapsed: true | ||
collapsed: true, | ||
collapsedDoubleClusters: true | ||
}, | ||
@@ -121,3 +137,4 @@ { | ||
cdkTreePath: "src/test-fixtures/", | ||
collapsed: true | ||
collapsed: true, | ||
collapsedDoubleClusters: true | ||
}, | ||
@@ -128,3 +145,4 @@ { | ||
cdkTreePath: "src/test-fixtures/", | ||
collapsed: false | ||
collapsed: false, | ||
collapsedDoubleClusters: true | ||
}, | ||
@@ -135,3 +153,4 @@ { | ||
cdkTreePath: "src/test-fixtures/", | ||
collapsed: true | ||
collapsed: true, | ||
collapsedDoubleClusters: true | ||
}, | ||
@@ -142,5 +161,6 @@ { | ||
cdkTreePath: "src/test-fixtures/", | ||
collapsed: false | ||
collapsed: false, | ||
collapsedDoubleClusters: true | ||
}, | ||
]; | ||
//# sourceMappingURL=testCases.js.map |
{ | ||
"name": "cdk-dia", | ||
"version": "0.7.1", | ||
"version": "0.8.0", | ||
"description": "🎡 Automated diagrams of CDK provisioned infrastructure", | ||
@@ -5,0 +5,0 @@ "scripts": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
14181865
43834