diff --git a/CHANGELOG.md b/CHANGELOG.md index 9955191c..2cbeed3a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,85 @@ +## 1.0.6 (May 24, 2017) + +#### :bug: Bug Fix + +* `eslint-config-react-app`, `react-error-overlay`, `react-scripts` + + * [#2346](https://github.com/facebookincubator/create-react-app/pull/2346) Resolve Flow errors in an ESLint plugin. ([@iainbeeston](https://github.com/iainbeeston)) + +* `react-dev-utils` + + * [#2332](https://github.com/facebookincubator/create-react-app/pull/2332) Fix proxying issues with backends that don't support IPv6. ([@Timer](https://github.com/Timer)) + +#### :nail_care: Enhancement +* `react-scripts` + + * [#2347](https://github.com/facebookincubator/create-react-app/pull/2347) Don't precache `/__*` URLs to fix Firebase hosting. ([@ryansully](https://github.com/ryansully)) + +#### :memo: Documentation + +* README + + * [#2334](https://github.com/facebookincubator/create-react-app/pull/2334) Add missing files to the list. ([@jesselpalmer](https://github.com/jesselpalmer)) + +#### Committers: 4 +- Iain Beeston ([iainbeeston](https://github.com/iainbeeston)) +- Jesse Palmer ([jesselpalmer](https://github.com/jesselpalmer)) +- Joe Haddad ([Timer](https://github.com/Timer)) +- Ryan Sullivan ([ryansully](https://github.com/ryansully)) + +### Migrating from 1.0.5 to 1.0.6 + +Inside any created project that has not been ejected, run: + +``` +npm install --save-dev --save-exact react-scripts@1.0.6 +``` + +or + +``` +yarn add --dev --exact react-scripts@1.0.6 +``` + +## 1.0.5 (May 22, 2017) + +#### :bug: Bug Fix +* `react-dev-utils`, `react-scripts` + + * [#2326](https://github.com/facebookincubator/create-react-app/pull/2326) Files in `public/` folder should not be requested through proxy. ([@gaearon](https://github.com/gaearon)) + +#### :nail_care: Enhancement +* `react-dev-utils` + + * [#2327](https://github.com/facebookincubator/create-react-app/pull/2327) Limit console warnings to 5 files at most. ([@gaearon](https://github.com/gaearon)) + +* `eslint-config-react-app` + + * [#2325](https://github.com/facebookincubator/create-react-app/pull/2325) Allow declaring variables before use in a scope above. ([@gaearon](https://github.com/gaearon)) + +#### :house: Internal +* `react-dev-utils`, `react-scripts` + + * [#2320](https://github.com/facebookincubator/create-react-app/pull/2320) Remove unnecessary dependencies. ([@pmadar](https://github.com/pmadar)) + +#### Committers: 2 +- Dan Abramov ([gaearon](https://github.com/gaearon)) +- Pavol Madar ([pmadar](https://github.com/pmadar)) + +### Migrating from 1.0.4 to 1.0.5 + +Inside any created project that has not been ejected, run: + +``` +npm install --save-dev --save-exact react-scripts@1.0.5 +``` + +or + +``` +yarn add --dev --exact react-scripts@1.0.5 +``` + ## 1.0.4 (May 22, 2017) #### :bug: Bug Fix @@ -303,6 +385,10 @@ Follow these steps if you see errors about missing lint rules in the editor. If you still have the problem please file an issue. +#### Some of my tests started crashing because of unhandled rejections + +Unhandled Promise rejections will now crash tests. You can fix them by explicitly catching the errors you don’t care about. + #### How to turn my app into a [Progressive Web App](https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md#making-a-progressive-web-app)? After the regular update procedure above, add these line to `
` in `public/index.html`: diff --git a/packages/eslint-config-react-app/index.js b/packages/eslint-config-react-app/index.js index 3dcce554..2cbcae04 100644 --- a/packages/eslint-config-react-app/index.js +++ b/packages/eslint-config-react-app/index.js @@ -195,7 +195,14 @@ module.exports = { ignoreRestSiblings: true, }, ], - 'no-use-before-define': ['warn', 'nofunc'], + 'no-use-before-define': [ + 'warn', + { + functions: false, + classes: false, + variables: false, + }, + ], 'no-useless-computed-key': 'warn', 'no-useless-concat': 'warn', 'no-useless-constructor': 'warn', diff --git a/packages/eslint-config-react-app/package.json b/packages/eslint-config-react-app/package.json index 88fd78a9..87b63c5b 100644 --- a/packages/eslint-config-react-app/package.json +++ b/packages/eslint-config-react-app/package.json @@ -1,6 +1,6 @@ { "name": "eslint-config-react-app", - "version": "1.0.2", + "version": "1.0.4", "description": "ESLint configuration used by Create React App", "repository": "facebookincubator/create-react-app", "license": "BSD-3-Clause", @@ -15,7 +15,7 @@ "eslint": "^3.19.0", "eslint-plugin-flowtype": "^2.33.0", "eslint-plugin-import": "^2.2.0", - "eslint-plugin-jsx-a11y": "^5.0.1", + "eslint-plugin-jsx-a11y": "^5.0.3", "eslint-plugin-react": "^7.0.1" } } diff --git a/packages/react-dev-utils/README.md b/packages/react-dev-utils/README.md index 5daa9f06..166e1bfa 100644 --- a/packages/react-dev-utils/README.md +++ b/packages/react-dev-utils/README.md @@ -283,7 +283,7 @@ Returns a Promise resolving to either `defaultPort` or next available port if th Creates a Webpack compiler instance for WebpackDevServer with built-in helpful messages. Takes the `require('webpack')` entry point as the first argument. To provide the `urls` argument, use `prepareUrls()` described below. -##### `prepareProxy(proxySetting: string): Object` +##### `prepareProxy(proxySetting: string, appPublicFolder: string): Object` Creates a WebpackDevServer `proxy` configuration object from the `proxy` setting in `package.json`. diff --git a/packages/react-dev-utils/WebpackDevServerUtils.js b/packages/react-dev-utils/WebpackDevServerUtils.js index 98ea345e..62eafa40 100644 --- a/packages/react-dev-utils/WebpackDevServerUtils.js +++ b/packages/react-dev-utils/WebpackDevServerUtils.js @@ -9,6 +9,8 @@ 'use strict'; const address = require('address'); +const fs = require('fs'); +const path = require('path'); const url = require('url'); const chalk = require('chalk'); const detect = require('@timer/detect-port'); @@ -191,10 +193,25 @@ function resolveLoopback(proxy) { if (o.hostname !== 'localhost') { return proxy; } - try { + // Unfortunately, many languages (unlike node) do not yet support IPv6. + // This means even though localhost resolves to ::1, the application + // must fall back to IPv4 (on 127.0.0.1). + // We can re-enable this in a few years. + /*try { o.hostname = address.ipv6() ? '::1' : '127.0.0.1'; } catch (_ignored) { o.hostname = '127.0.0.1'; + }*/ + + try { + // Check if we're on a network; if we are, chances are we can resolve + // localhost. Otherwise, we can just be safe and assume localhost is + // IPv4 for maximum compatibility. + if (!address.ip()) { + o.hostname = '127.0.0.1'; + } + } catch (_ignored) { + o.hostname = '127.0.0.1'; } return url.format(o); } @@ -240,7 +257,7 @@ function onProxyError(proxy) { }; } -function prepareProxy(proxy) { +function prepareProxy(proxy, appPublicFolder) { // `proxy` lets you specify alternate servers for specific requests. // It can either be a string or an object conforming to the Webpack dev server proxy configuration // https://webpack.github.io/docs/webpack-dev-server.html @@ -264,13 +281,11 @@ function prepareProxy(proxy) { process.exit(1); } - // Otherwise, if proxy is specified, we will let it handle any request. - // There are a few exceptions which we won't send to the proxy: - // - /index.html (served as HTML5 history API fallback) - // - /*.hot-update.json (WebpackDevServer uses this too for hot reloading) - // - /sockjs-node/* (WebpackDevServer uses this for hot reloading) - // Tip: use https://jex.im/regulex/ to visualize the regex - const mayProxy = /^(?!\/(index\.html$|.*\.hot-update\.json$|sockjs-node\/)).*$/; + // Otherwise, if proxy is specified, we will let it handle any request except for files in the public folder. + function mayProxy(pathname) { + const maybePublicPath = path.resolve(appPublicFolder, pathname.slice(1)); + return !fs.existsSync(maybePublicPath); + } // Support proxy as a string for those who are using the simple proxy option if (typeof proxy === 'string') { @@ -301,7 +316,7 @@ function prepareProxy(proxy) { // However API calls like `fetch()` won’t generally accept text/html. // If this heuristic doesn’t work well for you, use a custom `proxy` object. context: function(pathname, req) { - return mayProxy.test(pathname) && + return mayProxy(pathname) && req.headers.accept && req.headers.accept.indexOf('text/html') === -1; }, @@ -341,7 +356,7 @@ function prepareProxy(proxy) { } return Object.assign({}, proxy[context], { context: function(pathname) { - return mayProxy.test(pathname) && pathname.match(context); + return mayProxy(pathname) && pathname.match(context); }, onProxyReq: proxyReq => { // Browers may send Origin headers even with same-origin diff --git a/packages/react-dev-utils/crossSpawn.js b/packages/react-dev-utils/crossSpawn.js new file mode 100644 index 00000000..8424dcf0 --- /dev/null +++ b/packages/react-dev-utils/crossSpawn.js @@ -0,0 +1,14 @@ +/** + * Copyright (c) 2015-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + */ + +'use strict'; + +var crossSpawn = require('cross-spawn'); + +module.exports = crossSpawn; diff --git a/packages/react-dev-utils/package.json b/packages/react-dev-utils/package.json index 16eb847e..f62d87f8 100644 --- a/packages/react-dev-utils/package.json +++ b/packages/react-dev-utils/package.json @@ -1,6 +1,6 @@ { "name": "react-dev-utils", - "version": "1.0.3", + "version": "2.0.1", "description": "Webpack utilities used by Create React App", "repository": "facebookincubator/create-react-app", "license": "BSD-3-Clause", @@ -15,6 +15,7 @@ "checkRequiredFiles.js", "clearConsole.js", "crashOverlay.js", + "crossSpawn.js", "eslintFormatter.js", "FileSizeReporter.js", "formatWebpackMessages.js", diff --git a/packages/react-dev-utils/webpackHotDevClient.js b/packages/react-dev-utils/webpackHotDevClient.js index cf4deae7..7d6a979e 100644 --- a/packages/react-dev-utils/webpackHotDevClient.js +++ b/packages/react-dev-utils/webpackHotDevClient.js @@ -228,6 +228,13 @@ function handleWarnings(warnings) { if (typeof console !== 'undefined' && typeof console.warn === 'function') { for (var i = 0; i < formatted.warnings.length; i++) { + if (i === 5) { + console.warn( + 'There were more warnings in other files.\n' + + 'You can find a complete log in the terminal.' + ); + break; + } console.warn(stripAnsi(formatted.warnings[i])); } } diff --git a/packages/react-error-overlay/.flowconfig b/packages/react-error-overlay/.flowconfig index 1e3f6de4..261b8646 100644 --- a/packages/react-error-overlay/.flowconfig +++ b/packages/react-error-overlay/.flowconfig @@ -1,5 +1,4 @@ [ignore] -