Skip to content

Commit

Permalink
chore(deps): fix diff2html and add bundle css folder
Browse files Browse the repository at this point in the history
  • Loading branch information
neighborhood999 committed Mar 15, 2020
1 parent d41a1a2 commit 2636fca
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 208 deletions.
28 changes: 14 additions & 14 deletions .size-snapshot.json
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
{
"lib/react-gh-like-diff.cjs.js": {
"bundled": 13641,
"minified": 7356,
"gzipped": 2759
"dist/js/react-gh-like-diff.cjs.js": {
"bundled": 13599,
"minified": 7321,
"gzipped": 2750
},
"es/react-gh-like-diff.esm.js": {
"bundled": 13360,
"minified": 7126,
"gzipped": 2694,
"dist/js/react-gh-like-diff.esm.js": {
"bundled": 13318,
"minified": 7091,
"gzipped": 2687,
"treeshaked": {
"rollup": {
"code": 5938,
"code": 5919,
"import_statements": 211
},
"webpack": {
"code": 7085
"code": 7077
}
}
},
"dist/react-gh-like-diff.umd.js": {
"bundled": 14962,
"minified": 6382,
"gzipped": 2628
"dist/js/react-gh-like-diff.umd.js": {
"bundled": 14964,
"minified": 6407,
"gzipped": 2618
}
}
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
"name": "react-gh-like-diff",
"version": "1.1.3",
"description": "Generate Github like diff result in react.",
"main": "lib/react-gh-like-diff.cjs.js",
"module": "es/react-gh-like-diff.esm.js",
"jsnext:main": "es/react-gh-like-diff.esm.js",
"umd": "dist/react-gh-like-diff.umd.js",
"main": "dist/js/react-gh-like-diff.cjs.js",
"module": "dist/js/react-gh-like-diff.esm.js",
"jsnext:main": "dist/js/react-gh-like-diff.esm.js",
"umd": "dist/js/react-gh-like-diff.umd.js",
"scripts": {
"test": "npm run lint && jest",
"test:watch": "npm test -- --watch",
Expand Down Expand Up @@ -94,7 +94,7 @@
"react-test-renderer": "16.13.0",
"rimraf": "3.0.2",
"rollup": "2.0.6",
"rollup-plugin-css-porter": "1.0.2",
"rollup-plugin-css-only": "^2.0.0",
"rollup-plugin-node-builtins": "2.1.2",
"rollup-plugin-size-snapshot": "0.11.0"
},
Expand Down
4 changes: 2 additions & 2 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import buble from '@rollup/plugin-buble';
import builtins from 'rollup-plugin-node-builtins';
import commonjs from '@rollup/plugin-commonjs';
import nodeResolve from '@rollup/plugin-node-resolve';
import css from 'rollup-plugin-css-porter';
import css from 'rollup-plugin-css-only';
import { sizeSnapshot } from 'rollup-plugin-size-snapshot';

const globals = {
Expand All @@ -25,7 +25,7 @@ const baseConfig = {
builtins(),
nodeResolve({ jsnext: true }),
commonjs({ include: 'node_modules/**' }),
css({ dest: 'lib/diff2html.css' }),
css({ output: 'dist/css/diff2html.min.css' }),
sizeSnapshot()
]
};
Expand Down
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
onlyUpdateForPropTypes,
setPropTypes
} from 'recompose';
import 'diff2html/dist/diff2html.css';
import 'diff2html/bundles/css/diff2html.min.css';

const RenderDiffResult = ({ genDiffHTML }) => (
<div dangerouslySetInnerHTML={{ __html: genDiffHTML }} />
Expand Down
4 changes: 2 additions & 2 deletions src/utils.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const Diff2Html = require('diff2html');
import { unifiedDiff } from 'difflib';
import { format } from 'util';
import { compose } from 'recompose';
const { html } = require('diff2html');

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

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

export default compose(genPrettyHtml, compare);

0 comments on commit 2636fca

Please sign in to comment.