11import path from "path" ;
22import fs from "fs-extra" ;
3- import { Diff2Html } from "diff2html" ;
3+ import { html } from "diff2html" ;
44
55const 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 .* ) \s r e m o v e d / , "$1" )
3434 . replace ( / ( \+ \+ \+ \s .* ) \s a d d e d / , "$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