From e790db558ce02cc50328b219b8826b6adfb3f850 Mon Sep 17 00:00:00 2001 From: Romain Marcadier-Muller Date: Wed, 17 Oct 2018 10:10:54 +0200 Subject: [PATCH] chore(applet-js): Switch to JS-YAML for consistency (#950) Switch to JS-YAML, in order to use the same library than the CDK Toolkit. --- packages/@aws-cdk/applet-js/bin/cdk-applet-js.ts | 5 +++-- packages/@aws-cdk/applet-js/package.json | 7 +++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/packages/@aws-cdk/applet-js/bin/cdk-applet-js.ts b/packages/@aws-cdk/applet-js/bin/cdk-applet-js.ts index d1c1704fd7bed..98a0fe4efdabe 100644 --- a/packages/@aws-cdk/applet-js/bin/cdk-applet-js.ts +++ b/packages/@aws-cdk/applet-js/bin/cdk-applet-js.ts @@ -2,10 +2,11 @@ import 'source-map-support/register'; import cdk = require('@aws-cdk/cdk'); +import fs = require('fs-extra'); import path = require('path'); // tslint:disable-next-line:no-var-requires -const YAML = require('yamljs'); +const YAML = require('js-yaml'); main().catch(e => { // tslint:disable-next-line:no-console @@ -22,7 +23,7 @@ async function main() { } // read applet properties from the provided file - const props = YAML.load(appletFile); + const props = YAML.safeLoad(await fs.readFile(appletFile, { encoding: 'utf-8' })); // the 'applet' attribute tells us how to load the applet. in the javascript case // it will be in the format : where is technically passed to "require" diff --git a/packages/@aws-cdk/applet-js/package.json b/packages/@aws-cdk/applet-js/package.json index 596931bfb553b..9900803a1a499 100644 --- a/packages/@aws-cdk/applet-js/package.json +++ b/packages/@aws-cdk/applet-js/package.json @@ -28,8 +28,11 @@ }, "dependencies": { "@aws-cdk/cdk": "^0.12.0", - "source-map-support": "^0.5.6", - "yamljs": "^0.2.0" + "@types/fs-extra": "^5.0.4", + "@types/js-yaml": "^3.11.2", + "fs-extra": "^7.0.0", + "js-yaml": "^3.12.0", + "source-map-support": "^0.5.6" }, "repository": { "url": "https://github.com/awslabs/aws-cdk.git",