* Load the locally-packaged template, fetch the deployed template, compute * the diff, and render it (text by default, JSON when `--json` is set). * * Two orthogonal signals are surfaced: * 1. Per-function code changes — computed by hashing local zips and * comparing to each La
()
| 35 | * noise the framework already considers meaningless. |
| 36 | */ |
| 37 | async runDiff() { |
| 38 | const [newTemplate, oldTemplate] = await Promise.all([ |
| 39 | this._loadLocalTemplate(), |
| 40 | this._fetchDeployedTemplate(), |
| 41 | ]) |
| 42 | |
| 43 | const codeChanges = await this._detectCodeChanges(oldTemplate) |
| 44 | |
| 45 | const diff = diffTemplate( |
| 46 | normalizeForDiff(oldTemplate), |
| 47 | normalizeForDiff(newTemplate), |
| 48 | ) |
| 49 | const summary = summarizeChanges(diff) |
| 50 | |
| 51 | // The package lifecycle's "Packaging" spinner is still active when our |
| 52 | // `after:package:finalize` hook fires. Stop it before writing structured |
| 53 | // output to stdout, otherwise the spinner overlays the first line of the |
| 54 | // diff (or interleaves with `--json` payloads on TTY consumers piping to |
| 55 | // `jq`). |
| 56 | this.progress.remove() |
| 57 | |
| 58 | if (this.options.json) { |
| 59 | writeText( |
| 60 | JSON.stringify(buildJsonReport(diff, summary, codeChanges), null, 2), |
| 61 | ) |
| 62 | return |
| 63 | } |
| 64 | |
| 65 | this._renderCodeChangeSummary(codeChanges) |
| 66 | |
| 67 | if (diff.isEmpty) { |
| 68 | this.log.notice('No infrastructure changes against the deployed stack') |
| 69 | return |
| 70 | } |
| 71 | |
| 72 | renderDiff(process.stdout, diff) |
| 73 | this.log.notice( |
| 74 | `Resources: ${summary.create} to create, ${summary.update} to update, ${summary.remove} to remove`, |
| 75 | ) |
| 76 | }, |
| 77 | |
| 78 | /** |
| 79 | * Read the freshly-packaged CloudFormation template from disk. Resolves |
nothing calls this directly
no test coverage detected
searching dependent graphs…