Skip to content

Commit

Permalink
1.1.1 - add install instructions, filter out characters mermaid doesn…
Browse files Browse the repository at this point in the history
…'t like
  • Loading branch information
martzmakes committed May 15, 2023
1 parent 984ccc4 commit 4060b0e
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 10 deletions.
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,17 @@ This uses no external dependencies!
- Normal arrow lines indicate an existing linkage
- dashed/dotted arrow lines indicate a removed linkage

## Installation Instructions

`npm install @aws-community/arch-dia --save-dev`

then add the aspect to your Stack

```
const myStack = new Stack(app, 'MyStack');
Aspects.of(myStack).add(new ArchitectureDiagramAspect());
```

## Example 1 - Simple Stack

```mermaid
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"diagram"
],
"license": "Apache-2.0",
"version": "1.0.0",
"version": "1.1.1",
"main": "lib/index.js",
"types": "lib/index.d.ts",
"scripts": {
Expand Down
7 changes: 1 addition & 6 deletions src/architecture-diagram.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,9 @@ export class ArchitectureDiagramAspect implements IAspect {
private traverseConstruct (construct: IConstruct, parentPath: string): void {
const parentSplit = parentPath.split(' --> ');
const currentParent = parentSplit[parentSplit.length - 1];
if (CfnResource.isCfnResource(construct)) {
console.log(
`CfnResource: ${construct.node.addr} - ${construct.node.id} - ${JSON.stringify(construct.cfnOptions)}`,
);
}
const currentPath = `${currentParent}${currentParent ? ' --> ' : ''}${
construct.node.addr
}[${construct.node.id}${
}[${construct.node.id.replace(/{|}/g, '')}${
CfnResource.isCfnResource(construct)
? ` - ${construct.cfnResourceType}`
: ''
Expand Down
2 changes: 1 addition & 1 deletion test/arch-dia.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { App, Stack } from 'aws-cdk-lib';
import { App, Aspects, Stack } from 'aws-cdk-lib';
import { Queue } from 'aws-cdk-lib/aws-sqs';

const writeFile = jest.fn();
Expand Down

0 comments on commit 4060b0e

Please sign in to comment.