1
1
import path from "path" ;
2
2
import fs from "fs-extra" ;
3
- import { Diff2Html } from "diff2html" ;
3
+ import { html } from "diff2html" ;
4
4
5
5
const htmlTemplate = ( diffHtml : string ) : string => `<html>
6
6
<head>
7
7
<title>GraphQL Schema Diff</title>
8
8
<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>
12
12
<style>
13
13
html { box-sizing: border-box; }
14
14
*,*:before,*:after { box-sizing: inherit; }
@@ -32,8 +32,7 @@ export async function createHtmlOutput(
32
32
const adjustedDiff = diff
33
33
. replace ( / ( - - - \s .* ) \s r e m o v e d / , "$1" )
34
34
. replace ( / ( \+ \+ \+ \s .* ) \s a d d e d / , "$1" ) ;
35
- const diffHtml = Diff2Html . getPrettyHtml ( adjustedDiff , {
36
- inputFormat : "diff" ,
35
+ const diffHtml = html ( adjustedDiff , {
37
36
matching : "lines" ,
38
37
outputFormat : "side-by-side" ,
39
38
rawTemplates : {
@@ -42,7 +41,7 @@ export async function createHtmlOutput(
42
41
} ) ;
43
42
await fs . ensureDir ( outputDirectory ) ;
44
43
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 ) ;
46
45
const htmlOutput = htmlTemplate ( diffHtml ) ;
47
46
await fs . writeFile ( path . join ( outputDirectory , "index.html" ) , htmlOutput ) ;
48
47
}
0 commit comments