Commit d3f6c3c
fix(cli): diff always prints stack name (#304)
Fixes #302
In #264, we capture the output of
the Formatter into a stream, and that is then converted to a string.
This diff only gets printed if the diff isn't empty, but by some quirk
`formatStackDiff` used to print the stack name _outside_ of the stream,
thus creating the (correct) behavior. #264 made sure that `format`
doesn't print, so we need to make sure that the consumer of
`formatStackDiff` prints the relevant info.
This PR makes sure that the stack name is returned as the formatted diff
even if the actual diff is empty. We will print the right information
when we print the formatted diff now.
I also made similar modifications to `formatSecurityDiff`, as we should
move away from `format` methods printing anything at all.
BEFORE (cdk 2.1006.0):
<img width="326" alt="Screenshot 2025-04-02 at 9 04 04 AM"
src="https://github.com/user-attachments/assets/03b92517-e475-4c27-a4c1-52217be824c8"
/>
AFTER (my local cdk):
<img width="322" alt="Screenshot 2025-04-02 at 9 03 11 AM"
src="https://github.com/user-attachments/assets/53a7d3e0-2e62-45ca-898b-93c923028346"
/>
---
By submitting this pull request, I confirm that my contribution is made
under the terms of the Apache-2.0 license
---------
Signed-off-by: github-actions <[email protected]>
Co-authored-by: github-actions <[email protected]>1 parent 20337de commit d3f6c3c
File tree
3 files changed
+33
-22
lines changed- packages
- @aws-cdk/tmp-toolkit-helpers
- src/api/diff
- test/api/diff
- aws-cdk/test/commands
3 files changed
+33
-22
lines changedLines changed: 14 additions & 15 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
208 | 208 | | |
209 | 209 | | |
210 | 210 | | |
211 | | - | |
| 211 | + | |
212 | 212 | | |
213 | 213 | | |
214 | 214 | | |
| |||
239 | 239 | | |
240 | 240 | | |
241 | 241 | | |
242 | | - | |
243 | | - | |
244 | | - | |
245 | 242 | | |
246 | | - | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
247 | 248 | | |
248 | 249 | | |
| 250 | + | |
| 251 | + | |
249 | 252 | | |
250 | 253 | | |
251 | 254 | | |
252 | | - | |
253 | | - | |
254 | | - | |
255 | | - | |
256 | 255 | | |
257 | 256 | | |
258 | 257 | | |
| |||
285 | 284 | | |
286 | 285 | | |
287 | 286 | | |
288 | | - | |
289 | | - | |
290 | | - | |
291 | | - | |
292 | | - | |
293 | | - | |
294 | 287 | | |
295 | 288 | | |
296 | 289 | | |
297 | 290 | | |
298 | 291 | | |
299 | 292 | | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
300 | 299 | | |
301 | 300 | | |
302 | 301 | | |
| |||
Lines changed: 9 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
58 | | - | |
| 58 | + | |
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
| |||
76 | 76 | | |
77 | 77 | | |
78 | 78 | | |
79 | | - | |
80 | | - | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
81 | 85 | | |
82 | 86 | | |
83 | 87 | | |
| |||
256 | 260 | | |
257 | 261 | | |
258 | 262 | | |
| 263 | + | |
259 | 264 | | |
260 | 265 | | |
261 | 266 | | |
| |||
291 | 296 | | |
292 | 297 | | |
293 | 298 | | |
| 299 | + | |
294 | 300 | | |
295 | 301 | | |
296 | 302 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
865 | 865 | | |
866 | 866 | | |
867 | 867 | | |
868 | | - | |
| 868 | + | |
869 | 869 | | |
870 | 870 | | |
871 | 871 | | |
| |||
906 | 906 | | |
907 | 907 | | |
908 | 908 | | |
909 | | - | |
| 909 | + | |
| 910 | + | |
| 911 | + | |
| 912 | + | |
910 | 913 | | |
911 | 914 | | |
912 | 915 | | |
| |||
926 | 929 | | |
927 | 930 | | |
928 | 931 | | |
929 | | - | |
| 932 | + | |
930 | 933 | | |
931 | 934 | | |
932 | 935 | | |
| |||
967 | 970 | | |
968 | 971 | | |
969 | 972 | | |
970 | | - | |
| 973 | + | |
| 974 | + | |
| 975 | + | |
| 976 | + | |
971 | 977 | | |
972 | 978 | | |
973 | 979 | | |
| |||
0 commit comments