mirror of
https://github.com/zhigang1992/create-react-app.git
synced 2026-06-16 10:24:16 +08:00
Merge remote-tracking branch 'facebook/master'
This commit is contained in:
86
CHANGELOG.md
86
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 `<head>` in `public/index.html`:
|
||||
|
||||
@@ -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',
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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`.
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
14
packages/react-dev-utils/crossSpawn.js
vendored
Normal file
14
packages/react-dev-utils/crossSpawn.js
vendored
Normal file
@@ -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;
|
||||
@@ -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",
|
||||
|
||||
@@ -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]));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
[ignore]
|
||||
<PROJECT_ROOT>/node_modules/eslint-plugin-jsx-a11y/.*
|
||||
|
||||
[include]
|
||||
src/**/*.js
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "react-error-overlay",
|
||||
"version": "1.0.3",
|
||||
"version": "1.0.6",
|
||||
"description": "An overlay for displaying stack frames.",
|
||||
"main": "lib/index.js",
|
||||
"scripts": {
|
||||
@@ -34,7 +34,7 @@
|
||||
"anser": "1.2.5",
|
||||
"babel-code-frame": "6.22.0",
|
||||
"babel-runtime": "6.23.0",
|
||||
"react-dev-utils": "^1.0.3",
|
||||
"react-dev-utils": "^2.0.1",
|
||||
"settle-promise": "1.0.0",
|
||||
"source-map": "0.5.6"
|
||||
},
|
||||
@@ -44,10 +44,10 @@
|
||||
"babel-preset-react-app": "^3.0.0",
|
||||
"cross-env": "5.0.0",
|
||||
"eslint": "3.19.0",
|
||||
"eslint-config-react-app": "^1.0.2",
|
||||
"eslint-config-react-app": "^1.0.4",
|
||||
"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",
|
||||
"flow-bin": "0.46.0",
|
||||
"jest": "20.0.1",
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
const spawn = require('cross-spawn');
|
||||
const spawn = require('react-dev-utils/crossSpawn');
|
||||
const script = process.argv[2];
|
||||
const args = process.argv.slice(3);
|
||||
|
||||
|
||||
@@ -303,7 +303,12 @@ module.exports = {
|
||||
console.log(message);
|
||||
},
|
||||
minify: true,
|
||||
// For unknown URLs, fallback to the index page
|
||||
navigateFallback: publicUrl + '/index.html',
|
||||
// Ignores URLs starting from /__ (useful for Firebase):
|
||||
// https://github.com/facebookincubator/create-react-app/issues/2237#issuecomment-302693219
|
||||
navigateFallbackWhitelist: [/^(?!\/__).*/],
|
||||
// Don't precache sourcemaps (they're large) and build asset manifest:
|
||||
staticFileGlobsIgnorePatterns: [/\.map$/, /asset-manifest\.json$/],
|
||||
// Work around Windows path issue in SWPrecacheWebpackPlugin:
|
||||
// https://github.com/facebookincubator/create-react-app/issues/2235
|
||||
|
||||
@@ -27,8 +27,6 @@
|
||||
"case-sensitive-paths-webpack-plugin": "2.0.0",
|
||||
"chalk": "1.1.3",
|
||||
"cli-highlight": "1.1.4",
|
||||
"connect-history-api-fallback": "1.3.0",
|
||||
"cross-spawn": "4.0.2",
|
||||
"css-loader": "0.28.1",
|
||||
"dotenv": "4.0.0",
|
||||
"extract-text-webpack-plugin": "2.1.0",
|
||||
@@ -40,8 +38,8 @@
|
||||
"postcss-flexbugs-fixes": "3.0.0",
|
||||
"postcss-loader": "2.0.5",
|
||||
"promise": "7.1.1",
|
||||
"react-dev-utils": "^1.0.2",
|
||||
"react-error-overlay": "^1.0.2",
|
||||
"react-dev-utils": "^2.0.1",
|
||||
"react-error-overlay": "^1.0.6",
|
||||
"style-loader": "0.17.0",
|
||||
"ts-loader": "^2.0.3",
|
||||
"tslint": "^5.2.0",
|
||||
@@ -51,7 +49,7 @@
|
||||
"source-map-loader": "^0.2.1",
|
||||
"sw-precache-webpack-plugin": "0.9.1",
|
||||
"url-loader": "0.5.8",
|
||||
"webpack": "2.5.1",
|
||||
"webpack": "2.6.0",
|
||||
"webpack-dev-server": "2.4.5",
|
||||
"webpack-manifest-plugin": "1.1.0",
|
||||
"whatwg-fetch": "2.0.3"
|
||||
|
||||
2
packages/react-scripts/scripts/eject.js
vendored
2
packages/react-scripts/scripts/eject.js
vendored
@@ -19,11 +19,11 @@ process.on('unhandledRejection', err => {
|
||||
const fs = require('fs-extra');
|
||||
const path = require('path');
|
||||
const execSync = require('child_process').execSync;
|
||||
const spawnSync = require('cross-spawn').sync;
|
||||
const chalk = require('chalk');
|
||||
const paths = require('../config/paths');
|
||||
const createJestConfig = require('./utils/createJestConfig');
|
||||
const inquirer = require('react-dev-utils/inquirer');
|
||||
const spawnSync = require('react-dev-utils/crossSpawn').sync;
|
||||
|
||||
const green = chalk.green;
|
||||
const cyan = chalk.cyan;
|
||||
|
||||
2
packages/react-scripts/scripts/init.js
vendored
2
packages/react-scripts/scripts/init.js
vendored
@@ -18,8 +18,8 @@ process.on('unhandledRejection', err => {
|
||||
|
||||
const fs = require('fs-extra');
|
||||
const path = require('path');
|
||||
const spawn = require('cross-spawn');
|
||||
const chalk = require('chalk');
|
||||
const spawn = require('react-dev-utils/crossSpawn');
|
||||
|
||||
module.exports = function(
|
||||
appPath,
|
||||
|
||||
2
packages/react-scripts/scripts/start.js
vendored
2
packages/react-scripts/scripts/start.js
vendored
@@ -66,7 +66,7 @@ choosePort(HOST, DEFAULT_PORT)
|
||||
const compiler = createCompiler(webpack, config, appName, urls, useYarn);
|
||||
// Load proxy config
|
||||
const proxySetting = require(paths.appPackageJson).proxy;
|
||||
const proxyConfig = prepareProxy(proxySetting);
|
||||
const proxyConfig = prepareProxy(proxySetting, paths.appPublic);
|
||||
// Serve webpack assets generated by the compiler over a web sever.
|
||||
const serverConfig = createDevServerConfig(
|
||||
proxyConfig,
|
||||
|
||||
@@ -1403,7 +1403,7 @@ If your production web server does not support HTTPS, then the service worker
|
||||
registration will fail, but the rest of your web app will remain functional.
|
||||
|
||||
1. Service workers are [not currently supported](https://jakearchibald.github.io/isserviceworkerready/)
|
||||
in all web browsers. Service worker registration [won't be attempted](src/service-worker-registration.js)
|
||||
in all web browsers. Service worker registration [won't be attempted](src/registerServiceWorker.js)
|
||||
on browsers that lack support.
|
||||
|
||||
1. The service worker is only enabled in the [production environment](#deployment),
|
||||
@@ -1419,7 +1419,7 @@ instructions for one way to test your production build locally and the [deployme
|
||||
instructions for using other methods. *Be sure to always use an
|
||||
incognito window to avoid complications with your browser cache.*
|
||||
|
||||
1. If possible,configure your production environment to serve the generated
|
||||
1. If possible, configure your production environment to serve the generated
|
||||
`service-worker.js` [with HTTP caching disabled](http://stackoverflow.com/questions/38843970/service-worker-javascript-update-frequency-every-24-hours).
|
||||
If that's not possible—[GitHub Pages](#github-pages), for instance, does not
|
||||
allow you to change the default 10 minute HTTP cache lifetime—then be aware
|
||||
@@ -1437,7 +1437,7 @@ app works offline!" message) and also let them know when the service worker has
|
||||
fetched the latest updates that will be available the next time they load the
|
||||
page (showing a "New content is available; please refresh." message). Showing
|
||||
this messages is currently left as an exercise to the developer, but as a
|
||||
starting point, you can make use of the logic included in [`src/service-worker-registration.js`](src/service-worker-registration.js), which
|
||||
starting point, you can make use of the logic included in [`src/registerServiceWorker.js`](src/registerServiceWorker.js), which
|
||||
demonstrates which service worker lifecycle events to listen for to detect each
|
||||
scenario, and which as a default, just logs appropriate messages to the
|
||||
JavaScript console.
|
||||
|
||||
Reference in New Issue
Block a user