-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove gulp scripts for examples and use webpack
This drops a few scripts from package.json (mostly the publishing ones).
- Loading branch information
Showing
9 changed files
with
1,325 additions
and
1,690 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import React from 'react'; | ||
|
||
import DoughnutExample from './doughnut'; | ||
import DynamicDoughnutExample from './dynamic-doughnut'; | ||
import PieExample from './pie'; | ||
import LineExample from './line'; | ||
import BarExample from './bar'; | ||
import HorizontalBarExample from './horizontalBar'; | ||
import RadarExample from './radar'; | ||
import PolarExample from './polar'; | ||
import BubbleExample from './bubble'; | ||
import ScatterExample from './scatter'; | ||
import MixedDataExample from './mix'; | ||
import RandomizedDataLineExample from './randomizedLine'; | ||
import CrazyDataLineExample from './crazyLine'; | ||
import LegendOptionsExample from './legend-options'; | ||
import LegendHandlersExample from './legend-handlers'; | ||
|
||
export default class App extends React.Component { | ||
render() { | ||
return ( | ||
<div> | ||
<hr /> | ||
<DoughnutExample /> | ||
<hr /> | ||
<DynamicDoughnutExample /> | ||
<hr /> | ||
<PieExample /> | ||
<hr /> | ||
<LineExample /> | ||
<hr /> | ||
<BarExample /> | ||
<hr /> | ||
<HorizontalBarExample /> | ||
<hr /> | ||
<RadarExample /> | ||
<hr /> | ||
<PolarExample /> | ||
<hr /> | ||
<BubbleExample /> | ||
<hr /> | ||
<ScatterExample /> | ||
<hr /> | ||
<MixedDataExample /> | ||
<hr /> | ||
<RandomizedDataLineExample /> | ||
<hr /> | ||
<CrazyDataLineExample /> | ||
<hr /> | ||
<LegendOptionsExample /> | ||
<hr /> | ||
<LegendHandlersExample /> | ||
</div> | ||
); | ||
} | ||
} |
File renamed without changes.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import React from 'react'; | ||
import ReactDOM from 'react-dom'; | ||
|
||
const MOUNT_NODE = document.getElementById('app'); | ||
|
||
const render = () => { | ||
const App = require('./components/app').default; | ||
|
||
ReactDOM.render(<App />, MOUNT_NODE); | ||
}; | ||
|
||
render(); | ||
|
||
if (module.hot) { | ||
module.hot.accept(['./components/app'], () => | ||
setImmediate(() => { | ||
ReactDOM.unmountComponentAtNode(MOUNT_NODE); | ||
render(); | ||
}) | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
import path from 'path'; | ||
import webpack from 'webpack'; | ||
import HtmlWebpackPlugin from 'html-webpack-plugin'; | ||
import ExtractTextPlugin from 'extract-text-webpack-plugin'; | ||
|
||
const inExamples = loc => path.resolve(__dirname, loc); | ||
|
||
const env = process.env.NODE_ENV || 'development'; | ||
const __DEV__ = env === 'development'; | ||
|
||
const config = { | ||
entry: { | ||
app: [ | ||
inExamples('src/index.js'), | ||
inExamples('src/example.css') | ||
] | ||
}, | ||
module: { | ||
rules: [ | ||
{ | ||
test: /\.js$/, | ||
exclude: /node_modules/, | ||
loader: 'babel-loader' | ||
}, | ||
{ | ||
test: /\.css$/, | ||
loader: ExtractTextPlugin.extract({ | ||
fallback: 'style-loader', | ||
use: 'css-loader' | ||
}) | ||
} | ||
] | ||
}, | ||
resolve: { | ||
alias: { | ||
'react-chartjs-2': '../../../src' | ||
} | ||
}, | ||
output: { | ||
path: inExamples('dist'), | ||
filename: '[name].js' | ||
}, | ||
plugins: [ | ||
new webpack.DefinePlugin({ | ||
'process.env': { | ||
NODE_ENV: JSON.stringify(env) | ||
}, | ||
}), | ||
new ExtractTextPlugin({ | ||
filename: '[name].css', | ||
disable: __DEV__ | ||
}), | ||
new HtmlWebpackPlugin({ | ||
template: inExamples('src/index.html'), | ||
inject: true, | ||
minify: { | ||
removeComments: true, | ||
collapseWhitespace: true, | ||
removeRedundantAttributes: true, | ||
useShortDoctype: true, | ||
removeEmptyAttributes: true, | ||
removeStyleLinkTypeAttributes: true, | ||
keepClosingSlash: true, | ||
minifyJS: true, | ||
minifyCSS: true, | ||
minifyURLs: true | ||
} | ||
}) | ||
], | ||
devServer: { | ||
contentBase: path.join(__dirname, 'src'), | ||
historyApiFallback: true, | ||
hot: true, | ||
inline: true, | ||
port: 8000, | ||
stats: { | ||
cached: false | ||
} | ||
} | ||
}; | ||
|
||
if (__DEV__) { | ||
config.plugins.push( | ||
new webpack.NoEmitOnErrorsPlugin(), | ||
new webpack.HotModuleReplacementPlugin() | ||
); | ||
} | ||
else { | ||
config.plugins.push( | ||
new webpack.optimize.ModuleConcatenationPlugin(), | ||
|
||
new webpack.LoaderOptionsPlugin({ | ||
minimize: true, | ||
debug: false, | ||
}), | ||
|
||
new webpack.optimize.UglifyJsPlugin({ | ||
comments: false, | ||
compress: { | ||
warnings: false, | ||
screw_ie8: true, | ||
conditionals: true, | ||
unused: true, | ||
comparisons: true, | ||
sequences: true, | ||
dead_code: true, | ||
evaluate: true, | ||
if_return: true, | ||
join_vars: true, | ||
}, | ||
mangle: { | ||
screw_ie8: true | ||
}, | ||
output: { | ||
comments: false, | ||
screw_ie8: true | ||
} | ||
}) | ||
); | ||
} | ||
|
||
export default config; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.