Skip to content

Commit

Permalink
CDKv2
Browse files Browse the repository at this point in the history
  • Loading branch information
iann0036 committed Apr 30, 2022
1 parent 9bcf4a3 commit 907cf90
Show file tree
Hide file tree
Showing 5 changed files with 350 additions and 4 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ The following outputs are currently supported:
* CloudFormation
* Terraform
* Troposphere
* CDK (Cfn Primitives) - TypeScript, Python, Java, C#
* CDK V1 (Cfn Primitives) - TypeScript, Python, Java, C#
* CDK V2 (Cfn Primitives) - TypeScript, Python, Java, C#
* CDK for Terraform - TypeScript
* Pulumi - TypeScript
* Diagram - embedded version of [draw.io](https://github.com/jgraph/drawio)
Expand Down
1 change: 1 addition & 0 deletions cli/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ async function main(opts) {
}

outputMapCdk = function(){};
outputMapCdkv2 = function(){};
outputMapTroposphere = function(){};
outputMapPulumi = function(){};
outputMapCdktf = function(){};
Expand Down
15 changes: 12 additions & 3 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,8 @@
<li><a href="#section-outputs-cloudformation"><span class="lbl">CloudFormation</span></a></li>
<li><a href="#section-outputs-tf"><span class="lbl">Terraform</span></a></li>
<li><a href="#section-outputs-troposphere"><span class="lbl">Troposphere</span></a></li>
<li><a href="#section-outputs-cdk"><span class="lbl">CDK</span></a></li>
<li><a href="#section-outputs-cdk"><span class="lbl">CDK (V1)</span></a></li>
<li><a href="#section-outputs-cdkv2"><span class="lbl">CDK (V2)</span></a></li>
<li><a href="#section-outputs-cdktf"><span class="lbl">CDK (Terraform)</span></a></li>
<li><a href="#section-outputs-pulumi"><span class="lbl">Pulumi</span></a></li>
<li><a href="#section-outputs-diagram"><span class="lbl">Diagram</span></a></li>
Expand Down Expand Up @@ -649,6 +650,7 @@ <h3 id="header-title"></h3>
<button id="header-button-copy-tf" type="button" class="f2-header-button btn btn-default-outline" style="display: none;"><i class="fa fa-files-o"></i>&nbsp;&nbsp;Copy</button>
<button id="header-button-copy-troposphere" type="button" class="f2-header-button btn btn-default-outline" style="display: none;"><i class="fa fa-files-o"></i>&nbsp;&nbsp;Copy</button>
<button id="header-button-copy-cdk" type="button" class="f2-header-button btn btn-default-outline" style="display: none;"><i class="fa fa-files-o"></i>&nbsp;&nbsp;Copy</button>
<button id="header-button-copy-cdkv2" type="button" class="f2-header-button btn btn-default-outline" style="display: none;"><i class="fa fa-files-o"></i>&nbsp;&nbsp;Copy</button>
<button id="header-button-copy-cdktf" type="button" class="f2-header-button btn btn-default-outline" style="display: none;"><i class="fa fa-files-o"></i>&nbsp;&nbsp;Copy</button>
<button id="header-button-copy-pulumi" type="button" class="f2-header-button btn btn-default-outline" style="display: none;"><i class="fa fa-files-o"></i>&nbsp;&nbsp;Copy</button>
<button id="header-button-copy-raw" type="button" class="f2-header-button btn btn-default-outline" style="display: none;"><i class="fa fa-files-o"></i>&nbsp;&nbsp;Copy</button>
Expand Down Expand Up @@ -1372,7 +1374,8 @@ <h5>Default Output</h5>
<option value="cloudformation">CloudFormation</option>
<option value="tf">Terraform</option>
<option value="troposphere">Troposphere</option>
<option value="cdk">CDK</option>
<option value="cdk">CDK (V1)</option>
<option value="cdkv2">CDK (V2)</option>
<option value="cdktf">CDK (Terraform)</option>
<option value="pulumi">Pulumi</option>
<option value="diagram">Diagram</option>
Expand Down Expand Up @@ -1532,12 +1535,18 @@ <h5>Default Resources</h5>
</div>
</section>

<section id="section-outputs-cdk" data-section-breadcrumb1-title="Outputs" data-section-breadcrumb1-link="#section-outputs-cloudformation" data-section-title="CDK" class="former2-section box-typical steps-numeric-block" style="display: none;">
<section id="section-outputs-cdk" data-section-breadcrumb1-title="Outputs" data-section-breadcrumb1-link="#section-outputs-cloudformation" data-section-title="CDK (V1)" class="former2-section box-typical steps-numeric-block" style="display: none;">
<div id='cdk_container'>
<textarea id='cdk'></textarea>
</div>
</section>

<section id="section-outputs-cdkv2" data-section-breadcrumb1-title="Outputs" data-section-breadcrumb1-link="#section-outputs-cloudformation" data-section-title="CDK (V2)" data-section-label="Beta" class="former2-section box-typical steps-numeric-block" style="display: none;">
<div id='cdkv2_container'>
<textarea id='cdkv2'></textarea>
</div>
</section>

<section id="section-outputs-cdktf" data-section-breadcrumb1-title="Outputs" data-section-breadcrumb1-link="#section-outputs-cloudformation" data-section-title="CDK (Terraform)" data-section-label="Beta" class="former2-section box-typical steps-numeric-block" style="display: none;">
<div id='cdktf_container'>
<textarea id='cdktf'></textarea>
Expand Down
33 changes: 33 additions & 0 deletions js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -701,6 +701,7 @@ $(document).ready(function(){
$('#header-button-copy-tf').attr('style', 'display: none;');
$('#header-button-copy-troposphere').attr('style', 'display: none;');
$('#header-button-copy-cdk').attr('style', 'display: none;');
$('#header-button-copy-cdkv2').attr('style', 'display: none;');
$('#header-button-copy-cdktf').attr('style', 'display: none;');
$('#header-button-copy-pulumi').attr('style', 'display: none;');
$('#header-button-copy-raw').attr('style', 'display: none;');
Expand Down Expand Up @@ -791,6 +792,18 @@ $(document).ready(function(){
theme: "material"
});
}, 1);
} else if (location.hash == "#section-outputs-cdkv2") {
$('#header-button-copy-cdkv2').attr('style', '');
$('#header-button-clear-outputs').attr('style', 'margin-left: 16px;');

setTimeout(function(){
cdkv2_editor.refresh();
tippy('.f2replacementmarker', {
content: "Value requires replacement",
placement: "right",
theme: "material"
});
}, 1);
} else if (location.hash == "#section-outputs-cdktf") {
$('#header-button-copy-cdktf').attr('style', '');
$('#header-button-clear-outputs').attr('style', 'margin-left: 16px;');
Expand Down Expand Up @@ -895,6 +908,7 @@ $(document).ready(function(){
tf_editor.getDoc().setValue(mapped_outputs['tf']);
troposphere_editor.getDoc().setValue(mapped_outputs['troposphere']);
cdk_editor.getDoc().setValue(mapped_outputs['cdk']);
cdkv2_editor.getDoc().setValue(mapped_outputs['cdkv2']);
cdktf_editor.getDoc().setValue(mapped_outputs['cdktf']);
pulumi_editor.getDoc().setValue(mapped_outputs['pulumi']);
raw_editor.getDoc().setValue(JSON.stringify(output_objects, null, 4));
Expand All @@ -905,6 +919,7 @@ $(document).ready(function(){
{key: 'tf', editor: tf_editor},
{key: 'troposphere', editor: troposphere_editor},
{key: 'cdk', editor: cdk_editor},
{key: 'cdkv2', editor: cdkv2_editor},
{key: 'cdktf', editor: cdktf_editor},
{key: 'pulumi', editor: pulumi_editor}
].forEach(language => {
Expand All @@ -921,6 +936,7 @@ $(document).ready(function(){
tf_editor.refresh();
troposphere_editor.refresh();
cdk_editor.refresh();
cdkv2_editor.refresh();
cdktf_editor.refresh();
pulumi_editor.refresh();
raw_editor.refresh();
Expand Down Expand Up @@ -1082,6 +1098,19 @@ $(document).ready(function(){
});
setCopyEvent('#header-button-copy-cdk', cdk_editor);

cdkv2_editor = CodeMirror.fromTextArea(document.getElementById('cdkv2'), {
lineNumbers: true,
gutters: ["f2gutter", "CodeMirror-linenumbers"],
lineWrapping: true,
mode: "javascript",
theme: "material",
indentUnit: 4,
height: "auto",
viewportMargin: Infinity,
scrollbarStyle: "null"
});
setCopyEvent('#header-button-copy-cdkv2', cdkv2_editor);

cdktf_editor = CodeMirror.fromTextArea(document.getElementById('cdktf'), {
lineNumbers: true,
gutters: ["f2gutter", "CodeMirror-linenumbers"],
Expand Down Expand Up @@ -1511,15 +1540,19 @@ $(document).ready(function(){

if ($(this).val() == "typescript") {
cdk_editor.setOption("mode", "javascript");
cdkv2_editor.setOption("mode", "javascript");
cdktf_editor.setOption("mode", "javascript");
} else if ($(this).val() == "java") {
cdk_editor.setOption("mode", "text/x-java");
cdkv2_editor.setOption("mode", "text/x-java");
cdktf_editor.setOption("mode", "text/x-java");
} else if ($(this).val() == "dotnet") {
cdk_editor.setOption("mode", "text/x-csrc");
cdkv2_editor.setOption("mode", "text/x-csrc");
cdktf_editor.setOption("mode", "text/x-csrc");
} else {
cdk_editor.setOption("mode", $(this).val());
cdkv2_editor.setOption("mode", $(this).val());
cdktf_editor.setOption("mode", $(this).val());
}
});
Expand Down
Loading

0 comments on commit 907cf90

Please sign in to comment.