Skip to content

Commit 8d08071

Browse files
committed
fix: add EOL for files
1 parent 0e1b780 commit 8d08071

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

packages/decap-cms-core/src/backend.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -1313,7 +1313,12 @@ export class Backend {
13131313
const format = resolveFormat(collection, entry.toJS());
13141314
const fieldsOrder = this.fieldsOrder(collection, entry);
13151315
const fieldsComments = selectFieldsComments(collection, entry);
1316-
return format && format.toFile(entry.get('data').toJS(), fieldsOrder, fieldsComments);
1316+
let content = format.toFile(entry.get('data').toJS(), fieldsOrder, fieldsComments);
1317+
if (content.slice(-1) != '\n') {
1318+
// add the EOL if it does not exist.
1319+
content += '\n';
1320+
}
1321+
return content;
13171322
}
13181323

13191324
fieldsOrder(collection: Collection, entry: EntryMap) {

0 commit comments

Comments
 (0)