Aws-cdk: cdk --help has issues

Created on 12 Jun 2019  路  10Comments  路  Source: aws/aws-cdk

It still states:

--json, -j Use JSON output instead of YAML
[boolean] [default: false]

Which makes no sense as it output JSON anyway. We need a -y (YAML) flag for those who want YAML

It also states:

--app, -a REQUIRED: command-line for executing your app or a cloud
assembly directory (e.g. "node bin/my-app.js") [string]

Which is also incorrect. The example should be "npx ts-node bin/my-app.ts"

Version:

  • Windows
  • TypeScript
  • 0.34.0
@aws-cdcore bug packagtools

Most helpful comment

since 0.34, the yaml seems to be output to console (even when --output is specified) and the output folder always contains json. Previously if --output was specified no stacks were output in console. These are both problems - I would much prefer yaml file outputs, and I don't want to spam my console with stacks everytime I synth.

All 10 comments

Which makes no sense as it output JSON anyway. We need a -y (YAML) flag for those who want YAML

Is that true? I was under the impression we were outputting YAML.

Which is also incorrect. The example should be "npx ts-node bin/my-app.ts"

What it should be is discutable. At the very least it's incorrect to say that the example is incorrect. It's a matter of workflow, preference and tooling.

  • The quoted example is correct for JavaScript apps and some TypeScript workflows.
  • Your example is only correct for some TypeScript workflows.
  • Neither the given nor your example would be correct if the application was a Java app, for example.

Any ideas on how to set yaml output? Just updated to 0.34.0 and there seems to be no way to use yaml output anymore (already mentioned by @Doug-AWS). Is there a possibility to workaround this issue?

Sorry, I was completely wrong. The cdk commands output YAML by default and you need only use the -j flag to get JSON.

I'm getting Json output only in 0.34.0. No chance to switch to yaml.

Really? Here's the first 4 lines of cdk synth for the code created in the https://docs.aws.amazon.com/cdk/latest/guide/ecs_example.html:

Resources: MyVpcF9F0CA6F: Type: AWS::EC2::VPC Properties:

And with the -j flag:

{ "Resources": { "MyVpcF9F0CA6F": { "Type": "AWS::EC2::VPC",

Yes, console output is YML but looking into folder cdk.out only contains json files (./cdk.out/TestStack.template.json).

Excellent point. @rix0rrr?

since 0.34, the yaml seems to be output to console (even when --output is specified) and the output folder always contains json. Previously if --output was specified no stacks were output in console. These are both problems - I would much prefer yaml file outputs, and I don't want to spam my console with stacks everytime I synth.

cdk.out should be treated as a CLI-internal directory, and should not be treated as the final output directory.

I'm going to close this issue as the title no longer covers its contents. Please use #2965 to discuss the output of YAML/JSON to output directories.

Was this page helpful?
0 / 5 - 0 ratings