Skip to content
Merged
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
15 changes: 8 additions & 7 deletions packages/@aws-cdk/service-spec-importers/src/diff-fmt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -373,14 +373,15 @@ export class DiffFormatter {

private renderVendedLogListDiff(diff: ScalarDiff<VendedLog | undefined>, tree: PrintableTree[], diffShown: string) {
if (diff.old && diff.new) {
const oldList = new Set(diff.old.logTypes);
const newList = new Set(diff.new.logTypes);
const addedTypes = [...newList].filter((t) => !oldList.has(t));
const removedTypes = [...oldList].filter((t) => !newList.has(t));
if (addedTypes.length > 0 || removedTypes.length > 0) {
// the array should correspond to the value of diffShown
const oldList = new Set(diffShown === 'logTypes' ? diff.new.logTypes : diff.new.destinations);
const newList = new Set(diffShown === 'logTypes' ? diff.new.logTypes : diff.new.destinations);
const added = [...newList].filter((t) => !oldList.has(t));
const removed = [...oldList].filter((t) => !newList.has(t));
if (added.length > 0 || removed.length > 0) {
const bullets: PrintableTree[] = [];
removedTypes.forEach((type) => bullets.push(new PrintableTree(`- ${type}`).colorize(chalk.red)));
addedTypes.forEach((type) => bullets.push(new PrintableTree(`+ ${type}`).colorize(chalk.green)));
removed.forEach((obj) => bullets.push(new PrintableTree(`- ${obj}`).colorize(chalk.red)));
added.forEach((obj) => bullets.push(new PrintableTree(`+ ${obj}`).colorize(chalk.green)));
tree.push(new PrintableTree(`${diffShown}:`).addBullets(bullets));
}
}
Expand Down
Loading