Skip to content

Commit e72780b

Browse files
committed
fix: fix XML files always being written with Windows line separators
1 parent 139dd12 commit e72780b

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

idea/format-idea-xml.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1+
import {EOL} from "os";
12
import type {JSDOM} from "jsdom";
23
import formatXml from "xml-formatter";
34

45
export function formatIdeaXml(dom: JSDOM): string {
56
return formatXml(dom.serialize(), {
67
collapseContent: true,
8+
lineSeparator: EOL,
79
indentation: " ",
810
stripComments: true,
911
whiteSpaceAtEndOfSelfclosingTag: true

idea/write-dictionary.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import {promises as fs} from "fs";
22
import {fileURLToPath} from "url";
3+
import {EOL} from "os";
34
import {filterFn, mapFn} from "@softwareventures/array";
45
import {JSDOM} from "jsdom";
56
import formatXml from "xml-formatter";
@@ -39,6 +40,7 @@ export async function writeIdeaDictionary(fsStage: FsStage): Promise<InsertResul
3940
.then(() =>
4041
formatXml(dom.serialize(), {
4142
collapseContent: true,
43+
lineSeparator: EOL,
4244
indentation: " ",
4345
stripComments: true,
4446
whiteSpaceAtEndOfSelfclosingTag: true
@@ -48,4 +50,4 @@ export async function writeIdeaDictionary(fsStage: FsStage): Promise<InsertResul
4850
const file = xmlText.then(xmlText => textFile(xmlText));
4951

5052
return file.then(file => insert(fsStage, `.idea/dictionaries/project.xml`, file));
51-
}
53+
}

0 commit comments

Comments
 (0)