Skip to content

Commit 0ffa609

Browse files
committed
chore(deps): Update dependencies
1 parent 018855f commit 0ffa609

File tree

9 files changed

+2732
-1525
lines changed

9 files changed

+2732
-1525
lines changed

.babelrc.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,18 @@ const modules = output == null ? false : output;
66

77
const options = {
88
presets: [['@babel/env', { loose: true, modules }], '@babel/react'],
9-
plugins: ['@babel/proposal-object-rest-spread', ['@babel/proposal-class-properties', { loose: true }]],
9+
plugins: [
10+
'@babel/plugin-syntax-dynamic-import',
11+
'@babel/proposal-object-rest-spread',
12+
['@babel/proposal-class-properties', { loose: true }],
13+
],
1014
};
1115

1216
if (target === 'examples') {
13-
options.plugins.push(['transform-react-remove-prop-types', { removeImport: true }]);
17+
options.plugins.push([
18+
'transform-react-remove-prop-types',
19+
{ removeImport: true },
20+
]);
1421
} else {
1522
options.plugins.push(['transform-react-remove-prop-types', { mode: 'wrap' }]);
1623
}

.eslintrc

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,7 @@
88
"plugins": ["prettier"],
99
"rules": {
1010
"no-plusplus": "off",
11-
"prettier/prettier": [
12-
"error",
13-
{ "singleQuote": true, "printWidth": 100, "trailingComma": "all" }
14-
],
11+
"prettier/prettier": "error",
1512
"react/require-default-props": "off",
1613
"react/jsx-filename-extension": ["error", { "extensions": [".js"] }],
1714
"react/forbid-prop-types": "off",

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ npm-debug.log
44
lib/
55
dist/
66
esm/
7+
yarn-error.log

.prettierrc

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"arrowParens": "avoid",
3+
"bracketSpacing": true,
4+
"jsxBracketSameLine": false,
5+
"printWidth": 80,
6+
"semi": true,
7+
"singleQuote": true,
8+
"tabWidth": 2,
9+
"trailingComma": "all",
10+
"useTabs": false
11+
}

examples/src/components/ExampleItem.js

Lines changed: 40 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,27 @@
11
import React, { Component } from 'react';
22
import T from 'prop-types';
33
import { Tab, Tabs, TabList, TabPanel } from 'react-tabs'; // eslint-disable-line
4-
import { LiveProvider, LiveEditor, LiveError, LivePreview } from 'react-live';
54
import classNames from 'classnames';
65

6+
let ReactLive;
7+
78
const scope = { Tabs, Tab, TabList, TabPanel };
89

910
export default class ExampleItem extends Component {
1011
state = {
1112
editorOpen: false,
13+
liveLoaded: false,
1214
};
15+
16+
constructor(props) {
17+
super(props);
18+
19+
import('react-live').then(Live => {
20+
ReactLive = Live;
21+
this.setState({ liveLoaded: true });
22+
});
23+
}
24+
1325
toggleCheckbox({ target: { name, checked } }) {
1426
this.setState({
1527
[name]: checked,
@@ -28,10 +40,34 @@ export default class ExampleItem extends Component {
2840
return <div className="hint">{this.props.hint}</div>;
2941
}
3042

31-
render() {
43+
renderLiveEditor() {
44+
if (!this.state.liveLoaded) return null;
45+
3246
const { editorOpen } = this.state;
47+
const editorClassNames = classNames('live-editor', {
48+
'live-editor--visible': editorOpen,
49+
});
3350

34-
const editorClassNames = classNames('live-editor', { 'live-editor--visible': editorOpen });
51+
return (
52+
<ReactLive.LiveProvider
53+
mountStylesheet={false}
54+
scope={scope}
55+
code={this.props.code}
56+
noInline
57+
>
58+
<ReactLive.LiveError />
59+
<div className="live-preview">
60+
<div className={editorClassNames}>
61+
<ReactLive.LiveEditor ignoreTabKey />
62+
</div>
63+
<ReactLive.LivePreview />
64+
</div>
65+
</ReactLive.LiveProvider>
66+
);
67+
}
68+
69+
render() {
70+
const { editorOpen } = this.state;
3571
const formId = `editorOpen${this.props.label.replace(' ', '_')}`;
3672

3773
return (
@@ -50,15 +86,7 @@ export default class ExampleItem extends Component {
5086
</label>
5187
</h3>
5288
{this.renderHint()}
53-
<LiveProvider mountStylesheet={false} scope={scope} code={this.props.code} noInline>
54-
<LiveError />
55-
<div className="live-preview">
56-
<div className={editorClassNames}>
57-
<LiveEditor ignoreTabKey />
58-
</div>
59-
<LivePreview />
60-
</div>
61-
</LiveProvider>
89+
{this.renderLiveEditor()}
6290
</div>
6391
);
6492
}

examples/src/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ <h2 class="page-header__subtitle">An accessible and easy tab component for <a hr
3131
</div>
3232
<footer class="page-footer">
3333
<div class="container">
34-
<span>Copyright &copy; <a href="https://twitter.com/TschinderDaniel" target="_blank">Daniel Tschinder</a> 2017. MIT Licensed.</span>
34+
<span>Copyright &copy; <a href="https://twitter.com/TschinderDaniel" target="_blank">Daniel Tschinder</a> 2017-2018. MIT Licensed.</span>
3535
</div>
3636
</footer>
3737
</body>

package.json

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"start": "webpack-dev-server --inline --content-base examples/",
2323
"website": "run-s website:clean website:build website:redirect",
2424
"website:clean": "rimraf examples/dist",
25-
"website:build": "cross-env NODE_ENV=production webpack",
25+
"website:build": "cross-env BABEL_TARGET=examples NODE_ENV=production webpack",
2626
"website:redirect": "cp -R examples/src/example examples/dist"
2727
},
2828
"repository": {
@@ -57,12 +57,13 @@
5757
"@babel/plugin-external-helpers": "^7.0.0-beta.40",
5858
"@babel/plugin-proposal-class-properties": "^7.0.0-beta.40",
5959
"@babel/plugin-proposal-object-rest-spread": "^7.0.0-beta.40",
60+
"@babel/plugin-syntax-dynamic-import": "^7.0.0-beta.44",
6061
"@babel/preset-env": "^7.0.0-beta.40",
6162
"@babel/preset-react": "^7.0.0-beta.40",
6263
"babel-core": "^7.0.0-0",
6364
"babel-eslint": "^8.0.1",
6465
"babel-jest": "^22.2.2",
65-
"babel-loader": "^7.1.2",
66+
"babel-loader": "^8.0.0-0",
6667
"babel-plugin-transform-react-remove-prop-types": "^0.4.0",
6768
"conventional-github-releaser": "^2.0.0",
6869
"cross-env": "^5.0.0",
@@ -76,15 +77,15 @@
7677
"eslint-plugin-jsx-a11y": "^6.0.2",
7778
"eslint-plugin-prettier": "^2.2.0",
7879
"eslint-plugin-react": "^7.0.1",
79-
"extract-text-webpack-plugin": "^3.0.2",
8080
"hoist-non-react-statics": "^2.3.1",
8181
"html-loader": "^0.5.1",
82-
"html-webpack-plugin": "^2.30.1",
82+
"html-webpack-plugin": "^3.2.0",
8383
"husky": "^0.14.3",
8484
"jest": "^22.3.0",
85-
"less": "^2.7.3",
85+
"less": "^3.0.1",
8686
"less-loader": "^4.0.5",
87-
"lint-staged": "^6.0.0",
87+
"lint-staged": "^7.0.4",
88+
"mini-css-extract-plugin": "^0.4.0",
8889
"npm-run-all": "^4.1.1",
8990
"prettier": "^1.2.2",
9091
"react": "^16.0.0",
@@ -93,18 +94,19 @@
9394
"react-modal": "^3.0.0",
9495
"react-test-renderer": "^16.0.0",
9596
"rimraf": "^2.5.2",
96-
"rollup": "^0.56.1",
97+
"rollup": "^0.58.0",
9798
"rollup-plugin-babel": "^4.0.0-beta.1",
98-
"rollup-plugin-commonjs": "^8.2.6",
99+
"rollup-plugin-commonjs": "^9.1.0",
99100
"rollup-plugin-ignore": "^1.0.3",
100101
"rollup-plugin-node-resolve": "^3.0.0",
101102
"rollup-plugin-replace": "^2.0.0",
102103
"rollup-plugin-uglify": "^3.0.0",
103104
"standard-version": "^4.2.0",
104105
"style-loader": "^0.20.0",
105106
"uglifyjs-webpack-plugin": "^1.0.1",
106-
"webpack": "^3.6.0",
107-
"webpack-dev-server": "^2.9.4"
107+
"webpack": "^4.6.0",
108+
"webpack-cli": "^2.0.14",
109+
"webpack-dev-server": "^3.1.3"
108110
},
109111
"dependencies": {
110112
"classnames": "^2.2.0",
@@ -118,7 +120,7 @@
118120
},
119121
"lint-staged": {
120122
"src/**/*.js": [
121-
"eslint --fix",
123+
"yarn run eslint --fix",
122124
"git add"
123125
]
124126
}

webpack.config.js

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const webpack = require('webpack');
22
const path = require('path');
33
const HtmlWebpackPlugin = require('html-webpack-plugin');
4-
const ExtractTextPlugin = require('extract-text-webpack-plugin');
4+
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
55
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
66

77
const sourceDirectory = path.resolve(__dirname, 'examples/src');
@@ -20,33 +20,29 @@ const plugins = [
2020
removeRedundantAttributes: !isDev,
2121
},
2222
}),
23-
new ExtractTextPlugin('app-[contenthash:8].css'),
24-
new webpack.optimize.ModuleConcatenationPlugin(),
23+
new MiniCssExtractPlugin({
24+
filename: "[name].css",
25+
chunkFilename: "app-[id].css"
26+
}),
2527
];
2628

2729
if (!isDev) {
2830
plugins.push(
2931
new webpack.DefinePlugin({
3032
'process.env.NODE_ENV': JSON.stringify('production')
31-
}),
32-
new UglifyJsPlugin({
33-
uglifyOptions: {
34-
compress: {
35-
warnings: false,
36-
},
37-
},
38-
sourceMap: false,
3933
})
40-
);
34+
);
4135
}
4236

4337
module.exports = {
38+
mode: isDev ? 'development' : 'production',
4439
context: sourceDirectory,
4540
entry: {
4641
app: './app.js',
4742
},
4843
output: {
4944
path: targetDirectory,
45+
chunkFilename: 'chunk-[chunkhash].js',
5046
filename: '[name]-[chunkhash].js',
5147
hashDigestLength: 8,
5248
},
@@ -67,17 +63,11 @@ module.exports = {
6763
},
6864
{
6965
test: /\.less$/,
70-
use: ExtractTextPlugin.extract({
71-
fallback: 'style-loader',
72-
use: ['css-loader', 'less-loader'],
73-
}),
66+
use: [MiniCssExtractPlugin.loader, 'css-loader', 'less-loader'],
7467
},
7568
{
7669
test: /\.css$/,
77-
use: ExtractTextPlugin.extract({
78-
fallback: 'style-loader',
79-
use: ['css-loader'],
80-
}),
70+
use: [MiniCssExtractPlugin.loader, 'css-loader'],
8171
},
8272
{
8373
test: /\.html$/,

0 commit comments

Comments
 (0)