Skip to content

Commit 6c4d599

Browse files
authored
Insert newline at the end of YAML resource state import/clone (#273)
1 parent f48561f commit 6c4d599

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

src/resourceState/ResourceStateImporter.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -335,10 +335,10 @@ export class ResourceStateImporter {
335335
const yamlOutput = this.yamlStringifyPreservingSnippets(output);
336336
if (resourceSectionExists) {
337337
// Existing resource section - add 2 spaces to all lines for proper indentation
338-
return '\n ' + yamlOutput.replaceAll('\n', '\n ').trim();
338+
return '\n ' + yamlOutput.replaceAll('\n', '\n ').trim() + '\n';
339339
} else {
340340
// No resource section - content is already properly indented
341-
return '\n' + yamlOutput.trim();
341+
return '\n' + yamlOutput.trim() + '\n';
342342
}
343343
}
344344

tst/unit/resourceState/StateImportExpectation.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,8 @@ ${formatPropertiesForYaml(properties)}
207207
Metadata:
208208
PrimaryIdentifier: ${identifier}
209209
ManagedByStack: "true"
210-
StackName: test-stack`);
210+
StackName: test-stack
211+
`);
211212
} else {
212213
return PlaceholderReplacer.replaceWithTabStops(`
213214
Resources:
@@ -219,7 +220,8 @@ ${formatPropertiesForYaml(properties)}
219220
Metadata:
220221
PrimaryIdentifier: ${identifier}
221222
ManagedByStack: "true"
222-
StackName: test-stack`);
223+
StackName: test-stack
224+
`);
223225
}
224226
}
225227
}
@@ -282,7 +284,8 @@ export function getCloneExpectation(scenario: TestScenario, resourceType: string
282284
Properties:
283285
${formatPropertiesForYaml(cloneProperties)}
284286
Metadata:
285-
PrimaryIdentifier: <CLONE>${identifier}`);
287+
PrimaryIdentifier: <CLONE>${identifier}
288+
`);
286289
} else {
287290
return PlaceholderReplacer.replaceWithTabStops(`
288291
Resources:
@@ -291,7 +294,8 @@ Resources:
291294
Properties:
292295
${formatPropertiesForYaml(cloneProperties)}
293296
Metadata:
294-
PrimaryIdentifier: <CLONE>${identifier}`);
297+
PrimaryIdentifier: <CLONE>${identifier}
298+
`);
295299
}
296300
}
297301
}

0 commit comments

Comments
 (0)