Skip to content

Instantly share code, notes, and snippets.

Created October 11, 2023 07:45
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save michaelwittig/43e65bbc23cb1079fe8826af3c93c26c to your computer and use it in GitHub Desktop.
Diff two CloudFormation YAML templates
// dependencies
// npm i yaml-cfn
// npm i jest-diff
// usage: node cfn-template-diff.js a.yaml b.yaml
const {yamlParse} = require('yaml-cfn');
const {readFileSync} = require('node:fs');
const {diff} = require('jest-diff');
const fileA = process.argv[2];
const fileB = process.argv[3];
const a = yamlParse(readFileSync(fileA));
const b = yamlParse(readFileSync(fileB));
console.log(diff(a, b));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment