Skip to content

Commit 8582a8f

Browse files
committed
Use .kind
1 parent 720e3bb commit 8582a8f

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/run-prettier.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -110,19 +110,21 @@ export async function runPrettier(
110110
"diff",
111111
alternative.version.kind,
112112
original.version.kind,
113-
`--src-prefix=Original|${fileLinkPrefix}`,
114-
`--dst-prefix=Alternative|`,
113+
`--src-prefix=${original.version.kind}|${fileLinkPrefix}`,
114+
`--dst-prefix=${alternative.version.kind}|`,
115115
],
116116
{ cwd: directory },
117117
);
118118

119119
const lines = diff.split("\n");
120120
for (let lineIndex = lines.length - 1; lineIndex >= 0; lineIndex--) {
121121
if (
122-
lines[lineIndex].startsWith("diff --git Original|") &&
122+
lines[lineIndex].startsWith(`diff --git ${original.version.kind}|`) &&
123123
lines[lineIndex + 1].startsWith("index ") &&
124-
lines[lineIndex + 2].startsWith("--- Original|http://github.com/") &&
125-
lines[lineIndex + 3].startsWith("+++ Alternative|")
124+
lines[lineIndex + 2].startsWith(
125+
`--- ${original.version.kind}|http://github.com/`,
126+
) &&
127+
lines[lineIndex + 3].startsWith(`+++ ${alternative.version.kind}|`)
126128
) {
127129
// Remove the useless head
128130
lines.splice(lineIndex, 2);

0 commit comments

Comments
 (0)