Permalink
Browse files

Upgraded by hand to the 1.0.0 release of create-react-app

  • Loading branch information...
TrafeX committed May 19, 2017
1 parent 2493974 commit fd97923422e9c1e65703697e6e5c48b1b0186b6f
Showing with 747 additions and 611 deletions.
  1. +1 −0 README.md
  2. +16 −7 config/webpack.config.dev.js
  3. +41 −7 config/webpack.config.prod.js
  4. +3 −10 config/webpackDevServer.config.js
  5. +14 −13 package.json
  6. +73 −144 scripts/build.js
  7. +43 −131 scripts/start.js
  8. +9 −5 scripts/test.js
  9. +0 −107 scripts/utils/createWebpackCompiler.js
  10. +547 −187 yarn.lock
@@ -33,3 +33,4 @@ This is a work in progress rebuild of the [orginal clipboard.ninja app](https://
- [ ] Better tests: http://facebook.github.io/jest/docs/en/tutorial-react-native.html#snapshot-test
- [ ] Send on ctrl + enter
- [ ] Dump/simplify create-react-app bootstrap
- [ ] Seperate the backend server with his own node modules
@@ -8,7 +8,7 @@ const CaseSensitivePathsPlugin = require('case-sensitive-paths-webpack-plugin');
const InterpolateHtmlPlugin = require('react-dev-utils/InterpolateHtmlPlugin');
const WatchMissingNodeModulesPlugin = require('react-dev-utils/WatchMissingNodeModulesPlugin');
const eslintFormatter = require('react-dev-utils/eslintFormatter');
// const ModuleScopePlugin = require('react-dev-utils/ModuleScopePlugin');
const ModuleScopePlugin = require('react-dev-utils/ModuleScopePlugin');
const getClientEnvironment = require('./env');
const paths = require('./paths');
@@ -84,18 +84,19 @@ module.exports = {
// https://github.com/facebookincubator/create-react-app/issues/290
extensions: ['.js', '.json', '.jsx'],
alias: {
// Support React Native Web
// https://www.smashingmagazine.com/2016/08/a-glimpse-into-the-future-with-react-native-for-web/
'react-native': 'react-native-web',
},
// plugins: [
plugins: [
// Prevents users from importing files from outside of src/ (or node_modules/).
// This often causes confusion because we only process files within src/ with babel.
// To fix this, we prevent you from importing files out of src/ -- if you'd like to,
// please link the files into your node_modules/ and let module-resolution kick in.
// Make sure your source files are compiled, as they will not be processed in any way.
// new ModuleScopePlugin(paths.appSrc),
// ],
new ModuleScopePlugin(paths.appSrc),
],
},
module: {
strictExportPresence: true,
@@ -113,17 +114,18 @@ module.exports = {
{
options: {
formatter: eslintFormatter,
},
loader: require.resolve('eslint-loader'),
},
],
include: paths.appSrc,
},
// ** ADDING/UPDATING LOADERS **
// The "url" loader handles all assets unless explicitly excluded.
// The "file" loader handles all assets unless explicitly excluded.
// The `exclude` list *must* be updated with every change to loader extensions.
// When adding a new loader, you must add its `test`
// as a new entry in the `exclude` list for "url" loader.
// as a new entry in the `exclude` list for "file" loader.
// "file" loader makes sure those assets get served by WebpackDevServer.
// When you `import` an asset, you get its (virtual) filename.
@@ -161,6 +163,7 @@ module.exports = {
include: paths.appSrc,
loader: require.resolve('babel-loader'),
options: {
// This is a feature of `babel-loader` for webpack (not Babel itself).
// It enables caching results in ./node_modules/.cache/babel-loader/
// directory for faster rebuilds.
@@ -203,7 +206,7 @@ module.exports = {
],
},
// ** STOP ** Are you adding a new loader?
// Remember to add the new extension(s) to the "url" loader exclusion list.
// Remember to add the new extension(s) to the "file" loader exclusion list.
],
},
plugins: [
@@ -231,6 +234,12 @@ module.exports = {
// makes the discovery automatic so you don't have to restart.
// See https://github.com/facebookincubator/create-react-app/issues/186
new WatchMissingNodeModulesPlugin(paths.appNodeModules),
// Moment.js is an extremely popular library that bundles large locale files
// by default due to how Webpack interprets its code. This is a practical
// solution that requires the user to opt into importing specific locales.
// https://github.com/jmblog/how-to-optimize-momentjs-with-webpack
// You can remove this if you don't use Moment.js:
new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/),
],
// Some libraries import Node modules but don't use them in the browser.
// Tell Webpack to provide empty mocks for them so importing them works.
@@ -7,8 +7,9 @@ const HtmlWebpackPlugin = require('html-webpack-plugin');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const ManifestPlugin = require('webpack-manifest-plugin');
const InterpolateHtmlPlugin = require('react-dev-utils/InterpolateHtmlPlugin');
const SWPrecacheWebpackPlugin = require('sw-precache-webpack-plugin');
const eslintFormatter = require('react-dev-utils/eslintFormatter');
// const ModuleScopePlugin = require('react-dev-utils/ModuleScopePlugin');
const ModuleScopePlugin = require('react-dev-utils/ModuleScopePlugin');
const paths = require('./paths');
const getClientEnvironment = require('./env');
@@ -81,18 +82,19 @@ module.exports = {
// https://github.com/facebookincubator/create-react-app/issues/290
extensions: ['.js', '.json', '.jsx'],
alias: {
// Support React Native Web
// https://www.smashingmagazine.com/2016/08/a-glimpse-into-the-future-with-react-native-for-web/
'react-native': 'react-native-web',
},
// plugins: [
plugins: [
// Prevents users from importing files from outside of src/ (or node_modules/).
// This often causes confusion because we only process files within src/ with babel.
// To fix this, we prevent you from importing files out of src/ -- if you'd like to,
// please link the files into your node_modules/ and let module-resolution kick in.
// Make sure your source files are compiled, as they will not be processed in any way.
// new ModuleScopePlugin(paths.appSrc),
// ],
new ModuleScopePlugin(paths.appSrc),
],
},
module: {
strictExportPresence: true,
@@ -110,17 +112,18 @@ module.exports = {
{
options: {
formatter: eslintFormatter,
},
loader: require.resolve('eslint-loader'),
},
],
include: paths.appSrc,
},
// ** ADDING/UPDATING LOADERS **
// The "url" loader handles all assets unless explicitly excluded.
// The "file" loader handles all assets unless explicitly excluded.
// The `exclude` list *must* be updated with every change to loader extensions.
// When adding a new loader, you must add its `test`
// as a new entry in the `exclude` list in the "url" loader.
// as a new entry in the `exclude` list in the "file" loader.
// "file" loader makes sure those assets end up in the `build` folder.
// When you `import` an asset, you get its filename.
@@ -155,6 +158,7 @@ module.exports = {
test: /\.(js|jsx)$/,
include: paths.appSrc,
loader: require.resolve('babel-loader'),
},
// The notation here is somewhat confusing.
// "postcss" loader applies autoprefixer to our CSS.
@@ -209,7 +213,7 @@ module.exports = {
// Note: this won't work without `new ExtractTextPlugin()` in `plugins`.
},
// ** STOP ** Are you adding a new loader?
// Remember to add the new extension(s) to the "url" loader exclusion list.
// Remember to add the new extension(s) to the "file" loader exclusion list.
],
},
plugins: [
@@ -245,6 +249,10 @@ module.exports = {
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false,
// This feature has been reported as buggy a few times, such as:
// https://github.com/mishoo/UglifyJS2/issues/1964
// We'll wait with enabling it by default until it is more solid.
reduce_vars: false,
},
output: {
comments: false,
@@ -261,6 +269,32 @@ module.exports = {
new ManifestPlugin({
fileName: 'asset-manifest.json',
}),
// Generate a service worker script that will precache, and keep up to date,
// the HTML & assets that are part of the Webpack build.
new SWPrecacheWebpackPlugin({
// By default, a cache-busting query parameter is appended to requests
// used to populate the caches, to ensure the responses are fresh.
// If a URL is already hashed by Webpack, then there is no concern
// about it being stale, and the cache-busting can be skipped.
dontCacheBustUrlsMatching: /\.\w{8}\./,
filename: 'service-worker.js',
logger(message) {
if (message.indexOf('Total precache size is') === 0) {
// This message occurs for every build and is a bit too noisy.
return;
}
console.log(message);
},
minify: true,
navigateFallback: publicUrl + '/index.html',
staticFileGlobsIgnorePatterns: [/\.map$/, /asset-manifest\.json$/],
}),
// Moment.js is an extremely popular library that bundles large locale files
// by default due to how Webpack interprets its code. This is a practical
// solution that requires the user to opt into importing specific locales.
// https://github.com/jmblog/how-to-optimize-momentjs-with-webpack
// You can remove this if you don't use Moment.js:
new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/),
],
// Some libraries import Node modules but don't use them in the browser.
// Tell Webpack to provide empty mocks for them so importing them works.
@@ -1,6 +1,6 @@
'use strict';
const launchEditor = require('react-dev-utils/launchEditor');
const errorOverlayMiddleware = require('react-error-overlay/middleware');
const config = require('./webpack.config.dev');
const paths = require('./paths');
@@ -60,15 +60,8 @@ module.exports = function(proxy, allowedHost) {
public: allowedHost,
proxy,
setup(app) {
// This lets us open files from the crash overlay.
app.use(function launchEditorMiddleware(req, res, next) {
if (req.url.startsWith('/__open-stack-frame-in-editor')) {
launchEditor(req.query.fileName, req.query.lineNumber);
res.end();
} else {
next();
}
});
// This lets us open files from the runtime error overlay.
app.use(errorOverlayMiddleware());
},
};
};
@@ -3,16 +3,11 @@
"version": "0.1.0",
"private": true,
"dependencies": {
"@timer/detect-port": "^1.1.3",
"address": "^1.0.1",
"express": "^4.15.2",
"inquirer": "^3.0.6",
"log-timestamp": "^0.1.2",
"material-ui": "^0.18.0",
"postcss-flexbugs-fixes": "^3.0.0",
"react": "^15.5.4",
"react-dom": "^15.5.4",
"react-error-overlay": "1.0.0-alpha.e280254d",
"react-tap-event-plugin": "^2.0.1",
"socket.io": "^1.7.3",
"socket.io-client": "^2.0.1"
@@ -23,7 +18,7 @@
"babel-eslint": "^7.2.3",
"babel-jest": "^20.0.3",
"babel-loader": "^7.0.0",
"babel-preset-react-app": "^2.2.0",
"babel-preset-react-app": "^3.0.0",
"babel-runtime": "^6.23.0",
"case-sensitive-paths-webpack-plugin": "^2.0.0",
"chalk": "^1.1.3",
@@ -33,7 +28,7 @@
"detect-port": "1.1.0",
"dotenv": "^4.0.0",
"eslint": "^3.19.0",
"eslint-config-react-app": "1.0.0-alpha.e280254d",
"eslint-config-react-app": "^1.0.0",
"eslint-loader": "^1.7.1",
"eslint-plugin-flowtype": "^2.33.0",
"eslint-plugin-import": "^2.2.0",
@@ -44,14 +39,16 @@
"flow-bin": "^0.45.0",
"fs-extra": "^3.0.1",
"html-webpack-plugin": "^2.28.0",
"http-proxy-middleware": "0.17.3",
"inquirer": "^3.0.6",
"jest": "^20.0.3",
"json-loader": "0.5.4",
"object-assign": "^4.1.1",
"postcss-flexbugs-fixes": "^3.0.0",
"postcss-loader": "^2.0.5",
"promise": "^7.1.1",
"react-dev-utils": "1.0.0-alpha.e280254d",
"react-dev-utils": "^1.0.0",
"react-error-overlay": "^1.0.0",
"style-loader": "^0.17.0",
"sw-precache-webpack-plugin": "^0.9.1",
"url-loader": "^0.5.8",
"webpack": "^2.5.1",
"webpack-dev-server": "^2.4.5",
@@ -73,8 +70,9 @@
"setupFiles": [
"<rootDir>/config/polyfills.js"
],
"testPathIgnorePatterns": [
"<rootDir>[/\\\\](build|docs|node_modules|scripts)[/\\\\]"
"testMatch": [
"<rootDir>/src/**/__tests__/**/*.js?(x)",
"<rootDir>/src/**/?(*.)(spec|test).js?(x)"
],
"testEnvironment": "node",
"testURL": "http://localhost",
@@ -85,7 +83,10 @@
},
"transformIgnorePatterns": [
"[/\\\\]node_modules[/\\\\].+\\.(js|jsx)$"
]
],
"moduleNameMapper": {
"^react-native$": "react-native-web"
}
},
"babel": {
"presets": [
Oops, something went wrong.

0 comments on commit fd97923

Please sign in to comment.