Skip to content

Commit 2636fca

Browse files
author
Peng Jie
committed
chore(deps): fix diff2html and add bundle css folder
1 parent d41a1a2 commit 2636fca

File tree

6 files changed

+42
-208
lines changed

6 files changed

+42
-208
lines changed

.size-snapshot.json

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
11
{
2-
"lib/react-gh-like-diff.cjs.js": {
3-
"bundled": 13641,
4-
"minified": 7356,
5-
"gzipped": 2759
2+
"dist/js/react-gh-like-diff.cjs.js": {
3+
"bundled": 13599,
4+
"minified": 7321,
5+
"gzipped": 2750
66
},
7-
"es/react-gh-like-diff.esm.js": {
8-
"bundled": 13360,
9-
"minified": 7126,
10-
"gzipped": 2694,
7+
"dist/js/react-gh-like-diff.esm.js": {
8+
"bundled": 13318,
9+
"minified": 7091,
10+
"gzipped": 2687,
1111
"treeshaked": {
1212
"rollup": {
13-
"code": 5938,
13+
"code": 5919,
1414
"import_statements": 211
1515
},
1616
"webpack": {
17-
"code": 7085
17+
"code": 7077
1818
}
1919
}
2020
},
21-
"dist/react-gh-like-diff.umd.js": {
22-
"bundled": 14962,
23-
"minified": 6382,
24-
"gzipped": 2628
21+
"dist/js/react-gh-like-diff.umd.js": {
22+
"bundled": 14964,
23+
"minified": 6407,
24+
"gzipped": 2618
2525
}
2626
}

package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
"name": "react-gh-like-diff",
33
"version": "1.1.3",
44
"description": "Generate Github like diff result in react.",
5-
"main": "lib/react-gh-like-diff.cjs.js",
6-
"module": "es/react-gh-like-diff.esm.js",
7-
"jsnext:main": "es/react-gh-like-diff.esm.js",
8-
"umd": "dist/react-gh-like-diff.umd.js",
5+
"main": "dist/js/react-gh-like-diff.cjs.js",
6+
"module": "dist/js/react-gh-like-diff.esm.js",
7+
"jsnext:main": "dist/js/react-gh-like-diff.esm.js",
8+
"umd": "dist/js/react-gh-like-diff.umd.js",
99
"scripts": {
1010
"test": "npm run lint && jest",
1111
"test:watch": "npm test -- --watch",
@@ -94,7 +94,7 @@
9494
"react-test-renderer": "16.13.0",
9595
"rimraf": "3.0.2",
9696
"rollup": "2.0.6",
97-
"rollup-plugin-css-porter": "1.0.2",
97+
"rollup-plugin-css-only": "^2.0.0",
9898
"rollup-plugin-node-builtins": "2.1.2",
9999
"rollup-plugin-size-snapshot": "0.11.0"
100100
},

rollup.config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import buble from '@rollup/plugin-buble';
33
import builtins from 'rollup-plugin-node-builtins';
44
import commonjs from '@rollup/plugin-commonjs';
55
import nodeResolve from '@rollup/plugin-node-resolve';
6-
import css from 'rollup-plugin-css-porter';
6+
import css from 'rollup-plugin-css-only';
77
import { sizeSnapshot } from 'rollup-plugin-size-snapshot';
88

99
const globals = {
@@ -25,7 +25,7 @@ const baseConfig = {
2525
builtins(),
2626
nodeResolve({ jsnext: true }),
2727
commonjs({ include: 'node_modules/**' }),
28-
css({ dest: 'lib/diff2html.css' }),
28+
css({ output: 'dist/css/diff2html.min.css' }),
2929
sizeSnapshot()
3030
]
3131
};

src/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
onlyUpdateForPropTypes,
1010
setPropTypes
1111
} from 'recompose';
12-
import 'diff2html/dist/diff2html.css';
12+
import 'diff2html/bundles/css/diff2html.min.css';
1313

1414
const RenderDiffResult = ({ genDiffHTML }) => (
1515
<div dangerouslySetInnerHTML={{ __html: genDiffHTML }} />

src/utils.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1+
const Diff2Html = require('diff2html');
12
import { unifiedDiff } from 'difflib';
23
import { format } from 'util';
34
import { compose } from 'recompose';
4-
const { html } = require('diff2html');
55

66
export const defaultOptions = {
77
originalFileName: 'Unknown-File-Name',
@@ -41,6 +41,6 @@ const compare = ({ past, current, options }) => {
4141
};
4242

4343
export const genPrettyHtml = ({ diffString, options }) =>
44-
html(diffString, options);
44+
Diff2Html.html(diffString, options);
4545

4646
export default compose(genPrettyHtml, compare);

0 commit comments

Comments
 (0)