From d64fb431dabc55d8b46d73bbdf1870ea25b1d8d8 Mon Sep 17 00:00:00 2001 From: Elad Ben-Israel Date: Wed, 5 Dec 2018 10:45:44 +0200 Subject: [PATCH 1/2] feat(toolkit): include toolkit version in AWS::CDK::Metadata Adds the AWS CDK Toolkit version to the modules list of the AWS::CDK::Metadata resource to improve diagnosability and analytics. Fixes #1286 --- packages/aws-cdk/lib/api/cxapp/stacks.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/aws-cdk/lib/api/cxapp/stacks.ts b/packages/aws-cdk/lib/api/cxapp/stacks.ts index 79bcae2f8619f..ac69394e710ad 100644 --- a/packages/aws-cdk/lib/api/cxapp/stacks.ts +++ b/packages/aws-cdk/lib/api/cxapp/stacks.ts @@ -140,6 +140,11 @@ export class AppStacks { function formatModules(runtime: cxapi.AppRuntime): string { const modules = new Array(); + + const toolkitVersion = require('../../../package.json').version; + + modules.push(`aws-cdk=${toolkitVersion}`); + for (const key of Object.keys(runtime.libraries).sort()) { modules.push(`${key}=${runtime.libraries[key]}`); } From f30af30ad29760a782575deadcce7cfa895ad14a Mon Sep 17 00:00:00 2001 From: Elad Ben-Israel Date: Wed, 5 Dec 2018 10:54:59 +0200 Subject: [PATCH 2/2] clean up --- packages/aws-cdk/lib/api/cxapp/stacks.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/aws-cdk/lib/api/cxapp/stacks.ts b/packages/aws-cdk/lib/api/cxapp/stacks.ts index ac69394e710ad..2ba52322e148f 100644 --- a/packages/aws-cdk/lib/api/cxapp/stacks.ts +++ b/packages/aws-cdk/lib/api/cxapp/stacks.ts @@ -141,8 +141,8 @@ export class AppStacks { function formatModules(runtime: cxapi.AppRuntime): string { const modules = new Array(); + // inject toolkit version to list of modules const toolkitVersion = require('../../../package.json').version; - modules.push(`aws-cdk=${toolkitVersion}`); for (const key of Object.keys(runtime.libraries).sort()) {