Skip to content

Commit

Permalink
Merge pull request #276 from patw0929/fix/example-cleanup
Browse files Browse the repository at this point in the history
Refactor: Removing all unused files and codes for example
  • Loading branch information
patw0929 committed Feb 14, 2019
2 parents b01621f + 8554791 commit fc858e7
Show file tree
Hide file tree
Showing 15 changed files with 4,906 additions and 5,854 deletions.
1 change: 0 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
dist/**
example/**
test/**
node_modules/*
package.json
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,4 @@ npm-debug.log
yarn-error.log

coverage
example/report.html
.example
6 changes: 3 additions & 3 deletions config/env.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const REACT_APP = /^REACT_APP_/i;
/*
* Get Global Objects in different running environments
*/
const getGlobalObject = () =>(`
const getGlobalObject = () => `
(function(){
if(typeof window !== "undefined" && window)
return window;
Expand All @@ -16,9 +16,9 @@ const getGlobalObject = () =>(`
else
return this;
})()
`);
`;

const getClientEnvironment = (publicUrl) => {
const getClientEnvironment = publicUrl => {
const NODE_ENV = JSON.stringify(process.env.NODE_ENV || 'development');
const DEVELOPMENT = NODE_ENV === JSON.stringify('development');
const SERVER = false;
Expand Down
7 changes: 0 additions & 7 deletions config/paths.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,8 @@ const nodePaths = (process.env.NODE_PATH || '')

// config after eject: we're in ./config/
module.exports = {
appBuild: resolveApp('example'),
appDist: resolveApp('dist'),
appPublic: resolveApp('public'),
appHtml: resolveApp('src/index.html'),
appExampleJs: resolveApp('src/example.js'),
appPackageJson: resolveApp('package.json'),
appSrc: resolveApp('src'),
yarnLockFile: resolveApp('yarn.lock'),
appNodeModules: resolveApp('node_modules'),
ownNodeModules: resolveApp('node_modules'),
nodePaths: nodePaths,
};
19 changes: 0 additions & 19 deletions config/polyfills.js

This file was deleted.

135 changes: 0 additions & 135 deletions config/webpack.config.dev.js

This file was deleted.

49 changes: 11 additions & 38 deletions config/webpack.config.prod.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
/* eslint-disable no-var, arrow-parens, prefer-template, comma-dangle, object-shorthand, global-require, func-names, no-else-return, vars-on-top */

const webpack = require('webpack');
const paths = require('./paths');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
const OptimizeCssAssetsPlugin = require('optimize-css-assets-webpack-plugin');
const safeParser = require('postcss-safe-parser');
const InterpolateHtmlPlugin = require('react-dev-utils/InterpolateHtmlPlugin');
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer')
.BundleAnalyzerPlugin;
const getClientEnvironment = require('./env');

// Webpack uses `publicPath` to determine where the app is being served from.
Expand All @@ -32,11 +30,9 @@ module.exports = {
devtool: false,
entry: {
main: './src/components/IntlTelInput.js',
example: [require.resolve('./polyfills'), './src/example.js'],
},

output: {
path: paths.appBuild,
path: paths.appDist,
pathinfo: true,
filename: '[name].js',
chunkFilename: '[name].bundle.js',
Expand Down Expand Up @@ -170,41 +166,18 @@ module.exports = {
minimize: true,
debug: false,
}),
new HtmlWebpackPlugin({
inject: true,
template: paths.appHtml,
chunks: ['example'],
minify: {
removeComments: true,
collapseWhitespace: true,
removeRedundantAttributes: true,
useShortDoctype: true,
removeEmptyAttributes: true,
removeStyleLinkTypeAttributes: true,
keepClosingSlash: true,
minifyJS: true,
minifyCSS: true,
minifyURLs: true,
},
}),
// Generates an `index.html` file with the <script> injected.
new InterpolateHtmlPlugin(HtmlWebpackPlugin, {
PUBLIC_URL: publicUrl,
}),
new webpack.DefinePlugin(env),
new MiniCssExtractPlugin({
filename: 'main.css',
}),
new BundleAnalyzerPlugin(
{
analyzerMode: 'static',
reportFilename: 'report.html',
defaultSizes: 'parsed',
openAnalyzer: true,
generateStatsFile: false,
logLevel: 'info'
},
),
new BundleAnalyzerPlugin({
analyzerMode: 'static',
reportFilename: 'report.html',
defaultSizes: 'parsed',
openAnalyzer: true,
generateStatsFile: false,
logLevel: 'info',
}),
],
node: {
fs: 'empty',
Expand Down
Loading

0 comments on commit fc858e7

Please sign in to comment.