Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions packages/aws-cdk/bin/cdk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ import cxapi = require('@aws-cdk/cx-api');
import childProcess = require('child_process');
import colors = require('colors/safe');
import fs = require('fs-extra');
import YAML = require('js-yaml');
import minimatch = require('minimatch');
import os = require('os');
import path = require('path');
import util = require('util');
import YAML = require('yamljs');
import yargs = require('yargs');
import cdkUtil = require('../lib/util');

Expand Down Expand Up @@ -676,7 +676,7 @@ async function initCommandLine() {
/* Attempt to parse YAML, fall back to JSON. */
function parseTemplate(text: string): any {
try {
return YAML.parse(text);
return YAML.safeLoad(text);
} catch (e) {
return JSON.parse(text);
}
Expand Down Expand Up @@ -785,7 +785,7 @@ async function initCommandLine() {
} else {
const inlineJsonAfterDepth = 16;
const indentWidth = 4;
return YAML.stringify(object, inlineJsonAfterDepth, indentWidth);
return YAML.safeDump(object, { indent: indentWidth, flowLevel: inlineJsonAfterDepth });
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions packages/aws-cdk/lib/api/deploy-stack.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import cxapi = require('@aws-cdk/cx-api');
import aws = require('aws-sdk');
import colors = require('colors/safe');
import YAML = require('js-yaml');
import uuid = require('uuid');
import YAML = require('yamljs');
import { prepareAssets } from '../assets';
import { debug, error } from '../logging';
import { Mode } from './aws-auth/credentials';
Expand Down Expand Up @@ -94,7 +94,7 @@ async function getStackOutputs(cfn: aws.CloudFormation, stackName: string): Prom
* @param toolkitInfo information about the toolkit stack
*/
async function makeBodyParameter(stack: cxapi.SynthesizedStack, toolkitInfo?: ToolkitInfo): Promise<TemplateBodyParameter> {
const templateJson = YAML.stringify(stack.template, 16, 4);
const templateJson = YAML.safeDump(stack.template, { indent: 4, flowLevel: 16 });
if (toolkitInfo) {
const s3KeyPrefix = `cdk/${stack.name}/`;
const s3KeySuffix = '.yml';
Expand Down
4 changes: 2 additions & 2 deletions packages/aws-cdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"@types/mockery": "^1.4.29",
"@types/request": "^2.47.1",
"@types/uuid": "^3.4.3",
"@types/yamljs": "^0.2.0",
"@types/js-yaml": "^3.11.2",
"@types/yargs": "^8.0.3",
"cdk-build-tools": "^0.10.0",
"mockery": "^2.1.0",
Expand All @@ -58,7 +58,7 @@
"proxy-agent": "^3.0.1",
"request": "^2.83.0",
"source-map-support": "^0.5.6",
"yamljs": "^0.2.0",
"js-yaml": "^3.12.0",
"yargs": "^9.0.1"
},
"repository": {
Expand Down