initial commit

This commit is contained in:
Colin Megill
2017-08-23 16:28:01 -07:00
commit f6d7cc3e23
40 changed files with 1661 additions and 0 deletions
+10
View File
@@ -0,0 +1,10 @@
module.exports = {
babelrc: false,
cacheDirectory: true,
presets: [
[ 'es2015', { loose: true, modules: false } ],
'stage-0',
'react'
],
plugins: [ 'react-hot-loader/babel' ]
};
+11
View File
@@ -0,0 +1,11 @@
module.exports = {
babelrc: false,
presets: [
[ 'es2015', { loose: true, modules: false } ],
'stage-0',
'react'
],
plugins: [ 'babel-plugin-transform-react-constant-elements' ]
.map(require.resolve)
.concat([ [ require.resolve('babel-plugin-transform-runtime') ] ])
};
+9
View File
@@ -0,0 +1,9 @@
module.exports = {
babelrc: false,
presets: [
'babel-preset-es2015',
'babel-preset-stage-0',
'babel-preset-react'
],
plugins: [ 'istanbul' ]
};
+29
View File
@@ -0,0 +1,29 @@
module.exports = {
root: true,
parser: 'babel-eslint',
extends: 'formidable/configurations/es6-react',
env: { browser: true, commonjs: true, es6: true, node: true, mocha: true },
globals: { expect: true },
parserOptions: {
ecmaVersion: 6,
sourceType: 'module',
ecmaFeatures: {
jsx: true,
generators: true,
experimentalObjectRestSpread: true
}
},
rules: {
quotes: [ 2, 'single', { allowTemplateLiterals: true } ],
'no-magic-numbers': 'off',
'func-style': 'off',
'arrow-parens': 'off',
'no-use-before-define': 'off',
'react/jsx-filename-extension': 'off',
'react/require-extension': 'off',
'react/no-multi-comp': 'warn',
'react/prop-types': 'warn',
'react/sort-comp': 'warn',
'react/sort-prop-types': 'warn'
}
};
+6
View File
@@ -0,0 +1,6 @@
if (typeof Promise === 'undefined') {
require('promise/lib/rejection-tracking').enable();
window.Promise = require('promise/lib/es6-extensions.js');
}
require('whatwg-fetch');
@@ -0,0 +1,74 @@
const path = require('path');
const autoprefixer = require('autoprefixer');
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const src = path.resolve('src');
const nodeModules = path.resolve('node_modules');
module.exports = {
devtool: 'eval',
entry: [
'webpack-hot-middleware/client?quiet=true&noInfo=true',
require.resolve('react-hot-loader/patch'),
require.resolve('../polyfills/polyfills'),
path.join(src, 'index')
],
output: {
path: path.resolve('build'),
pathinfo: true,
filename: 'static/js/bundle.js',
publicPath: '/'
},
resolve: { extensions: [ '.js', '.json' ] },
module: {
loaders: [
{
test: /\.js$/,
include: src,
loader: 'babel-loader',
query: require('../babel/babel.dev')
},
{
test: /\.css$/,
include: [ src, nodeModules ],
loader: 'style-loader!css-loader?modules&importLoaders=1&localIdentName=[name]__[local]___[hash:base64:5]!postcss-loader'
},
{ test: /\.json$/, include: [ src, nodeModules ], loader: 'json-loader' },
{
test: /\.(jpg|png|gif|eot|svg|ttf|woff|woff2)(\?.*)?$/,
include: [ src, nodeModules ],
loader: 'file-loader',
query: { name: 'static/media/[name].[ext]' }
},
{
test: /\.(mp4|webm)(\?.*)?$/,
include: [ src, nodeModules ],
loader: 'url-loader',
query: { limit: 10000, name: 'static/media/[name].[ext]' }
}
]
},
plugins: [
new HtmlWebpackPlugin({
inject: true,
template: path.resolve('index.html'),
favicon: path.resolve('favicon.png')
}),
new webpack.LoaderOptionsPlugin({
options: {
eslint: {
configFile: path.resolve('./configuration/eslint/eslint.js'),
useEslintrc: false
},
postcss() {
return [ autoprefixer ];
}
}
}),
new webpack.DefinePlugin({ 'process.env.NODE_ENV': '"development"' }),
// Note: only CSS is currently hot reloaded
new webpack.HotModuleReplacementPlugin(),
new webpack.NoEmitOnErrorsPlugin()
]
};
@@ -0,0 +1,112 @@
const path = require('path');
const autoprefixer = require('autoprefixer');
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const SWPrecacheWebpackPlugin = require('sw-precache-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const HtmlWebpackInlineSourcePlugin = require(
'html-webpack-inline-source-plugin'
);
const src = path.resolve('src');
const nodeModules = path.resolve('node_modules');
const publicPath = '/';
module.exports = {
bail: true,
devtool: 'source-map',
entry: [ require.resolve('../polyfills/polyfills'), path.join(src, 'index') ],
output: {
path: path.resolve('build'),
filename: 'static/js/[name].[chunkhash:8].js',
chunkFilename: 'static/js/[name].[chunkhash:8].chunk.js',
publicPath
},
resolve: { extensions: [ '.js', '.json' ] },
module: {
loaders: [
{
test: /\.js$/,
include: src,
loader: 'babel-loader',
query: require('../babel/babel.prod')
},
{
test: /\.css$/,
include: [ src, nodeModules ],
loader: ExtractTextPlugin.extract({
fallbackLoader: 'style-loader',
loader: 'css-loader?modules&importLoaders=1&localIdentName=[name]__[local]___[hash:base64:5]-autoprefixer!postcss-loader'
})
},
{
test: /\.json$/,
include: [ src, nodeModules ],
loader: 'json-loader',
exclude: /manifest.json$/
},
{
test: /\.(jpg|png|gif|eot|svg|ttf|woff|woff2)(\?.*)?$/,
include: [ src, nodeModules ],
loader: 'file-loader',
query: { name: 'static/media/[name].[hash:8].[ext]' }
},
{
test: /\.(mp4|webm)(\?.*)?$/,
include: [ src, nodeModules ],
loader: 'url-loader',
query: { limit: 10000, name: 'static/media/[name].[hash:8].[ext]' }
}
]
},
plugins: [
new HtmlWebpackPlugin({
inject: 'body',
template: path.resolve('index.html'),
favicon: path.resolve('favicon.png'),
inlineSource: '.(js|css)$',
minify: {
removeComments: true,
collapseWhitespace: true,
removeRedundantAttributes: true,
useShortDoctype: true,
removeEmptyAttributes: true,
removeStyleLinkTypeAttributes: true,
keepClosingSlash: true,
minifyJS: true,
minifyCSS: true,
minifyURLs: true
}
}),
new HtmlWebpackInlineSourcePlugin(),
new webpack.LoaderOptionsPlugin({
options: {
eslint: {
configFile: path.resolve('./configuration/eslint/eslint.js'),
useEslintrc: false
},
postcss() {
return [ autoprefixer ];
}
}
}),
new webpack.DefinePlugin({ 'process.env.NODE_ENV': '"production"' }),
new webpack.optimize.OccurrenceOrderPlugin(),
new webpack.optimize.UglifyJsPlugin({
compress: { screw_ie8: true, warnings: false },
mangle: { screw_ie8: true },
output: { comments: false, screw_ie8: true }
}),
new ExtractTextPlugin('static/css/[name].[contenthash:8].css'),
new CopyWebpackPlugin([
{ from: 'public' },
{ from: 'manifest.webmanifest' }
]),
new SWPrecacheWebpackPlugin({
cacheId: 'formidable-react-starter',
filename: 'service-worker.js'
})
]
};