Skip to content

ReamRD/cdk-pretty-diff

 
 

Repository files navigation

CDK Pretty Diff

Format cdk diff output to html making review easier. Inspired by Terraform prettyplan.

Installation

If you are using aws-cdk <= v1:

npm install [email protected]

or aws-cdk >= v2:

npm install cdk-pretty-diff

Usage

Instead of running cdk diff command line and receiving diff output, use cdk-pretty-diff (in javascript). Examples below.

Get cdk diff as an object

import { getCustomDiff } from 'cdk-pretty-diff';

const nicerDiffs = await getCustomDiff();
console.log(JSON.stringify(nicerDiffs, null, 2));

Render Pretty CDK Diff to html

html sample screenshot:

HTML Sample Screenshot

  • Original CDK Diff output is available (click the Orig CDK Diff button)
import { resolve } from 'path';
import { writeFileSync } from 'fs';
import { getCustomDiff, renderCustomDiffToHtmlString } from 'cdk-pretty-diff';

const nicerDiffs = await getCustomDiff();
const html = renderCustomDiffToHtmlString(nicerDiffs, 'CDK Diff');
writeFileSync(resolve(__dirname, '../cdk.out/diff.html'), html);

Development

npm i
npm run build

About

Format cdk diff output to html making review easier.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 62.5%
  • HTML 37.2%
  • JavaScript 0.3%