├── .eslintignore ├── .eslintrc.json ├── .gitignore ├── .npmignore ├── LICENSE ├── README.md ├── jest.config.ts ├── package-lock.json ├── package.json ├── src ├── architecture-diagram.ts ├── fs-utils.ts └── index.ts ├── test ├── __snapshots__ │ └── arch-dia.test.ts.snap ├── arch-dia.test.ts └── jest.setup.ts └── tsconfig.dev.json /.eslintignore: -------------------------------------------------------------------------------- 1 | *.d.ts 2 | -------------------------------------------------------------------------------- /.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "env": { 3 | "es2021": true, 4 | "node": true 5 | }, 6 | "extends": "standard-with-typescript", 7 | "overrides": [], 8 | "parserOptions": { 9 | "ecmaVersion": "latest", 10 | "project": "./tsconfig.dev.json", 11 | "sourceType": "module" 12 | }, 13 | "rules": { 14 | "no-new": "off", 15 | "object-curly-newline": [ 16 | "error", 17 | { 18 | "ObjectExpression": "always", 19 | "ObjectPattern": { 20 | "multiline": true 21 | }, 22 | "ImportDeclaration": "never", 23 | "ExportDeclaration": { 24 | "multiline": true, 25 | "minProperties": 3 26 | } 27 | } 28 | ], 29 | "@typescript-eslint/comma-dangle": [ 30 | "error", 31 | "always-multiline" 32 | ], 33 | "@typescript-eslint/semi": [ 34 | "error", 35 | "always" 36 | ], 37 | "@typescript-eslint/strict-boolean-expressions": "off", 38 | "@typescript-eslint/consistent-type-assertions": "off" 39 | } 40 | } -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.js 2 | !jest.config.js 3 | *.d.ts 4 | coverage 5 | node_modules 6 | 7 | # CDK asset staging directory 8 | .cdk.staging 9 | cdk.out 10 | 11 | # jsii 12 | .jsii 13 | dist 14 | lib 15 | tsconfig.json 16 | 17 | .DS_Store -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | *.ts 2 | !*.d.ts 3 | coverage 4 | test 5 | tsconfig.dev.json 6 | .eslintignore 7 | .eslintrc.json 8 | 9 | # CDK asset staging directory 10 | .cdk.staging 11 | cdk.out 12 | 13 | # Exclude jsii outdir 14 | dist 15 | 16 | # Include .jsii and .jsii.gz 17 | !.jsii 18 | !.jsii.gz 19 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [2023] [Matt Martz] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Architecture Diagram Aspect 2 | 3 | This CDK Aspect traverses the stack to generate a GitHub / markdown compatible mermaid chart of the AWS Resources created by the stack. 4 | 5 | It outputs this as a markdown folder based on the stack's id. For example: 6 | 7 | `new Stack(new App(), 'asdf');` 8 | 9 | would create a markdown file called `asdf.md`. 10 | 11 | On each subsequent synthesis, the Aspect will read the stack's existing markdown file (if it exists) and infer architecture changes b/w before and after. It will then replace the markdown file with a visual diff of the architecture (see examples below). 12 | 13 | This uses no external dependencies! 14 | 15 | - Green boxes indicate resources that were added 16 | - Red boxes indicates resources that were removed 17 | - Thick arrow lines indicate a new linkage 18 | - Normal arrow lines indicate an existing linkage 19 | - dashed/dotted arrow lines indicate a removed linkage 20 | 21 | ## Installation Instructions 22 | 23 | `npm install @aws-community/arch-dia --save-dev` 24 | 25 | then add the aspect to your Stack 26 | 27 | ``` 28 | const myStack = new Stack(app, 'MyStack'); 29 | const archDia = new ArchitectureDiagramAspect(); 30 | Aspects.of(myStack).add(archDia); 31 | archDia.generateDiagram(); 32 | ``` 33 | 34 | ## Example 1 - Simple Stack 35 | 36 | ```mermaid 37 | graph LR; 38 | c814b2c5dc22d11a84e78a63be7bb7815715b70534[MyTestStack] 39 | classDef default fill:#fff,stroke:#000,color:black; 40 | classDef added fill:#cfc,stroke:#cfc,stroke-width:2px,color:black; 41 | classDef removed fill:#fcc,stroke:#fcc,stroke-width:2px,color:black; 42 | ``` 43 | 44 | ## Example 2 - Queue Added to Stack 45 | 46 | ```mermaid 47 | graph LR; 48 | c814b2c5dc22d11a84e78a63be7bb7815715b70534[MyTestStack] 49 | c814b2c5dc22d11a84e78a63be7bb7815715b70534[MyTestStack] ==> c8a33fea56cf1bd6e8b5c652f393a6d315e7a78836[MyQueue]:::added 50 | c8a33fea56cf1bd6e8b5c652f393a6d315e7a78836[MyQueue]:::added ==> c80cb3f181e7dbb6726caf602717b2585dabff5aff[Resource - AWS::SQS::Queue]:::added 51 | classDef default fill:#fff,stroke:#000,color:black; 52 | classDef added fill:#cfc,stroke:#cfc,stroke-width:2px,color:black; 53 | classDef removed fill:#fcc,stroke:#fcc,stroke-width:2px,color:black; 54 | ``` 55 | 56 | ## Example 3 - Stack re-synthed AFTER the queue was added 57 | 58 | ```mermaid 59 | graph LR; 60 | c814b2c5dc22d11a84e78a63be7bb7815715b70534[MyTestStack] 61 | c814b2c5dc22d11a84e78a63be7bb7815715b70534[MyTestStack] --> c8a33fea56cf1bd6e8b5c652f393a6d315e7a78836[MyQueue] 62 | c8a33fea56cf1bd6e8b5c652f393a6d315e7a78836[MyQueue] --> c80cb3f181e7dbb6726caf602717b2585dabff5aff[Resource - AWS::SQS::Queue] 63 | classDef default fill:#fff,stroke:#000,color:black; 64 | classDef added fill:#cfc,stroke:#cfc,stroke-width:2px,color:black; 65 | classDef removed fill:#fcc,stroke:#fcc,stroke-width:2px,color:black; 66 | ``` 67 | 68 | ## Example 4 - Queue Removed 69 | 70 | ```mermaid 71 | graph LR; 72 | c814b2c5dc22d11a84e78a63be7bb7815715b70534[MyTestStack] 73 | c814b2c5dc22d11a84e78a63be7bb7815715b70534[MyTestStack] -.-> c8a33fea56cf1bd6e8b5c652f393a6d315e7a78836[MyQueue]:::removed 74 | c8a33fea56cf1bd6e8b5c652f393a6d315e7a78836[MyQueue]:::removed -.-> c80cb3f181e7dbb6726caf602717b2585dabff5aff[Resource - AWS::SQS::Queue]:::removed 75 | classDef default fill:#fff,stroke:#000,color:black; 76 | classDef added fill:#cfc,stroke:#cfc,stroke-width:2px,color:black; 77 | classDef removed fill:#fcc,stroke:#fcc,stroke-width:2px,color:black; 78 | ``` 79 | 80 | ## Example 5 - Stack re-synthed AFTER the queue was removed 81 | 82 | ```mermaid 83 | graph LR; 84 | c814b2c5dc22d11a84e78a63be7bb7815715b70534[MyTestStack] 85 | classDef default fill:#fff,stroke:#000,color:black; 86 | classDef added fill:#cfc,stroke:#cfc,stroke-width:2px,color:black; 87 | classDef removed fill:#fcc,stroke:#fcc,stroke-width:2px,color:black; 88 | ``` 89 | 90 | ## Example 6 - A More Complex Change 91 | 92 | In this example I changed the SelfDestructConstruct's id in the SelfDestructStack from [`@aws-community/self-destruct`](https://github.com/aws-community-projects/self-destruct) 93 | 94 | ```mermaid 95 | graph LR; 96 | c814b2c5dc22d11a84e78a63be7bb7815715b70534[MyTestStack] 97 | c814b2c5dc22d11a84e78a63be7bb7815715b70534[MyTestStack] --> c80af741cb2cb4b820501f9db156b5ad6d466f2c40[DefaultCrNodeVersionMap] 98 | c814b2c5dc22d11a84e78a63be7bb7815715b70534[MyTestStack] --> c814b796835a46b46f562e4fec24744f79c0e8a6c6[AWS679f53fac002430cb0da5b7982bd2287] 99 | c814b796835a46b46f562e4fec24744f79c0e8a6c6[AWS679f53fac002430cb0da5b7982bd2287] --> c8c4cb1cdac5e4ce33049155a3100eb458b8c3fc92[ServiceRole] 100 | c8c4cb1cdac5e4ce33049155a3100eb458b8c3fc92[ServiceRole] --> c896b88ae08866f2fd84e3381fdcfef602ddf115e0[ImportServiceRole] 101 | c8c4cb1cdac5e4ce33049155a3100eb458b8c3fc92[ServiceRole] --> c8e147fab0f248fba7acf510a427238616a5594caf[Resource - AWS::IAM::Role] 102 | c814b796835a46b46f562e4fec24744f79c0e8a6c6[AWS679f53fac002430cb0da5b7982bd2287] --> c886a5938c919902b3f83e356270aaca7eb024ca37[Code] 103 | c886a5938c919902b3f83e356270aaca7eb024ca37[Code] --> c850745224509f9fad04f5dcf344587a71d12a20a9[Stage] 104 | c886a5938c919902b3f83e356270aaca7eb024ca37[Code] --> c840b81d4f9aece5445022d425c2a723daa0058440[AssetBucket] 105 | c814b796835a46b46f562e4fec24744f79c0e8a6c6[AWS679f53fac002430cb0da5b7982bd2287] --> c8a6605aad4f358e7b3588d39706e10e288e22cceb[Resource - AWS::Lambda::Function] 106 | c814b2c5dc22d11a84e78a63be7bb7815715b70534[MyTestStack] ==> c85973ed60c8087738f3313c08800bcaf270a8baf2[SelfDestructConstruct]:::added 107 | c85973ed60c8087738f3313c08800bcaf270a8baf2[SelfDestructConstruct]:::added ==> c867441ef67820df03b6f190a1b4f2bdb69f6bbfb7[ListExecutions]:::added 108 | c85973ed60c8087738f3313c08800bcaf270a8baf2[SelfDestructConstruct]:::added ==> c8c357b9bbc491af6e16abfe3eafec2c9f7f7a017e[ExecutionsMap]:::added 109 | c85973ed60c8087738f3313c08800bcaf270a8baf2[SelfDestructConstruct]:::added ==> c8ce567f4cc9c92c93edf6262d51437f6f8663e68c[StopExecution]:::added 110 | c85973ed60c8087738f3313c08800bcaf270a8baf2[SelfDestructConstruct]:::added ==> c86e2668734812ee49ac23711e6022ace1b37d968c[NotSelf?]:::added 111 | c85973ed60c8087738f3313c08800bcaf270a8baf2[SelfDestructConstruct]:::added ==> c8754ab4082392b269420307a1f94c1807e5351fbc[self]:::added 112 | c85973ed60c8087738f3313c08800bcaf270a8baf2[SelfDestructConstruct]:::added ==> c8ab16dca8b8e7ae2cdc945f053403d17d4bb13293[Wait]:::added 113 | c85973ed60c8087738f3313c08800bcaf270a8baf2[SelfDestructConstruct]:::added ==> c8a204c18cba769b058b9be6f915c73ea245ed987d[WasDelete?]:::added 114 | c85973ed60c8087738f3313c08800bcaf270a8baf2[SelfDestructConstruct]:::added ==> c8d240060f869165e19dd78cdb64384fd3b6cfe988[DeleteSuccess]:::added 115 | c85973ed60c8087738f3313c08800bcaf270a8baf2[SelfDestructConstruct]:::added ==> c84173268981abc959f512c51e020c39ec7ae3ec76[DeleteStack]:::added 116 | c85973ed60c8087738f3313c08800bcaf270a8baf2[SelfDestructConstruct]:::added ==> c81bcee72c5b9f23f9ca3aa55557309f487d0e9c3f[Finished]:::added 117 | c85973ed60c8087738f3313c08800bcaf270a8baf2[SelfDestructConstruct]:::added ==> c8750c972d7672c4145d53ca9a0e1d1aec24590c54[SelfDestructMachine]:::added 118 | c8750c972d7672c4145d53ca9a0e1d1aec24590c54[SelfDestructMachine]:::added ==> c8c88ef2c110d439f324473130061b915e3c78097e[Role]:::added 119 | c8c88ef2c110d439f324473130061b915e3c78097e[Role]:::added ==> c83272a3306ac85223c5458c0e36ae6db2b842f060[ImportRole]:::added 120 | c8c88ef2c110d439f324473130061b915e3c78097e[Role]:::added ==> c8e870cb6ef64aa4ea3535dbb95718a3e12e748991[Resource - AWS::IAM::Role]:::added 121 | c8c88ef2c110d439f324473130061b915e3c78097e[Role]:::added ==> c872d8191fef561add8db78225a6383ca74e353197[DefaultPolicy]:::added 122 | c872d8191fef561add8db78225a6383ca74e353197[DefaultPolicy]:::added ==> c85372e76de21cb43163e6c0e4b8a82d60867d3b38[Resource - AWS::IAM::Policy]:::added 123 | c8750c972d7672c4145d53ca9a0e1d1aec24590c54[SelfDestructMachine]:::added ==> c8fe7706d7c925b14d8403ae82a05d03bbdb5b6c3d[Resource - AWS::StepFunctions::StateMachine]:::added 124 | c85973ed60c8087738f3313c08800bcaf270a8baf2[SelfDestructConstruct]:::added ==> c83208d69c99b7e073b576de11075e8206a88e43ba[SelfDestructCR]:::added 125 | c83208d69c99b7e073b576de11075e8206a88e43ba[SelfDestructCR]:::added ==> c8786fc99ce8e11a472bd0f7a7581ebd776856960a[Provider]:::added 126 | c83208d69c99b7e073b576de11075e8206a88e43ba[SelfDestructCR]:::added ==> c8c485835426778712745f32406acfb3aeb2888ffb[Resource]:::added 127 | c8c485835426778712745f32406acfb3aeb2888ffb[Resource]:::added ==> c8c485835426778712745f32406acfb3aeb2888ffb[Default - Custom::AWS]:::added 128 | c83208d69c99b7e073b576de11075e8206a88e43ba[SelfDestructCR]:::added ==> c81580e5c79f9cbb68791d1d3c87fabefacbe8b39e[CustomResourcePolicy]:::added 129 | c81580e5c79f9cbb68791d1d3c87fabefacbe8b39e[CustomResourcePolicy]:::added ==> c8112158745e0d7b9bbdac346dbfea0a18d26c8d61[Resource - AWS::IAM::Policy]:::added 130 | c814b2c5dc22d11a84e78a63be7bb7815715b70534[MyTestStack] -.-> c80bdb3872d8c7655592d6042091bd6bb0aa9f40f4[SelfDestruct]:::removed 131 | c80bdb3872d8c7655592d6042091bd6bb0aa9f40f4[SelfDestruct]:::removed -.-> c8c54a8196685c157486945a81d7b12e199629d918[ListExecutions]:::removed 132 | c80bdb3872d8c7655592d6042091bd6bb0aa9f40f4[SelfDestruct]:::removed -.-> c81a922dcdd35e5877a70eff4e4bedcb06b49ce546[ExecutionsMap]:::removed 133 | c80bdb3872d8c7655592d6042091bd6bb0aa9f40f4[SelfDestruct]:::removed -.-> c8758780b80cab4431f449ec131710f176ffa6eed7[StopExecution]:::removed 134 | c80bdb3872d8c7655592d6042091bd6bb0aa9f40f4[SelfDestruct]:::removed -.-> c8b45c8e3e155188018a6fb0fb59dffb724fbe9061[NotSelf?]:::removed 135 | c80bdb3872d8c7655592d6042091bd6bb0aa9f40f4[SelfDestruct]:::removed -.-> c8404a3443078f76b7dc166adf3eff9dbc57286632[self]:::removed 136 | c80bdb3872d8c7655592d6042091bd6bb0aa9f40f4[SelfDestruct]:::removed -.-> c8193b74891ee6b528cb4f27dbfb7cda4eb224266e[Wait]:::removed 137 | c80bdb3872d8c7655592d6042091bd6bb0aa9f40f4[SelfDestruct]:::removed -.-> c8eedcb57a4d9221ef99932ff2edfcaa20819074f2[WasDelete?]:::removed 138 | c80bdb3872d8c7655592d6042091bd6bb0aa9f40f4[SelfDestruct]:::removed -.-> c8c0bcaaa5f8c145822db685dcf873efa23374a75f[DeleteSuccess]:::removed 139 | c80bdb3872d8c7655592d6042091bd6bb0aa9f40f4[SelfDestruct]:::removed -.-> c85410517a5d132100bfd757fbdb9150b4045388aa[DeleteStack]:::removed 140 | c80bdb3872d8c7655592d6042091bd6bb0aa9f40f4[SelfDestruct]:::removed -.-> c8c875bedb4b72dc82518384c9c700789b9a4cea3e[Finished]:::removed 141 | c80bdb3872d8c7655592d6042091bd6bb0aa9f40f4[SelfDestruct]:::removed -.-> c8fe60c23c83e6cd6ee1d37a09aae7817442955ae9[SelfDestructMachine]:::removed 142 | c8fe60c23c83e6cd6ee1d37a09aae7817442955ae9[SelfDestructMachine]:::removed -.-> c8002c432c94c2e0e09f351fea6d7f8cb3ff80ec02[Role]:::removed 143 | c8002c432c94c2e0e09f351fea6d7f8cb3ff80ec02[Role]:::removed -.-> c8b6d9c32e6e8f6d58409c22a534a5ef32ed27176b[ImportRole]:::removed 144 | c8002c432c94c2e0e09f351fea6d7f8cb3ff80ec02[Role]:::removed -.-> c88c6cd7a05fe3b7396108ec3f88cd5fbf7730c136[Resource - AWS::IAM::Role]:::removed 145 | c8002c432c94c2e0e09f351fea6d7f8cb3ff80ec02[Role]:::removed -.-> c8a8ce9c4d3865b51b270180fa5846e1c3a252fe0c[DefaultPolicy]:::removed 146 | c8a8ce9c4d3865b51b270180fa5846e1c3a252fe0c[DefaultPolicy]:::removed -.-> c830b859fe2e2dea0721b3388bcec3fac11ddab872[Resource - AWS::IAM::Policy]:::removed 147 | c8fe60c23c83e6cd6ee1d37a09aae7817442955ae9[SelfDestructMachine]:::removed -.-> c80104d15a7ecfc895dd98ee2c866768992ec6a870[Resource - AWS::StepFunctions::StateMachine]:::removed 148 | c80bdb3872d8c7655592d6042091bd6bb0aa9f40f4[SelfDestruct]:::removed -.-> c8575d0458d21c8fea49633c729a358128092ba410[SelfDestructCR]:::removed 149 | c8575d0458d21c8fea49633c729a358128092ba410[SelfDestructCR]:::removed -.-> c81e3fffd4c437992d8e78e281d2489f1ff73f5fff[Provider]:::removed 150 | c8575d0458d21c8fea49633c729a358128092ba410[SelfDestructCR]:::removed -.-> c82c02b731af8dea2951da20888358befbd8d8eca2[Resource]:::removed 151 | c82c02b731af8dea2951da20888358befbd8d8eca2[Resource]:::removed -.-> c82c02b731af8dea2951da20888358befbd8d8eca2[Default - Custom::AWS]:::removed 152 | c8575d0458d21c8fea49633c729a358128092ba410[SelfDestructCR]:::removed -.-> c8cfe92699de1a8a27974fe012e203e319c20bb37a[CustomResourcePolicy]:::removed 153 | c8cfe92699de1a8a27974fe012e203e319c20bb37a[CustomResourcePolicy]:::removed -.-> c8f187abde978119067409732a39405cf88f8ab096[Resource - AWS::IAM::Policy]:::removed 154 | classDef default fill:#fff,stroke:#000,color:black; 155 | classDef added fill:#cfc,stroke:#cfc,stroke-width:2px,color:black; 156 | classDef removed fill:#fcc,stroke:#fcc,stroke-width:2px,color:black; 157 | ``` 158 | -------------------------------------------------------------------------------- /jest.config.ts: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | collectCoverage: true, 3 | globals: { 4 | 'ts-jest': { 5 | tsconfig: 'tsconfig.dev.json', 6 | }, 7 | }, 8 | roots: ['/test'], 9 | testEnvironment: 'node', 10 | testMatch: ['**/*.test.ts'], 11 | transform: { 12 | '^.+\\.tsx?$': 'ts-jest', 13 | }, 14 | setupFiles: ['./test/jest.setup.ts'] 15 | }; 16 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@aws-community/arch-dia", 3 | "author": { 4 | "email": "matt.martz@gmail.com", 5 | "name": "Matt Martz", 6 | "url": "https://matt.martz.codes" 7 | }, 8 | "description": "This CDK Aspect will generate a diagram of your CDK application's architecture.", 9 | "repository": { 10 | "type": "git", 11 | "url": "https://github.com/aws-community-projects/arch-dia" 12 | }, 13 | "keywords": [ 14 | "aws", 15 | "awscdk", 16 | "cdk", 17 | "architecture", 18 | "diagram" 19 | ], 20 | "license": "Apache-2.0", 21 | "version": "1.1.2", 22 | "main": "lib/index.js", 23 | "types": "lib/index.d.ts", 24 | "scripts": { 25 | "build": "jsii", 26 | "build:watch": "jsii --watch", 27 | "clean": "rimraf cdk.out dist lib", 28 | "integ": "tsc --build tsconfig.dev.json && integ-runner", 29 | "lint": "eslint --ext .ts --fix src test", 30 | "package": "jsii-pacmak", 31 | "prebuild": "npm run clean", 32 | "prebuild:watch": "npm run clean", 33 | "prepackage": "npm run build", 34 | "pretest": "npm run lint", 35 | "test": "jest" 36 | }, 37 | "devDependencies": { 38 | "@aws-cdk/integ-runner": "^2.78.0-alpha.0", 39 | "@aws-cdk/integ-tests-alpha": "^2.78.0-alpha.0", 40 | "@types/jest": "^27.5.2", 41 | "@types/node": "^18.11.0", 42 | "@typescript-eslint/eslint-plugin": "^5.40.0", 43 | "@typescript-eslint/parser": "^5.40.0", 44 | "aws-cdk-lib": "2.78.0", 45 | "constructs": "10.2.17", 46 | "eslint": "^8.25.0", 47 | "eslint-config-standard-with-typescript": "^23.0.0", 48 | "jest": "^27.5.1", 49 | "jsii": "^5.0.7", 50 | "jsii-pacmak": "^1.80.0", 51 | "rimraf": "^3.0.2", 52 | "ts-jest": "^27.1.4", 53 | "ts-node": "^10.9.1", 54 | "typescript": "^4.8.4" 55 | }, 56 | "peerDependencies": { 57 | "aws-cdk-lib": "2.78.0", 58 | "constructs": "10.2.17" 59 | }, 60 | "jsii": { 61 | "outdir": "dist", 62 | "versionFormat": "full", 63 | "targets": {}, 64 | "tsc": { 65 | "outDir": "lib", 66 | "rootDir": "src" 67 | } 68 | } 69 | } -------------------------------------------------------------------------------- /src/architecture-diagram.ts: -------------------------------------------------------------------------------- 1 | import { CfnResource, IAspect, Stack } from 'aws-cdk-lib'; 2 | import { IConstruct } from 'constructs'; 3 | import { readFile, writeFile } from './fs-utils'; 4 | 5 | export class ArchitectureDiagramAspect implements IAspect { 6 | private readonly mermaidDiagram: string[]; 7 | private stackName = ''; 8 | 9 | constructor () { 10 | this.mermaidDiagram = []; 11 | } 12 | 13 | visit (node: IConstruct): void { 14 | if (node instanceof Stack) { 15 | this.stackName = node.stackName; 16 | this.traverseConstruct(node, ''); 17 | } 18 | } 19 | 20 | private traverseConstruct (construct: IConstruct, parentPath: string): void { 21 | const parentSplit = parentPath.split(' --> '); 22 | const currentParent = parentSplit[parentSplit.length - 1]; 23 | const currentPath = `${currentParent}${currentParent ? ' --> ' : ''}${ 24 | construct.node.addr 25 | }[${construct.node.id.replace(/{|}/g, '')}${ 26 | CfnResource.isCfnResource(construct) 27 | ? ` - ${construct.cfnResourceType}` 28 | : '' 29 | }]`; 30 | this.mermaidDiagram.push(`${currentPath}`); 31 | 32 | construct.node.children.forEach((child) => { 33 | this.traverseConstruct(child, currentPath); 34 | }); 35 | } 36 | 37 | generateDiagram (): string { 38 | // Return the generated Mermaid diagram as part of a Markdown document 39 | // write the mermaid diagram to a file 40 | let last: string[] = []; 41 | try { 42 | last = readFile(`${this.stackName}.md`) 43 | .toString() 44 | .split('\n') 45 | .filter((row) => !row.includes('classDef')) // class definitions added separately 46 | .filter((row) => !row.includes('graph LR;')) // graph definition added separately 47 | .filter((row) => !row.includes('-.->')) // dotted lines mean they were removed the time before, normalize 48 | .map((row) => row.replace('==>', '-->')) // double lines mean they were added, normalize 49 | .map((row) => row.replace(/:::(added|removed)/g, '')); // remove classes (will be added back later, if needed) 50 | } catch (e) { 51 | // noop 52 | } 53 | const mermaidIndex = last.indexOf('```mermaid'); 54 | let old: string[] = []; 55 | if (mermaidIndex > -1) { 56 | old = last.splice(mermaidIndex + 1, last.length - mermaidIndex); 57 | old = old.splice(0, old.indexOf('```')); 58 | } 59 | const oldElements = old.reduce((p, c) => { 60 | c.split(' --> ') 61 | .map((row) => row.trim()) 62 | .forEach((e) => p.add(e.split(':::')[0])); 63 | return p; 64 | }, new Set()); 65 | const newElements = this.mermaidDiagram.reduce((p, c) => { 66 | c.split(' --> ') 67 | .map((row) => row.trim()) 68 | .forEach((e) => p.add(e.split(':::')[0])); 69 | return p; 70 | }, new Set()); 71 | const addedElements = [...newElements].filter((e) => !oldElements.has(e)); 72 | const removedElements = [...oldElements].filter((e) => !newElements.has(e)); 73 | const added = this.mermaidDiagram.filter((line) => !old.includes(line)); 74 | const removed = old.filter((line) => !this.mermaidDiagram.includes(line)); 75 | const neutral = this.mermaidDiagram.filter( 76 | (line) => !added.includes(line) && !removed.includes(line), 77 | ); 78 | 79 | const mapChanges = (row: string, arrow: string): string => { 80 | const splitRow = row.split(/(--|==|-\.-)>/).map((row) => row.trim()); 81 | if (splitRow.length !== 3) { 82 | return row; 83 | } 84 | let outputRow = ''; 85 | if (addedElements.includes(splitRow[0])) { 86 | outputRow = `${splitRow[0]}:::added`; 87 | } else if (removedElements.includes(splitRow[0])) { 88 | outputRow = `${splitRow[0]}:::removed`; 89 | } else { 90 | outputRow = splitRow[0]; 91 | } 92 | outputRow += ` ${arrow} `; 93 | if (addedElements.includes(splitRow[2])) { 94 | outputRow += `${splitRow[2]}:::added`; 95 | } else if (removedElements.includes(splitRow[2])) { 96 | outputRow += `${splitRow[2]}:::removed`; 97 | } else { 98 | // ignoring this because I don't think it would ever happen in practice 99 | // in this scenario a link to an existing element is being added or removed 100 | /* istanbul ignore next */ 101 | outputRow += splitRow[2]; 102 | } 103 | return outputRow; 104 | }; 105 | 106 | const combined = [ 107 | 'graph LR;', 108 | ...neutral, // elements and connections existed before 109 | ...added.map((row) => mapChanges(row, '==>')), 110 | ...removed.map((row) => mapChanges(row, '-.->')), 111 | ...[ 112 | 'classDef default fill:#fff,stroke:#000,color:black;', 113 | 'classDef added fill:#cfc,stroke:#cfc,stroke-width:2px,color:black;', 114 | 'classDef removed fill:#fcc,stroke:#fcc,stroke-width:2px,color:black;', 115 | ], 116 | ]; 117 | 118 | const markdown = [ 119 | `# ${this.stackName}`, 120 | '', 121 | '```mermaid', 122 | ...combined, 123 | '```', 124 | '', 125 | ].join('\n'); 126 | writeFile(`${this.stackName}.md`, markdown); 127 | 128 | return markdown; 129 | } 130 | } 131 | -------------------------------------------------------------------------------- /src/fs-utils.ts: -------------------------------------------------------------------------------- 1 | import * as fs from 'fs'; 2 | 3 | function writeFile (file: string, val: string): void { 4 | fs.writeFileSync(file, val); 5 | } 6 | 7 | function readFile (file: string): string { 8 | return fs.readFileSync(file, 'utf8'); 9 | } 10 | 11 | export { writeFile, readFile }; 12 | -------------------------------------------------------------------------------- /src/index.ts: -------------------------------------------------------------------------------- 1 | export * from './architecture-diagram'; 2 | -------------------------------------------------------------------------------- /test/__snapshots__/arch-dia.test.ts.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`ArchitectureDiagramAspect Add Queue to Stack 1`] = ` 4 | "# MyTestStack 5 | 6 | \`\`\`mermaid 7 | graph LR; 8 | c814b2c5dc22d11a84e78a63be7bb7815715b70534[MyTestStack] 9 | c814b2c5dc22d11a84e78a63be7bb7815715b70534[MyTestStack] ==> c8a33fea56cf1bd6e8b5c652f393a6d315e7a78836[MyQueue]:::added 10 | c8a33fea56cf1bd6e8b5c652f393a6d315e7a78836[MyQueue]:::added ==> c80cb3f181e7dbb6726caf602717b2585dabff5aff[Resource - AWS::SQS::Queue]:::added 11 | classDef default fill:#fff,stroke:#000,color:black; 12 | classDef added fill:#cfc,stroke:#cfc,stroke-width:2px,color:black; 13 | classDef removed fill:#fcc,stroke:#fcc,stroke-width:2px,color:black; 14 | \`\`\` 15 | " 16 | `; 17 | 18 | exports[`ArchitectureDiagramAspect Basic Stack 1`] = ` 19 | "# MyTestStack 20 | 21 | \`\`\`mermaid 22 | graph LR; 23 | c814b2c5dc22d11a84e78a63be7bb7815715b70534[MyTestStack] 24 | classDef default fill:#fff,stroke:#000,color:black; 25 | classDef added fill:#cfc,stroke:#cfc,stroke-width:2px,color:black; 26 | classDef removed fill:#fcc,stroke:#fcc,stroke-width:2px,color:black; 27 | \`\`\` 28 | " 29 | `; 30 | 31 | exports[`ArchitectureDiagramAspect Normalize after addition 1`] = ` 32 | "# MyTestStack 33 | 34 | \`\`\`mermaid 35 | graph LR; 36 | c814b2c5dc22d11a84e78a63be7bb7815715b70534[MyTestStack] 37 | c814b2c5dc22d11a84e78a63be7bb7815715b70534[MyTestStack] --> c8a33fea56cf1bd6e8b5c652f393a6d315e7a78836[MyQueue] 38 | c8a33fea56cf1bd6e8b5c652f393a6d315e7a78836[MyQueue] --> c80cb3f181e7dbb6726caf602717b2585dabff5aff[Resource - AWS::SQS::Queue] 39 | classDef default fill:#fff,stroke:#000,color:black; 40 | classDef added fill:#cfc,stroke:#cfc,stroke-width:2px,color:black; 41 | classDef removed fill:#fcc,stroke:#fcc,stroke-width:2px,color:black; 42 | \`\`\` 43 | " 44 | `; 45 | 46 | exports[`ArchitectureDiagramAspect Normalize after removal from Stack 1`] = ` 47 | "# MyTestStack 48 | 49 | \`\`\`mermaid 50 | graph LR; 51 | c814b2c5dc22d11a84e78a63be7bb7815715b70534[MyTestStack] 52 | classDef default fill:#fff,stroke:#000,color:black; 53 | classDef added fill:#cfc,stroke:#cfc,stroke-width:2px,color:black; 54 | classDef removed fill:#fcc,stroke:#fcc,stroke-width:2px,color:black; 55 | \`\`\` 56 | " 57 | `; 58 | 59 | exports[`ArchitectureDiagramAspect Remove Queue from Stack 1`] = ` 60 | "# MyTestStack 61 | 62 | \`\`\`mermaid 63 | graph LR; 64 | c814b2c5dc22d11a84e78a63be7bb7815715b70534[MyTestStack] 65 | c814b2c5dc22d11a84e78a63be7bb7815715b70534[MyTestStack] -.-> c8a33fea56cf1bd6e8b5c652f393a6d315e7a78836[MyQueue]:::removed 66 | c8a33fea56cf1bd6e8b5c652f393a6d315e7a78836[MyQueue]:::removed -.-> c80cb3f181e7dbb6726caf602717b2585dabff5aff[Resource - AWS::SQS::Queue]:::removed 67 | classDef default fill:#fff,stroke:#000,color:black; 68 | classDef added fill:#cfc,stroke:#cfc,stroke-width:2px,color:black; 69 | classDef removed fill:#fcc,stroke:#fcc,stroke-width:2px,color:black; 70 | \`\`\` 71 | " 72 | `; 73 | -------------------------------------------------------------------------------- /test/arch-dia.test.ts: -------------------------------------------------------------------------------- 1 | import { App, Aspects, Stack } from 'aws-cdk-lib'; 2 | import { Queue } from 'aws-cdk-lib/aws-sqs'; 3 | 4 | const writeFile = jest.fn(); 5 | const readFile = jest.fn(); 6 | jest.mock('../src/fs-utils', () => ({ 7 | readFile, 8 | writeFile, 9 | })); 10 | 11 | // eslint-disable-next-line import/first 12 | import { ArchitectureDiagramAspect } from '../src'; 13 | 14 | describe('ArchitectureDiagramAspect', () => { 15 | beforeEach(() => { 16 | jest.resetAllMocks(); 17 | }); 18 | test('Basic Stack', () => { 19 | readFile.mockReturnValueOnce(''); // mock empty file 20 | const app = new App(); 21 | const stack = new Stack(app, 'MyTestStack'); 22 | const archDiagramAspect = new ArchitectureDiagramAspect(); 23 | archDiagramAspect.visit(stack); 24 | 25 | const dia = archDiagramAspect.generateDiagram(); 26 | 27 | expect(dia).toMatchSnapshot(); 28 | expect(readFile).toHaveBeenCalledTimes(1); 29 | expect(writeFile).toHaveBeenCalledTimes(1); 30 | }); 31 | 32 | test('Add Queue to Stack', () => { 33 | readFile.mockReturnValueOnce(''); // mock empty file 34 | const initialApp = new App(); 35 | const initialStack = new Stack(initialApp, 'MyTestStack'); 36 | const initialAspect = new ArchitectureDiagramAspect(); 37 | initialAspect.visit(initialStack); 38 | const initialDiagram = initialAspect.generateDiagram(); 39 | readFile.mockReturnValueOnce(initialDiagram); 40 | const updatedApp = new App(); 41 | const updatedStack = new Stack(updatedApp, 'MyTestStack'); 42 | const updatedAspect = new ArchitectureDiagramAspect(); 43 | new Queue(updatedStack, 'MyQueue'); 44 | updatedAspect.visit(updatedStack); 45 | const updatedDiagram = updatedAspect.generateDiagram(); 46 | expect(updatedDiagram).toMatchSnapshot(); 47 | 48 | expect(writeFile).toHaveBeenCalledTimes(2); 49 | }); 50 | 51 | test('Normalize after addition', () => { 52 | readFile.mockReturnValueOnce(''); // mock empty file 53 | const initialApp = new App(); 54 | const initialStack = new Stack(initialApp, 'MyTestStack'); 55 | const initialAspect = new ArchitectureDiagramAspect(); 56 | initialAspect.visit(initialStack); 57 | const initialDiagram = initialAspect.generateDiagram(); 58 | readFile.mockReturnValueOnce(initialDiagram); 59 | const updatedApp = new App(); 60 | const updatedStack = new Stack(updatedApp, 'MyTestStack'); 61 | const updatedAspect = new ArchitectureDiagramAspect(); 62 | new Queue(updatedStack, 'MyQueue'); 63 | updatedAspect.visit(updatedStack); 64 | const updatedDiagram = updatedAspect.generateDiagram(); 65 | readFile.mockReturnValueOnce(updatedDiagram); 66 | expect(updatedAspect.generateDiagram()).toMatchSnapshot(); 67 | 68 | expect(writeFile).toHaveBeenCalledTimes(3); 69 | }); 70 | 71 | test('Remove Queue from Stack', () => { 72 | readFile.mockReturnValueOnce(''); // mock empty file 73 | const initialApp = new App(); 74 | const initialStack = new Stack(initialApp, 'MyTestStack'); 75 | const initialAspect = new ArchitectureDiagramAspect(); 76 | new Queue(initialStack, 'MyQueue'); 77 | initialAspect.visit(initialStack); 78 | const initialDiagram = initialAspect.generateDiagram(); 79 | readFile.mockReturnValueOnce(initialDiagram); 80 | const updatedApp = new App(); 81 | const updatedStack = new Stack(updatedApp, 'MyTestStack'); 82 | const updatedAspect = new ArchitectureDiagramAspect(); 83 | updatedAspect.visit(updatedStack); 84 | const updatedDiagram = updatedAspect.generateDiagram(); 85 | expect(updatedDiagram).toMatchSnapshot(); 86 | 87 | expect(writeFile).toHaveBeenCalledTimes(2); 88 | }); 89 | 90 | test('Normalize after removal from Stack', () => { 91 | readFile.mockReturnValueOnce(''); // mock empty file 92 | const initialApp = new App(); 93 | const initialStack = new Stack(initialApp, 'MyTestStack'); 94 | const initialAspect = new ArchitectureDiagramAspect(); 95 | new Queue(initialStack, 'MyQueue'); 96 | initialAspect.visit(initialStack); 97 | const initialDiagram = initialAspect.generateDiagram(); 98 | readFile.mockReturnValueOnce(initialDiagram); 99 | const updatedApp = new App(); 100 | const updatedStack = new Stack(updatedApp, 'MyTestStack'); 101 | const updatedAspect = new ArchitectureDiagramAspect(); 102 | updatedAspect.visit(updatedStack); 103 | const updatedDiagram = updatedAspect.generateDiagram(); 104 | readFile.mockReturnValueOnce(updatedDiagram); 105 | expect(updatedAspect.generateDiagram()).toMatchSnapshot(); 106 | 107 | expect(writeFile).toHaveBeenCalledTimes(3); 108 | }); 109 | }); 110 | -------------------------------------------------------------------------------- /test/jest.setup.ts: -------------------------------------------------------------------------------- 1 | const now = Date.now(); 2 | jest.spyOn(Date, 'now').mockImplementation(() => now).mockReturnValue(42); 3 | -------------------------------------------------------------------------------- /tsconfig.dev.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES2018", 4 | "module": "commonjs", 5 | "lib": [ 6 | "es2018" 7 | ], 8 | "declaration": true, 9 | "strict": true, 10 | "noImplicitAny": true, 11 | "strictNullChecks": true, 12 | "noImplicitThis": true, 13 | "alwaysStrict": true, 14 | "noUnusedLocals": false, 15 | "noUnusedParameters": false, 16 | "noImplicitReturns": true, 17 | "noFallthroughCasesInSwitch": false, 18 | "inlineSourceMap": true, 19 | "inlineSources": true, 20 | "experimentalDecorators": true, 21 | "strictPropertyInitialization": false, 22 | "typeRoots": [ 23 | "./node_modules/@types" 24 | ] 25 | }, 26 | "include": [ 27 | "lib", 28 | "test" 29 | ], 30 | "exclude": [ 31 | "node_modules" 32 | ] 33 | } --------------------------------------------------------------------------------