Skip to content

Commit 7ffe57e

Browse files
committed
🐛 Fix HTML creation
1 parent 0b00659 commit 7ffe57e

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

src/html.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import path from "path";
22
import fs from "fs-extra";
3-
import { Diff2Html } from "diff2html";
3+
import { html } from "diff2html";
44

55
const htmlTemplate = (diffHtml: string): string => `<html>
66
<head>
77
<title>GraphQL Schema Diff</title>
88
<meta charset="utf-8" />
9-
<link rel="stylesheet" href="diff2html.css">
10-
<script src="diff2html.js"></script>
11-
<script src="diff2html-ui.js"></script>
9+
<link rel="stylesheet" href="css/diff2html.min.css">
10+
<script src="js/diff2html.min.js"></script>
11+
<script src="js/diff2html-ui.min.js"></script>
1212
<style>
1313
html { box-sizing: border-box; }
1414
*,*:before,*:after { box-sizing: inherit; }
@@ -32,8 +32,7 @@ export async function createHtmlOutput(
3232
const adjustedDiff = diff
3333
.replace(/(---\s.*)\sremoved/, "$1")
3434
.replace(/(\+\+\+\s.*)\sadded/, "$1");
35-
const diffHtml = Diff2Html.getPrettyHtml(adjustedDiff, {
36-
inputFormat: "diff",
35+
const diffHtml = html(adjustedDiff, {
3736
matching: "lines",
3837
outputFormat: "side-by-side",
3938
rawTemplates: {
@@ -42,7 +41,7 @@ export async function createHtmlOutput(
4241
});
4342
await fs.ensureDir(outputDirectory);
4443
const diff2HtmlPath = path.dirname(require.resolve("diff2html/package.json"));
45-
await fs.copy(path.join(diff2HtmlPath, "dist"), outputDirectory);
44+
await fs.copy(path.join(diff2HtmlPath, "bundles"), outputDirectory);
4645
const htmlOutput = htmlTemplate(diffHtml);
4746
await fs.writeFile(path.join(outputDirectory, "index.html"), htmlOutput);
4847
}

0 commit comments

Comments
 (0)