diff --git a/cli/src/builders/imd.ts b/cli/src/builders/imd.ts index 0585bd5..624868b 100644 --- a/cli/src/builders/imd.ts +++ b/cli/src/builders/imd.ts @@ -111,7 +111,9 @@ export class ImpactMarkdown { let currentTree: ILEObject[] = []; function lookupObject(ileObject: ILEObject) { - lines.push(`${''.padEnd(currentTree.length, `\t`)}* ${TypeEmoji[ileObject.type] || `❔`} \`${ileObject.systemName}.${ileObject.type}\` (${ileObject.relativePath ? `\`${ileObject.relativePath}\`` : `no source`})`); + let resultLines: string[] = []; + + resultLines.push(`${''.padEnd(currentTree.length, `\t`)}* ${TypeEmoji[ileObject.type] || `❔`} \`${ileObject.systemName}.${ileObject.type}\` (${ileObject.relativePath ? `\`${ileObject.relativePath}\`` : `no source`})`); currentTree.push(ileObject); @@ -120,20 +122,23 @@ export class ImpactMarkdown { const circular = currentTree.some(d => d.systemName === target.systemName && d.type === target.type); if (containsLookup && !circular) { - lookupObject(target); + resultLines.push(...lookupObject(target)); } } currentTree.pop(); + return resultLines; } - lookupObject(theObject); + const depTreeMd = lookupObject(theObject); - if (lines.length === 1) { + if (depTreeMd.length === 1) { lines.push( ``, `Changes to this object have no impact.` ) + } else { + lines.push(...depTreeMd); } return lines; @@ -149,7 +154,7 @@ export class ImpactMarkdown { let logs = this.targets.logger.getLogsFor(ileObject.relativePath); let parents = this.targets.getTargets().filter(t => t.deps.some(d => d.systemName === ileObject.systemName && d.type === ileObject.type)); - let children = this.targets.getTarget(ileObject).deps; + let children = this.targets.getTarget(ileObject)?.deps || []; lines.push(`| ` + [ TypeEmoji[ileObject.type] || `❔`,