Skip to content

Commit

Permalink
chore(deps): update
Browse files Browse the repository at this point in the history
  • Loading branch information
neighborhood999 committed Mar 15, 2020
1 parent 29db697 commit d41a1a2
Show file tree
Hide file tree
Showing 7 changed files with 1,525 additions and 1,434 deletions.
1,194 changes: 774 additions & 420 deletions example/compare-markdown/yarn.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
}
},
"dependencies": {
"diff2html": "^2.9.0",
"diff2html": "^3.1.6",
"difflib": "^0.2.4",
"prop-types": "^15.7.2",
"recompose": "^0.30.0"
Expand Down
206 changes: 192 additions & 14 deletions src/__tests__/__snapshots__/index.spec.js.snap

Large diffs are not rendered by default.

34 changes: 27 additions & 7 deletions src/__tests__/__snapshots__/utils.spec.js.snap
Original file line number Diff line number Diff line change
@@ -1,7 +1,27 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`should convert input string into compared html 1`] = `
"<div class=\\"d2h-wrapper\\">
"<div class=\\"d2h-file-list-wrapper\\">
<div class=\\"d2h-file-list-header\\">
<span class=\\"d2h-file-list-title\\">Files changed (1)</span>
<a class=\\"d2h-file-switch d2h-hide\\">hide</a>
<a class=\\"d2h-file-switch d2h-show\\">show</a>
</div>
<ol class=\\"d2h-file-list\\">
<li class=\\"d2h-file-list-line\\">
<span class=\\"d2h-file-name-wrapper\\">
<svg aria-hidden=\\"true\\" class=\\"d2h-icon d2h-changed\\" height=\\"16\\" title=\\"modified\\" version=\\"1.1\\"
viewBox=\\"0 0 14 16\\" width=\\"14\\">
<path d=\\"M13 1H1C0.45 1 0 1.45 0 2v12c0 0.55 0.45 1 1 1h12c0.55 0 1-0.45 1-1V2c0-0.55-0.45-1-1-1z m0 13H1V2h12v12zM4 8c0-1.66 1.34-3 3-3s3 1.34 3 3-1.34 3-3 3-3-1.34-3-3z\\"></path>
</svg> <a href=\\"#d2h-425049\\" class=\\"d2h-file-name\\">Unknown-File-Name</a>
<span class=\\"d2h-file-stats\\">
<span class=\\"d2h-lines-added\\">+1</span>
<span class=\\"d2h-lines-deleted\\">-1</span>
</span>
</span>
</li>
</ol>
</div><div class=\\"d2h-wrapper\\">
<div id=\\"d2h-425049\\" class=\\"d2h-file-wrapper\\" data-lang=\\"\\">
<div class=\\"d2h-file-header\\">
<span class=\\"d2h-file-name-wrapper\\">
Expand All @@ -21,11 +41,11 @@ exports[`should convert input string into compared html 1`] = `
<div class=\\"d2h-code-side-line d2h-info\\">@@ -1 +1 @@</div>
</td>
</tr><tr>
<td class=\\"d2h-code-side-linenumber d2h-del\\">
<td class=\\"d2h-code-side-linenumber d2h-del d2h-change\\">
1
</td>
<td class=\\"d2h-del\\">
<div class=\\"d2h-code-side-line d2h-del\\">
<td class=\\"d2h-del d2h-change\\">
<div class=\\"d2h-code-side-line d2h-del d2h-change\\">
<span class=\\"d2h-code-line-prefix\\">-</span>
<span class=\\"d2h-code-line-ctn\\"><del>Hello</del> <del>World</del></span>
</div>
Expand All @@ -45,11 +65,11 @@ exports[`should convert input string into compared html 1`] = `
<div class=\\"d2h-code-side-line d2h-info\\"></div>
</td>
</tr><tr>
<td class=\\"d2h-code-side-linenumber d2h-ins\\">
<td class=\\"d2h-code-side-linenumber d2h-ins d2h-change\\">
1
</td>
<td class=\\"d2h-ins\\">
<div class=\\"d2h-code-side-line d2h-ins\\">
<td class=\\"d2h-ins d2h-change\\">
<div class=\\"d2h-code-side-line d2h-ins d2h-change\\">
<span class=\\"d2h-code-line-prefix\\">+</span>
<span class=\\"d2h-code-line-ctn\\"><ins>Hellow</ins> <ins>Hellow</ins></span>
</div>
Expand Down
3 changes: 1 addition & 2 deletions src/__tests__/index.spec.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import React from 'react';
import { shallow, mount } from 'enzyme';
import { mount } from 'enzyme';
import renderer from 'react-test-renderer';
import { readFileSync } from 'fs';
import { ReactGhLikeDiff, RenderDiffResult } from '../index';
import { defaultOptions } from '../utils';

test('should render innerHTML by dangerouslySetInnerHTML', () => {
const html = '<h1>Hello World</h1>';
Expand Down
7 changes: 2 additions & 5 deletions src/utils.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import { unifiedDiff } from 'difflib';
import { format } from 'util';
import { compose } from 'recompose';

const {
Diff2Html: { getPrettyHtml }
} = require('diff2html');
const { html } = require('diff2html');

export const defaultOptions = {
originalFileName: 'Unknown-File-Name',
Expand Down Expand Up @@ -44,6 +41,6 @@ const compare = ({ past, current, options }) => {
};

export const genPrettyHtml = ({ diffString, options }) =>
getPrettyHtml(diffString, options);
html(diffString, options);

export default compose(genPrettyHtml, compare);

0 comments on commit d41a1a2

Please sign in to comment.