From 238af4b1dac7e2e2026217c9d07eb58ba8422b2d Mon Sep 17 00:00:00 2001 From: Joe Haddad Date: Fri, 12 Jan 2018 22:14:27 -0500 Subject: [PATCH 0001/1323] Enable Yarn check files (#3769) * This is a good default. Adds approx 4 seconds to install time, but can save some headaches. * Add no lockfile for add, too --- .yarnrc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.yarnrc b/.yarnrc index acaaffdb73e..07e44a9a5b2 100644 --- a/.yarnrc +++ b/.yarnrc @@ -1 +1,3 @@ --install.no-lockfile true +--install.check-files true +--add.no-lockfile true From a3d33c46084d88ece2c5ab49e61e5fc62f3a8187 Mon Sep 17 00:00:00 2001 From: Dan Abramov Date: Sun, 14 Jan 2018 02:48:15 +0000 Subject: [PATCH 0002/1323] Add an explicit link to Code of Conduct (#3781) All FB open source projects including this one enforce [our code of conduct](https://code.facebook.com/pages/876921332402685/open-source-code-of-conduct), but I just realized we haven't explicitly linked to it from a Markdown file. So I'm doing just that. --- CODE_OF_CONDUCT.md | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 CODE_OF_CONDUCT.md diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 00000000000..55203be746a --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,3 @@ +# Code of Conduct + +Facebook has adopted a Code of Conduct that we expect project participants to adhere to. Please [read the full text](https://code.facebook.com/pages/876921332402685/open-source-code-of-conduct) so that you can understand what actions will and will not be tolerated. From 585608e3d6c33d99f53f3b14ead39c8eb069abbf Mon Sep 17 00:00:00 2001 From: Dan Abramov Date: Sun, 14 Jan 2018 10:24:00 +0000 Subject: [PATCH 0003/1323] Update opn (#3784) --- packages/react-dev-utils/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/react-dev-utils/package.json b/packages/react-dev-utils/package.json index 54606f33fe8..d6fe1bd3e45 100644 --- a/packages/react-dev-utils/package.json +++ b/packages/react-dev-utils/package.json @@ -47,7 +47,7 @@ "gzip-size": "3.0.0", "inquirer": "3.3.0", "is-root": "1.0.0", - "opn": "5.1.0", + "opn": "5.2.0", "react-error-overlay": "^3.0.0", "recursive-readdir": "2.2.1", "shell-quote": "1.6.1", From 77148107d9f3b20fb874a8da3146172c34e921db Mon Sep 17 00:00:00 2001 From: Dan Abramov Date: Sun, 14 Jan 2018 11:52:10 +0000 Subject: [PATCH 0004/1323] Add npx note to quick overview --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index d6945417abf..b09630e90ba 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,8 @@ cd my-app npm start ``` +*([npx](https://medium.com/@maybekatz/introducing-npx-an-npm-package-runner-55f7d4bd282b) comes with npm 5.2+ and higher, see [instructions for older npm versions](https://gist.github.com/gaearon/4064d3c23a77c74a3614c498a8bb1c5f))* + Then open [http://localhost:3000/](http://localhost:3000/) to see your app.
When you’re ready to deploy to production, create a minified bundle with `npm run build`. From 1e9eaf3630cbce6eeb54f456b847133d2309c378 Mon Sep 17 00:00:00 2001 From: Dan Abramov Date: Sun, 14 Jan 2018 15:05:38 +0000 Subject: [PATCH 0005/1323] Bump detect-port-alt (#3787) * Bump detect-port-alt * Bump again --- packages/react-dev-utils/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/react-dev-utils/package.json b/packages/react-dev-utils/package.json index d6fe1bd3e45..d4b933f7183 100644 --- a/packages/react-dev-utils/package.json +++ b/packages/react-dev-utils/package.json @@ -40,7 +40,7 @@ "babel-code-frame": "6.26.0", "chalk": "1.1.3", "cross-spawn": "5.1.0", - "detect-port-alt": "1.1.3", + "detect-port-alt": "1.1.5", "escape-string-regexp": "1.0.5", "filesize": "3.5.11", "global-modules": "1.0.0", From 22f9fe0d33dded7ec5a361ef08f69167874a4eb7 Mon Sep 17 00:00:00 2001 From: Dan Abramov Date: Sun, 14 Jan 2018 15:37:00 +0000 Subject: [PATCH 0006/1323] Always include destructuring transform (#3788) * Always include destructuring transform * Fix lint --- packages/babel-preset-react-app/index.js | 4 ++++ packages/babel-preset-react-app/package.json | 1 + .../kitchensink/src/features/syntax/ObjectDestructuring.js | 4 +++- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/babel-preset-react-app/index.js b/packages/babel-preset-react-app/index.js index 0d961af6f0f..d90fb6af50b 100644 --- a/packages/babel-preset-react-app/index.js +++ b/packages/babel-preset-react-app/index.js @@ -7,6 +7,10 @@ 'use strict'; const plugins = [ + // Necessary to include regardless of the environment because + // in practice some other transforms (such as object-rest-spread) + // don't work without it: https://github.com/babel/babel/issues/7215 + require.resolve('babel-plugin-transform-es2015-destructuring'), // class { handleClick = () => { } } require.resolve('babel-plugin-transform-class-properties'), // The following two plugins use Object.assign directly, instead of Babel's diff --git a/packages/babel-preset-react-app/package.json b/packages/babel-preset-react-app/package.json index f020f99e0b8..23c22142334 100644 --- a/packages/babel-preset-react-app/package.json +++ b/packages/babel-preset-react-app/package.json @@ -14,6 +14,7 @@ "babel-plugin-dynamic-import-node": "1.1.0", "babel-plugin-syntax-dynamic-import": "6.18.0", "babel-plugin-transform-class-properties": "6.24.1", + "babel-plugin-transform-es2015-destructuring": "6.23.0", "babel-plugin-transform-object-rest-spread": "6.26.0", "babel-plugin-transform-react-constant-elements": "6.23.0", "babel-plugin-transform-react-jsx": "6.24.1", diff --git a/packages/react-scripts/fixtures/kitchensink/src/features/syntax/ObjectDestructuring.js b/packages/react-scripts/fixtures/kitchensink/src/features/syntax/ObjectDestructuring.js index be519175f69..14b06f7a4cc 100644 --- a/packages/react-scripts/fixtures/kitchensink/src/features/syntax/ObjectDestructuring.js +++ b/packages/react-scripts/fixtures/kitchensink/src/features/syntax/ObjectDestructuring.js @@ -40,7 +40,9 @@ export default class extends Component { return (
{this.state.users.map(user => { - const { id, name } = user; + const { id, ...rest } = user; + // eslint-disable-next-line no-unused-vars + const [{ name, ...innerRest }] = [{ ...rest }]; return
{name}
; })}
From b86fe056a36c2da948e9c3ad363217712b4a37bc Mon Sep 17 00:00:00 2001 From: Ian Sutherland Date: Sun, 14 Jan 2018 12:14:37 -0700 Subject: [PATCH 0007/1323] Add warning when HOST environment variable is set (#3730) * Add warning when HOST environment variable is set (#3719) * Improve HOST environment variable warning message * Adjust text and message Closes #3719 --- packages/react-scripts/scripts/start.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/packages/react-scripts/scripts/start.js b/packages/react-scripts/scripts/start.js index 7eb7ad464c0..3ff1b91f435 100644 --- a/packages/react-scripts/scripts/start.js +++ b/packages/react-scripts/scripts/start.js @@ -51,6 +51,21 @@ if (!checkRequiredFiles([paths.appHtml, paths.appIndexJs])) { const DEFAULT_PORT = parseInt(process.env.PORT, 10) || 3000; const HOST = process.env.HOST || '0.0.0.0'; +if (process.env.HOST) { + console.log( + chalk.cyan( + `Attempting to bind to HOST environment variable: ${chalk.yellow( + chalk.bold(process.env.HOST) + )}` + ) + ); + console.log( + `If this was unintentional, check that you haven't mistakenly set it in your shell.` + ); + console.log(`Learn more here: ${chalk.yellow('http://bit.ly/2mwWSwH')}`); + console.log(); +} + // We attempt to use the default port but if it is busy, we offer the user to // run on a different port. `choosePort()` Promise resolves to the next free port. choosePort(HOST, DEFAULT_PORT) From 12d05447b925f121c9b03954b59c6378bf783693 Mon Sep 17 00:00:00 2001 From: Dan Abramov Date: Sun, 14 Jan 2018 23:57:49 +0000 Subject: [PATCH 0008/1323] Test Node 9 on CI (#3793) * Test Node 9 on CI * Oops --- .travis.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index ef223ffd5e4..860000b5c9b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,8 +2,8 @@ dist: trusty language: node_js node_js: - - 6 - 8 + - 9 cache: directories: - node_modules @@ -24,3 +24,5 @@ matrix: include: - node_js: 0.10 env: TEST_SUITE=old-node + - node_js: 6 + env: TEST_SUITE=kitchensink From 95b26012a4a0debeef98c8bc69214db3a83b5646 Mon Sep 17 00:00:00 2001 From: Dan Abramov Date: Mon, 15 Jan 2018 00:36:53 +0000 Subject: [PATCH 0009/1323] Tweak section on expanding env variables --- packages/react-scripts/template/README.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/react-scripts/template/README.md b/packages/react-scripts/template/README.md index e5c0cf6bf77..7c641456056 100644 --- a/packages/react-scripts/template/README.md +++ b/packages/react-scripts/template/README.md @@ -980,17 +980,20 @@ these defined as well. Consult their documentation how to do this. For example, #### Expanding Environment Variables In `.env` ->Note: this feature is available with `react-scripts@1.0.18` and higher. +>Note: this feature is available with `react-scripts@1.1.0` and higher. -Expand variables already on your machine for use in your .env file (using [dotenv-expand](https://github.com/motdotla/dotenv-expand)). See [#2223](https://github.com/facebookincubator/create-react-app/issues/2223). +Expand variables already on your machine for use in your `.env` file (using [dotenv-expand](https://github.com/motdotla/dotenv-expand)). For example, to get the environment variable `npm_package_version`: + ``` REACT_APP_VERSION=$npm_package_version # also works: # REACT_APP_VERSION=${npm_package_version} ``` + Or expand variables local to the current `.env` file: + ``` DOMAIN=www.example.com REACT_APP_FOO=$DOMAIN/foo From aa5bdcd05f490e9e1b529a45deb1f0ab6fa487fa Mon Sep 17 00:00:00 2001 From: Dan Abramov Date: Mon, 15 Jan 2018 00:37:46 +0000 Subject: [PATCH 0010/1323] Changelog for 1.1.0 (#3795) --- CHANGELOG.md | 187 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 187 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f233de0ade8..a2dfec8fec6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,190 @@ +## 1.1.0 (January 15, 2018) + +#### :rocket: New Feature + +* `react-scripts` + + * [#3387](https://github.com/facebookincubator/create-react-app/pull/3387) Add support for variable expansion in `.env` files. ([@moos](https://github.com/moos)) + +* `react-error-overlay` + + * [#3474](https://github.com/facebookincubator/create-react-app/pull/3474) Allow the error overlay to be unregistered. ([@Timer](https://github.com/Timer)) + +* `create-react-app` + + * [#3408](https://github.com/facebookincubator/create-react-app/pull/3408) Add `--info` flag to help gather bug reports. ([@tabrindle](https://github.com/tabrindle)) + * [#3409](https://github.com/facebookincubator/create-react-app/pull/3409) Add `--use-npm` flag to bypass Yarn even on systems that have it. ([@tabrindle](https://github.com/tabrindle)) + * [#3725](https://github.com/facebookincubator/create-react-app/pull/3725) Extend `--scripts-version` to include `.tar.gz` format. ([@SaschaDens](https://github.com/SaschaDens)) + * [#3629](https://github.com/facebookincubator/create-react-app/pull/3629) Allowing `"file:"` `--scripts-version` values. ([@GreenGremlin](https://github.com/GreenGremlin)) + + +#### :bug: Bug Fix + +* `babel-preset-react-app`, `react-scripts` + + * [#3788](https://github.com/facebookincubator/create-react-app/pull/3788) Fix object destructuring inside an array on Node 6. ([@gaearon](https://github.com/gaearon)) + +* `react-dev-utils` + + * [#3784](https://github.com/facebookincubator/create-react-app/pull/3784) Detach browser process from the shell on Linux. ([@gaearon](https://github.com/gaearon)) + * [#3726](https://github.com/facebookincubator/create-react-app/pull/3726) Use proxy for all request methods other than `GET`. ([@doshisid](https://github.com/doshisid)) + * [#3440](https://github.com/facebookincubator/create-react-app/pull/3440) Print full directory name from `lsof`. ([@rmccue](https://github.com/rmccue)) + * [#2071](https://github.com/facebookincubator/create-react-app/pull/2071) Fix broken console clearing on Windows. ([@danielverejan](https://github.com/danielverejan)) + * [#3686](https://github.com/facebookincubator/create-react-app/pull/3686) Fix starting a project in directory with `++` in the name. ([@Norris1z](https://github.com/Norris1z)) + +* `create-react-app` + + * [#3320](https://github.com/facebookincubator/create-react-app/pull/3320) Fix offline installation to respect proxy from `.npmrc`. ([@mdogadailo](https://github.com/mdogadailo)) + +* `react-scripts` + + * [#3537](https://github.com/facebookincubator/create-react-app/pull/3537) Add `mjs` and `jsx` filename extensions to `file-loader` exclude pattern. ([@iansu](https://github.com/iansu)) + * [#3511](https://github.com/facebookincubator/create-react-app/pull/3511) Unmount the component in the default generated test. ([@gaearon](https://github.com/gaearon)) + +#### :nail_care: Enhancement + +* `react-scripts` + + * [#3730](https://github.com/facebookincubator/create-react-app/pull/3730) Print when `HOST` environment variable is set. ([@iansu](https://github.com/iansu)) + * [#3455](https://github.com/facebookincubator/create-react-app/pull/3455) Add a localhost-only log message pointing folks to the PWA docs. ([@jeffposnick](https://github.com/jeffposnick)) + * [#3416](https://github.com/facebookincubator/create-react-app/pull/3416) Improve eject message. ([@xjlim](https://github.com/xjlim)) + +* `create-react-app` + + * [#3740](https://github.com/facebookincubator/create-react-app/pull/3740) Allow more non-conflicting files in initial project directory. ([@GreenGremlin](https://github.com/GreenGremlin)) + +* `react-dev-utils` + + * [#3104](https://github.com/facebookincubator/create-react-app/pull/3104) Add link to deployment docs after build. ([@viankakrisna](https://github.com/viankakrisna)) + * [#3652](https://github.com/facebookincubator/create-react-app/pull/3652) Add `code-insiders` to the editor list. ([@shrynx](https://github.com/shrynx)) + * [#3700](https://github.com/facebookincubator/create-react-app/pull/3700) Add editor support for Sublime Dev & VSCode Insiders. ([@yyx990803](https://github.com/yyx990803)) + * [#3545](https://github.com/facebookincubator/create-react-app/pull/3545) Autodetect MacVim editor. ([@gnapse](https://github.com/gnapse)) + +* `react-dev-utils`, `react-error-overlay` + + * [#3465](https://github.com/facebookincubator/create-react-app/pull/3465) Open editor to exact column from build error overlay. ([@tharakawj](https://github.com/tharakawj)) + +* `react-dev-utils`, `react-scripts` + + * [#3721](https://github.com/facebookincubator/create-react-app/pull/3721) Support setting `none` in `REACT_EDITOR` environment variable. ([@raerpo](https://github.com/raerpo)) + +* `eslint-config-react-app` + + * [#3716](https://github.com/facebookincubator/create-react-app/pull/3716) Relax `no-cond-assign` rule. ([@gaearon](https://github.com/gaearon)) + +#### :memo: Documentation + +* User Guide + + * [#3659](https://github.com/facebookincubator/create-react-app/pull/3659) Add info about service-worker and HTTP caching headers into Firebase section. ([@bobrosoft](https://github.com/bobrosoft)) + * [#3515](https://github.com/facebookincubator/create-react-app/pull/3515) Add Powershell commands to README.md. ([@Gua-naiko-che](https://github.com/Gua-naiko-che)) + * [#3656](https://github.com/facebookincubator/create-react-app/pull/3656) Better documentation for setupTests.js when ejecting. ([@dannycalleri](https://github.com/dannycalleri)) + * [#1791](https://github.com/facebookincubator/create-react-app/pull/1791) Add link for automatic deployment to azure. ([@ulrikstrid](https://github.com/ulrikstrid)) + * [#3717](https://github.com/facebookincubator/create-react-app/pull/3717) Update README.md. ([@maecapozzi](https://github.com/maecapozzi)) + * [#3710](https://github.com/facebookincubator/create-react-app/pull/3710) Link to an explanation for forking react-scripts. ([@gaearon](https://github.com/gaearon)) + * [#3709](https://github.com/facebookincubator/create-react-app/pull/3709) Document adding a router. ([@gaearon](https://github.com/gaearon)) + * [#3670](https://github.com/facebookincubator/create-react-app/pull/3670) Fix typo in the User Guide. ([@qbahers](https://github.com/qbahers)) + * [#3645](https://github.com/facebookincubator/create-react-app/pull/3645) Update README.md. ([@elie222](https://github.com/elie222)) + * [#3533](https://github.com/facebookincubator/create-react-app/pull/3533) Use safer/more aesthetic syntax for setting environment variables on Windows. ([@cdanielsen](https://github.com/cdanielsen)) + * [#3605](https://github.com/facebookincubator/create-react-app/pull/3605) Updated Debugging Tests for VSCode. ([@amadeogallardo](https://github.com/amadeogallardo)) + * [#3601](https://github.com/facebookincubator/create-react-app/pull/3601) Fixed typo in webpack.config.dev.js. ([@nmenglund](https://github.com/nmenglund)) + * [#3576](https://github.com/facebookincubator/create-react-app/pull/3576) Updates comment to reflect codebase. ([@rahulcs](https://github.com/rahulcs)) + * [#3510](https://github.com/facebookincubator/create-react-app/pull/3510) Update User Guide with deploying to GitHub User pages. ([@aaronlna](https://github.com/aaronlna)) + * [#3503](https://github.com/facebookincubator/create-react-app/pull/3503) Update Prettier editor integration link. ([@gaving](https://github.com/gaving)) + * [#3453](https://github.com/facebookincubator/create-react-app/pull/3453) Fix dead links. ([@vannio](https://github.com/vannio)) + * [#2992](https://github.com/facebookincubator/create-react-app/pull/2992) Docs: How to Debug Unit Tests. ([@MattMorgis](https://github.com/MattMorgis)) + +* Other + + * [#3729](https://github.com/facebookincubator/create-react-app/pull/3729) Update README.md to note Neutrino's support of react components. ([@eliperelman](https://github.com/eliperelman)) + * [#2841](https://github.com/facebookincubator/create-react-app/pull/2841) Documentation to help windows contributors. ([@Dubes](https://github.com/Dubes)) + * [#3489](https://github.com/facebookincubator/create-react-app/pull/3489) Add link to nvm-windows. ([@davidgilbertson](https://github.com/davidgilbertson)) + +* `eslint-config-react-app` + + * [#3460](https://github.com/facebookincubator/create-react-app/pull/3460) Fix broken link to `href-no-hash` eslint rule. ([@hazolsky](https://github.com/hazolsky)) + +#### :house: Internal + +* Other + + * [#3769](https://github.com/facebookincubator/create-react-app/pull/3769) Enable Yarn check files. ([@Timer](https://github.com/Timer)) + * [#3756](https://github.com/facebookincubator/create-react-app/pull/3756) Clean up changes to npm and yarn registry in E2E tests. ([@viankakrisna](https://github.com/viankakrisna)) + * [#3744](https://github.com/facebookincubator/create-react-app/pull/3744) Use private registry in E2E tests. ([@Timer](https://github.com/Timer)) + * [#3738](https://github.com/facebookincubator/create-react-app/pull/3738) Always use Yarn on CI. ([@gaearon](https://github.com/gaearon)) + * [#2309](https://github.com/facebookincubator/create-react-app/pull/2309) Port `cra.sh` development task to javascript. ([@ianschmitz](https://github.com/ianschmitz)) + * [#3411](https://github.com/facebookincubator/create-react-app/pull/3411) Simplify waiting for app start in E2E tests. ([@xjlim](https://github.com/xjlim)) + * [#3755](https://github.com/facebookincubator/create-react-app/pull/3755) Switch to Yarn Workspaces. ([@gaearon](https://github.com/gaearon)) + * [#3757](https://github.com/facebookincubator/create-react-app/pull/3757) Try updating Flow. ([@gaearon](https://github.com/gaearon)) + * [#3414](https://github.com/facebookincubator/create-react-app/pull/3414) Export `dismissRuntimeErrors` function. ([@skidding](https://github.com/skidding)) + * [#3036](https://github.com/facebookincubator/create-react-app/pull/3036) Cleaning up `printHostingInstructions` a bit. ([@GreenGremlin](https://github.com/GreenGremlin)) + * [#3514](https://github.com/facebookincubator/create-react-app/pull/3514) Fix `FileSizeReporter` for multi build Webpack setups. ([@iiska](https://github.com/iiska)) + * [#3362](https://github.com/facebookincubator/create-react-app/pull/3362) Refactor extra watch options regex to `react-dev-utils`. ([@xjlim](https://github.com/xjlim)) + +#### Committers: 47 + +- Aaron Lamb ([aaronlna](https://github.com/aaronlna)) +- Ade Viankakrisna Fadlil ([viankakrisna](https://github.com/viankakrisna)) +- Amadeo Gallardo ([amadeogallardo](https://github.com/amadeogallardo)) +- Andy Kenward ([andykenward](https://github.com/andykenward)) +- Christian Danielsen ([cdanielsen](https://github.com/cdanielsen)) +- Clayton Ray ([iamclaytonray](https://github.com/iamclaytonray)) +- Dan Abramov ([gaearon](https://github.com/gaearon)) +- Daniel Verejan ([danielverejan](https://github.com/danielverejan)) +- Danny Calleri ([dannycalleri](https://github.com/dannycalleri)) +- David Boyne ([boyney123](https://github.com/boyney123)) +- David Gilbertson ([davidgilbertson](https://github.com/davidgilbertson)) +- Eli Perelman ([eliperelman](https://github.com/eliperelman)) +- Elie ([elie222](https://github.com/elie222)) +- Ernesto García ([gnapse](https://github.com/gnapse)) +- Evan You ([yyx990803](https://github.com/yyx990803)) +- Gavin Gilmour ([gaving](https://github.com/gaving)) +- Ian Schmitz ([ianschmitz](https://github.com/ianschmitz)) +- Ian Sutherland ([iansu](https://github.com/iansu)) +- JANG SUN HYUK ([wkdtjsgur100](https://github.com/wkdtjsgur100)) +- Jeffrey Posnick ([jeffposnick](https://github.com/jeffposnick)) +- Joe Haddad ([Timer](https://github.com/Timer)) +- Joe Lim ([xjlim](https://github.com/xjlim)) +- Jonathan ([GreenGremlin](https://github.com/GreenGremlin)) +- Juhamatti Niemelä ([iiska](https://github.com/iiska)) +- Mae Capozzi ([maecapozzi](https://github.com/maecapozzi)) +- Maksym Dogadailo ([mdogadailo](https://github.com/mdogadailo)) +- Mario Nebl ([marionebl](https://github.com/marionebl)) +- Matt Morgis ([MattMorgis](https://github.com/MattMorgis)) +- Misha Khokhlov ([hazolsky](https://github.com/hazolsky)) +- Moos ([moos](https://github.com/moos)) +- Nils Magnus Englund ([nmenglund](https://github.com/nmenglund)) +- Norris Oduro ([Norris1z](https://github.com/Norris1z)) +- Ovidiu Cherecheș ([skidding](https://github.com/skidding)) +- Quentin Bahers ([qbahers](https://github.com/qbahers)) +- Rafael E. Poveda ([raerpo](https://github.com/raerpo)) +- Rahul Chanila ([rahulcs](https://github.com/rahulcs)) +- Ryan McCue ([rmccue](https://github.com/rmccue)) +- Sascha Dens ([SaschaDens](https://github.com/SaschaDens)) +- Siddharth Doshi ([doshisid](https://github.com/doshisid)) +- Tao Gómez Gil ([Gua-naiko-che](https://github.com/Gua-naiko-che)) +- Tharaka Wijebandara ([tharakawj](https://github.com/tharakawj)) +- Trevor Brindle ([tabrindle](https://github.com/tabrindle)) +- Ulrik Strid ([ulrikstrid](https://github.com/ulrikstrid)) +- Vladimir Tolstikov ([bobrosoft](https://github.com/bobrosoft)) +- [Dubes](https://github.com/Dubes) +- [vannio](https://github.com/vannio) +- shrynx ([shrynx](https://github.com/shrynx)) + +### Migrating from 1.0.17 to 1.1.0 + +Inside any created project that has not been ejected, run: + +``` +npm install --save --save-exact react-scripts@1.1.0 +``` + +or + +``` +yarn add --exact react-scripts@1.1.0 +``` + ## 1.0.17 (November 3, 2017) #### :nail_care: Enhancement From e73a783ef1f0deec3401f1d0c853a30b6c88bf71 Mon Sep 17 00:00:00 2001 From: Dan Date: Mon, 15 Jan 2018 00:53:37 +0000 Subject: [PATCH 0011/1323] Publish - babel-preset-react-app@3.1.1 - create-react-app@1.5.0 - eslint-config-react-app@2.1.0 - react-dev-utils@5.0.0 - react-error-overlay@4.0.0 - react-scripts@1.1.0 --- packages/babel-preset-react-app/package.json | 2 +- packages/create-react-app/package.json | 2 +- packages/eslint-config-react-app/package.json | 2 +- packages/react-dev-utils/package.json | 4 ++-- packages/react-error-overlay/package.json | 6 +++--- packages/react-scripts/package.json | 8 ++++---- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/packages/babel-preset-react-app/package.json b/packages/babel-preset-react-app/package.json index 23c22142334..c6a7e29441d 100644 --- a/packages/babel-preset-react-app/package.json +++ b/packages/babel-preset-react-app/package.json @@ -1,6 +1,6 @@ { "name": "babel-preset-react-app", - "version": "3.1.0", + "version": "3.1.1", "description": "Babel preset used by Create React App", "repository": "facebookincubator/create-react-app", "license": "MIT", diff --git a/packages/create-react-app/package.json b/packages/create-react-app/package.json index 1b3b60aac80..65ab56a1698 100644 --- a/packages/create-react-app/package.json +++ b/packages/create-react-app/package.json @@ -1,6 +1,6 @@ { "name": "create-react-app", - "version": "1.4.3", + "version": "1.5.0", "keywords": [ "react" ], diff --git a/packages/eslint-config-react-app/package.json b/packages/eslint-config-react-app/package.json index a10ef679952..c13b0417c46 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": "2.0.1", + "version": "2.1.0", "description": "ESLint configuration used by Create React App", "repository": "facebookincubator/create-react-app", "license": "MIT", diff --git a/packages/react-dev-utils/package.json b/packages/react-dev-utils/package.json index d4b933f7183..18f37c971e4 100644 --- a/packages/react-dev-utils/package.json +++ b/packages/react-dev-utils/package.json @@ -1,6 +1,6 @@ { "name": "react-dev-utils", - "version": "4.2.1", + "version": "5.0.0", "description": "Webpack utilities used by Create React App", "repository": "facebookincubator/create-react-app", "license": "MIT", @@ -48,7 +48,7 @@ "inquirer": "3.3.0", "is-root": "1.0.0", "opn": "5.2.0", - "react-error-overlay": "^3.0.0", + "react-error-overlay": "^4.0.0", "recursive-readdir": "2.2.1", "shell-quote": "1.6.1", "sockjs-client": "1.1.4", diff --git a/packages/react-error-overlay/package.json b/packages/react-error-overlay/package.json index 9808a9da81d..87099dd5e82 100644 --- a/packages/react-error-overlay/package.json +++ b/packages/react-error-overlay/package.json @@ -1,6 +1,6 @@ { "name": "react-error-overlay", - "version": "3.0.0", + "version": "4.0.0", "description": "An overlay for displaying stack frames.", "main": "lib/index.js", "scripts": { @@ -35,13 +35,13 @@ "babel-core": "^6.26.0", "babel-eslint": "7.2.3", "babel-loader": "^7.1.2", - "babel-preset-react-app": "^3.1.0", + "babel-preset-react-app": "^3.1.1", "babel-runtime": "6.26.0", "chalk": "^2.1.0", "chokidar": "^1.7.0", "cross-env": "5.0.5", "eslint": "4.4.1", - "eslint-config-react-app": "^2.0.1", + "eslint-config-react-app": "^2.1.0", "eslint-plugin-flowtype": "2.35.0", "eslint-plugin-import": "2.7.0", "eslint-plugin-jsx-a11y": "5.1.1", diff --git a/packages/react-scripts/package.json b/packages/react-scripts/package.json index f6bff1deaa6..91d4a584cf4 100644 --- a/packages/react-scripts/package.json +++ b/packages/react-scripts/package.json @@ -1,6 +1,6 @@ { "name": "react-scripts", - "version": "1.0.17", + "version": "1.1.0", "description": "Configuration and scripts for Create React App.", "repository": "facebookincubator/create-react-app", "license": "MIT", @@ -26,7 +26,7 @@ "babel-eslint": "7.2.3", "babel-jest": "20.0.3", "babel-loader": "7.1.2", - "babel-preset-react-app": "^3.1.0", + "babel-preset-react-app": "^3.1.1", "babel-runtime": "6.26.0", "case-sensitive-paths-webpack-plugin": "2.1.1", "chalk": "1.1.3", @@ -34,7 +34,7 @@ "dotenv": "4.0.0", "dotenv-expand": "4.0.1", "eslint": "4.10.0", - "eslint-config-react-app": "^2.0.1", + "eslint-config-react-app": "^2.1.0", "eslint-loader": "1.9.0", "eslint-plugin-flowtype": "2.39.1", "eslint-plugin-import": "2.8.0", @@ -50,7 +50,7 @@ "postcss-loader": "2.0.8", "promise": "8.0.1", "raf": "3.4.0", - "react-dev-utils": "^4.2.1", + "react-dev-utils": "^5.0.0", "style-loader": "0.19.0", "sw-precache-webpack-plugin": "0.11.4", "url-loader": "0.6.2", From d9799641268dfadffb625af68ce0a78895147728 Mon Sep 17 00:00:00 2001 From: Dan Abramov Date: Mon, 15 Jan 2018 00:55:15 +0000 Subject: [PATCH 0012/1323] Tweak publishing note --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 62908c39b6b..72994ebbf68 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -121,7 +121,7 @@ By default git would use `CRLF` line endings which would cause the scripts to fa * Add a four-space indented paragraph after each non-trivial list item, explaining what changed and why. For each breaking change also write who it affects and instructions for migrating existing code. * Maybe add some newlines here and there. Preview the result on GitHub to get a feel for it. Changelog generator output is a bit too terse for my taste, so try to make it visually pleasing and well grouped. 6. Make sure to include “Migrating from ...” instructions for the previous release. Often you can copy and paste them. -7. Run `yarn run publish`. (Don’t forget the `run` there.) +7. Run `npm run publish`. (It has to be `npm run publish` exactly, not just `npm publish` or `yarn publish`.) 8. Wait for a long time, and it will get published. Don’t worry that it’s stuck. In the end the publish script will prompt for versions before publishing the packages. 9. After publishing, create a GitHub Release with the same text as the changelog entry. See previous Releases for inspiration. From ff544949b904cf4d2ea5fe926fd25ff367a59999 Mon Sep 17 00:00:00 2001 From: Ade Viankakrisna Fadlil Date: Thu, 11 Jan 2018 09:59:42 +0700 Subject: [PATCH 0013/1323] Use uglifyjs-webpack-plugin v1 (#3618) --- .../config/webpack.config.prod.js | 42 +++++++++++-------- packages/react-scripts/package.json | 1 + 2 files changed, 26 insertions(+), 17 deletions(-) diff --git a/packages/react-scripts/config/webpack.config.prod.js b/packages/react-scripts/config/webpack.config.prod.js index 3b2a2068db2..e1d4bc14a28 100644 --- a/packages/react-scripts/config/webpack.config.prod.js +++ b/packages/react-scripts/config/webpack.config.prod.js @@ -12,6 +12,7 @@ const autoprefixer = require('autoprefixer'); const path = require('path'); const webpack = require('webpack'); const HtmlWebpackPlugin = require('html-webpack-plugin'); +const UglifyJsPlugin = require('uglifyjs-webpack-plugin'); const ExtractTextPlugin = require('extract-text-webpack-plugin'); const ManifestPlugin = require('webpack-manifest-plugin'); const InterpolateHtmlPlugin = require('react-dev-utils/InterpolateHtmlPlugin'); @@ -290,24 +291,31 @@ module.exports = { // Otherwise React will be compiled in the very slow development mode. new webpack.DefinePlugin(env.stringified), // Minify the code. - new webpack.optimize.UglifyJsPlugin({ - compress: { - warnings: false, - // Disabled because of an issue with Uglify breaking seemingly valid code: - // https://github.com/facebookincubator/create-react-app/issues/2376 - // Pending further investigation: - // https://github.com/mishoo/UglifyJS2/issues/2011 - comparisons: false, - }, - mangle: { - safari10: true, - }, - output: { - comments: false, - // Turned on because emoji and regex is not minified properly using default - // https://github.com/facebookincubator/create-react-app/issues/2488 - ascii_only: true, + new UglifyJsPlugin({ + uglifyOptions: { + compress: { + warnings: false, + // Disabled because of an issue with Uglify breaking seemingly valid code: + // https://github.com/facebookincubator/create-react-app/issues/2376 + // Pending further investigation: + // https://github.com/mishoo/UglifyJS2/issues/2011 + comparisons: false, + }, + mangle: { + safari10: true, + }, + output: { + comments: false, + // Turned on because emoji and regex is not minified properly using default + // https://github.com/facebookincubator/create-react-app/issues/2488 + ascii_only: true, + }, }, + // Use multi-process parallel running to improve the build speed + // Default number of concurrent runs: os.cpus().length - 1 + parallel: true, + // Enable file caching + cache: true, sourceMap: shouldUseSourceMap, }), // Note: this won't work without ExtractTextPlugin.extract(..) in `loaders`. diff --git a/packages/react-scripts/package.json b/packages/react-scripts/package.json index 91d4a584cf4..6abfd73490c 100644 --- a/packages/react-scripts/package.json +++ b/packages/react-scripts/package.json @@ -53,6 +53,7 @@ "react-dev-utils": "^5.0.0", "style-loader": "0.19.0", "sw-precache-webpack-plugin": "0.11.4", + "uglifyjs-webpack-plugin": "1.1.4", "url-loader": "0.6.2", "webpack": "3.8.1", "webpack-dev-server": "2.9.4", From 1f18ab7879dff957efe51d342be8ece71a0b43b9 Mon Sep 17 00:00:00 2001 From: Joe Haddad Date: Wed, 10 Jan 2018 22:20:33 -0500 Subject: [PATCH 0014/1323] Specify ecma version (#3743) --- packages/react-scripts/config/webpack.config.prod.js | 1 + packages/react-scripts/package.json | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/react-scripts/config/webpack.config.prod.js b/packages/react-scripts/config/webpack.config.prod.js index e1d4bc14a28..b99db8a27ef 100644 --- a/packages/react-scripts/config/webpack.config.prod.js +++ b/packages/react-scripts/config/webpack.config.prod.js @@ -293,6 +293,7 @@ module.exports = { // Minify the code. new UglifyJsPlugin({ uglifyOptions: { + ecma: 5, compress: { warnings: false, // Disabled because of an issue with Uglify breaking seemingly valid code: diff --git a/packages/react-scripts/package.json b/packages/react-scripts/package.json index 6abfd73490c..bc1f07b34c1 100644 --- a/packages/react-scripts/package.json +++ b/packages/react-scripts/package.json @@ -53,7 +53,7 @@ "react-dev-utils": "^5.0.0", "style-loader": "0.19.0", "sw-precache-webpack-plugin": "0.11.4", - "uglifyjs-webpack-plugin": "1.1.4", + "uglifyjs-webpack-plugin": "1.1.6", "url-loader": "0.6.2", "webpack": "3.8.1", "webpack-dev-server": "2.9.4", From 0a331710aa8cc8d9c76e17b06066eec5779ead1c Mon Sep 17 00:00:00 2001 From: Andrey Sitnik Date: Wed, 10 Jan 2018 02:39:13 +1000 Subject: [PATCH 0015/1323] Move browsers to cross-tool config (#3644) --- packages/react-scripts/config/webpack.config.dev.js | 6 ------ packages/react-scripts/config/webpack.config.prod.js | 6 ------ packages/react-scripts/scripts/init.js | 7 +++++++ 3 files changed, 7 insertions(+), 12 deletions(-) diff --git a/packages/react-scripts/config/webpack.config.dev.js b/packages/react-scripts/config/webpack.config.dev.js index 9f3131b0660..843ec0dd318 100644 --- a/packages/react-scripts/config/webpack.config.dev.js +++ b/packages/react-scripts/config/webpack.config.dev.js @@ -200,12 +200,6 @@ module.exports = { plugins: () => [ require('postcss-flexbugs-fixes'), autoprefixer({ - browsers: [ - '>1%', - 'last 4 versions', - 'Firefox ESR', - 'not ie < 9', // React doesn't support IE8 anyway - ], flexbox: 'no-2009', }), ], diff --git a/packages/react-scripts/config/webpack.config.prod.js b/packages/react-scripts/config/webpack.config.prod.js index b99db8a27ef..2f37dbfe7f4 100644 --- a/packages/react-scripts/config/webpack.config.prod.js +++ b/packages/react-scripts/config/webpack.config.prod.js @@ -222,12 +222,6 @@ module.exports = { plugins: () => [ require('postcss-flexbugs-fixes'), autoprefixer({ - browsers: [ - '>1%', - 'last 4 versions', - 'Firefox ESR', - 'not ie < 9', // React doesn't support IE8 anyway - ], flexbox: 'no-2009', }), ], diff --git a/packages/react-scripts/scripts/init.js b/packages/react-scripts/scripts/init.js index b283bad6ee6..27b214e6431 100644 --- a/packages/react-scripts/scripts/init.js +++ b/packages/react-scripts/scripts/init.js @@ -43,6 +43,13 @@ module.exports = function( eject: 'react-scripts eject', }; + appPackage.browserslist = [ + '>1%', + 'last 4 versions', + 'Firefox ESR', + 'not ie < 9', + ]; + fs.writeFileSync( path.join(appPath, 'package.json'), JSON.stringify(appPackage, null, 2) From 3c3547f9428fc6d4ef4251f6a689de91b0b9c9df Mon Sep 17 00:00:00 2001 From: "Kent C. Dodds" Date: Tue, 9 Jan 2018 09:53:42 -0700 Subject: [PATCH 0016/1323] add experimental babel-plugin-macros support (#3675) * add experimental babel-plugin-macros support closes #2730 This will remain undocumented until the brave have tried it in the wild. **Test Plan:** There's currently no established way to test changes to `babel-preset-react-app`. But I did create [`unmaintained-react-scripts-babel-macros`](https://www.npmjs.com/package/unmaintained-react-scripts-babel-macros) [a while back](https://github.com/facebookincubator/create-react-app/issues/2730#issuecomment-328153982) and it worked well. * Pin the version --- packages/babel-preset-react-app/index.js | 3 +++ packages/babel-preset-react-app/package.json | 1 + 2 files changed, 4 insertions(+) diff --git a/packages/babel-preset-react-app/index.js b/packages/babel-preset-react-app/index.js index d90fb6af50b..d1639dd2161 100644 --- a/packages/babel-preset-react-app/index.js +++ b/packages/babel-preset-react-app/index.js @@ -7,6 +7,9 @@ 'use strict'; const plugins = [ + // Experimental macros support. Will be documented after it's had some time + // in the wild. + require.resolve('babel-plugin-macros'), // Necessary to include regardless of the environment because // in practice some other transforms (such as object-rest-spread) // don't work without it: https://github.com/babel/babel/issues/7215 diff --git a/packages/babel-preset-react-app/package.json b/packages/babel-preset-react-app/package.json index c6a7e29441d..108e1ea3cfa 100644 --- a/packages/babel-preset-react-app/package.json +++ b/packages/babel-preset-react-app/package.json @@ -12,6 +12,7 @@ ], "dependencies": { "babel-plugin-dynamic-import-node": "1.1.0", + "babel-plugin-macros": "2.0.0", "babel-plugin-syntax-dynamic-import": "6.18.0", "babel-plugin-transform-class-properties": "6.24.1", "babel-plugin-transform-es2015-destructuring": "6.23.0", From 813584ff35bc850383e4b075b7aa712b24ade993 Mon Sep 17 00:00:00 2001 From: everdimension Date: Wed, 10 Jan 2018 04:38:54 +0300 Subject: [PATCH 0017/1323] Redisable require.ensure() (#3121) --- packages/eslint-config-react-app/index.js | 13 ++++++------- packages/react-scripts/config/webpack.config.dev.js | 5 ++--- .../react-scripts/config/webpack.config.prod.js | 5 ++--- 3 files changed, 10 insertions(+), 13 deletions(-) diff --git a/packages/eslint-config-react-app/index.js b/packages/eslint-config-react-app/index.js index c7a619abd62..9b687663da9 100644 --- a/packages/eslint-config-react-app/index.js +++ b/packages/eslint-config-react-app/index.js @@ -225,13 +225,12 @@ module.exports = { 'valid-typeof': 'warn', 'no-restricted-properties': [ 'error', - // TODO: reenable once import() is no longer slow. - // https://github.com/facebookincubator/create-react-app/issues/2176 - // { - // object: 'require', - // property: 'ensure', - // message: 'Please use import() instead. More info: https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md#code-splitting', - // }, + { + object: 'require', + property: 'ensure', + message: + 'Please use import() instead. More info: https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md#code-splitting', + }, { object: 'System', property: 'import', diff --git a/packages/react-scripts/config/webpack.config.dev.js b/packages/react-scripts/config/webpack.config.dev.js index 843ec0dd318..b509af97054 100644 --- a/packages/react-scripts/config/webpack.config.dev.js +++ b/packages/react-scripts/config/webpack.config.dev.js @@ -117,9 +117,8 @@ module.exports = { module: { strictExportPresence: true, rules: [ - // TODO: Disable require.ensure as it's not a standard language feature. - // We are waiting for https://github.com/facebookincubator/create-react-app/issues/2176. - // { parser: { requireEnsure: false } }, + // Disable require.ensure as it's not a standard language feature. + { parser: { requireEnsure: false } }, // First, run the linter. // It's important to do this before Babel processes the JS. diff --git a/packages/react-scripts/config/webpack.config.prod.js b/packages/react-scripts/config/webpack.config.prod.js index 2f37dbfe7f4..d3673a723b5 100644 --- a/packages/react-scripts/config/webpack.config.prod.js +++ b/packages/react-scripts/config/webpack.config.prod.js @@ -124,9 +124,8 @@ module.exports = { module: { strictExportPresence: true, rules: [ - // TODO: Disable require.ensure as it's not a standard language feature. - // We are waiting for https://github.com/facebookincubator/create-react-app/issues/2176. - // { parser: { requireEnsure: false } }, + // Disable require.ensure as it's not a standard language feature. + { parser: { requireEnsure: false } }, // First, run the linter. // It's important to do this before Babel processes the JS. From b6aebb9e8f2e1bb049e855e739e578bd00d90021 Mon Sep 17 00:00:00 2001 From: Jeffrey Posnick Date: Tue, 9 Jan 2018 21:08:39 -0500 Subject: [PATCH 0018/1323] Remove the navigateFallback behavior from the generated service worker (#3419) * Disables navigateFallback and updates the README * Typos * Updated a URL in a comment. --- .../config/webpack.config.prod.js | 9 ++-- packages/react-scripts/template/README.md | 47 ++++++++++++++----- 2 files changed, 39 insertions(+), 17 deletions(-) diff --git a/packages/react-scripts/config/webpack.config.prod.js b/packages/react-scripts/config/webpack.config.prod.js index d3673a723b5..dea5b99eac6 100644 --- a/packages/react-scripts/config/webpack.config.prod.js +++ b/packages/react-scripts/config/webpack.config.prod.js @@ -344,13 +344,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$/], + // `navigateFallback` and `navigateFallbackWhitelist` are disabled by default; see + // https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md#service-worker-considerations + // navigateFallback: publicUrl + '/index.html', + // navigateFallbackWhitelist: [/^(?!\/__).*/], }), // 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 diff --git a/packages/react-scripts/template/README.md b/packages/react-scripts/template/README.md index 7c641456056..ee0860f0b6b 100644 --- a/packages/react-scripts/template/README.md +++ b/packages/react-scripts/template/README.md @@ -83,6 +83,7 @@ You can find the most recent version of this guide [here](https://github.com/fac - [Static Server](#static-server) - [Other Solutions](#other-solutions) - [Serving Apps with Client-Side Routing](#serving-apps-with-client-side-routing) + - [Service Worker Considerations](#service-worker-considerations) - [Building for Relative Paths](#building-for-relative-paths) - [Azure](#azure) - [Firebase](#firebase) @@ -1791,8 +1792,14 @@ is integrated into production configuration, and it will take care of generating a service worker file that will automatically precache all of your local assets and keep them up to date as you deploy updates. The service worker will use a [cache-first strategy](https://developers.google.com/web/fundamentals/instant-and-offline/offline-cookbook/#cache-falling-back-to-network) -for handling all requests for local assets, including the initial HTML, ensuring -that your web app is reliably fast, even on a slow or unreliable network. +for handling all requests for local assets, including +[navigation requests](https://developers.google.com/web/fundamentals/primers/service-workers/high-performance-loading#first_what_are_navigation_requests) +for `/` and `/index.html`, ensuring that your web app is consistently fast, even +on a slow or unreliable network. + +>Note: If you are using the `pushState` history API and want to enable +cache-first navigations for URLs other than `/` and `/index.html`, please +[follow these steps](#service-worker-considerations). ### Opting Out of Caching @@ -1995,21 +2002,37 @@ If you’re using [Apache Tomcat](http://tomcat.apache.org/), you need to follow Now requests to `/todos/42` will be handled correctly both in development and in production. -On a production build, and in a browser that supports [service workers](https://developers.google.com/web/fundamentals/getting-started/primers/service-workers), -the service worker will automatically handle all navigation requests, like for -`/todos/42`, by serving the cached copy of your `index.html`. This -service worker navigation routing can be configured or disabled by -[`eject`ing](#npm-run-eject) and then modifying the -[`navigateFallback`](https://github.com/GoogleChrome/sw-precache#navigatefallback-string) -and [`navigateFallbackWhitelist`](https://github.com/GoogleChrome/sw-precache#navigatefallbackwhitelist-arrayregexp) -options of the `SWPreachePlugin` [configuration](../config/webpack.config.prod.js). - -When users install your app to the homescreen of their device the default configuration will make a shortcut to `/index.html`. This may not work for client-side routers which expect the app to be served from `/`. Edit the web app manifest at [`public/manifest.json`](public/manifest.json) and change `start_url` to match the required URL scheme, for example: +When users install your app to the homescreen of their device the default +configuration will make a shortcut to `/index.html`. This may not work for +client-side routers which expect the app to be served from `/`. Edit the web app +manifest at [`public/manifest.json`](public/manifest.json) and change +`start_url` to match the required URL scheme, for example: ```js "start_url": ".", ``` +### Service Worker Considerations + +[Navigation requests](https://developers.google.com/web/fundamentals/primers/service-workers/high-performance-loading#first_what_are_navigation_requests) +for URLs like `/todos/42` will not be intercepted by the +[service worker](https://developers.google.com/web/fundamentals/getting-started/primers/service-workers) +created by the production build. Navigations for those URLs will always +require a network connection, as opposed to navigations for `/` and +`/index.html`, both of which will be served from the cache by the service worker +and work without requiring a network connection. + +If you are using the `pushState` history API and would like to enable service +worker support for navigations to URLs like `/todos/42`, you need to +[`npm eject`](#npm-run-eject) and enable the +[`navigateFallback`](https://github.com/GoogleChrome/sw-precache#navigatefallback-string) +and [`navigateFallbackWhitelist`](https://github.com/GoogleChrome/sw-precache#navigatefallbackwhitelist-arrayregexp) +options of the `SWPreachePlugin` [configuration](../config/webpack.config.prod.js). + +>Note: This is a [change in default behavior](https://github.com/facebookincubator/create-react-app/issues/3248), +as earlier versions of `create-react-app` shipping with `navigateFallback` +enabled by default. + ### Building for Relative Paths By default, Create React App produces a build assuming your app is hosted at the server root.
From 3c79497eb016d02d6cf85e8b9dcec96b5fa2bb20 Mon Sep 17 00:00:00 2001 From: Rami Date: Wed, 10 Jan 2018 15:49:34 +0000 Subject: [PATCH 0019/1323] Change the default `start_url` to `.` (#3346) --- packages/react-scripts/template/README.md | 13 ++----------- .../react-scripts/template/public/manifest.json | 2 +- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/packages/react-scripts/template/README.md b/packages/react-scripts/template/README.md index ee0860f0b6b..044ccc0ecdd 100644 --- a/packages/react-scripts/template/README.md +++ b/packages/react-scripts/template/README.md @@ -2002,15 +2002,7 @@ If you’re using [Apache Tomcat](http://tomcat.apache.org/), you need to follow Now requests to `/todos/42` will be handled correctly both in development and in production. -When users install your app to the homescreen of their device the default -configuration will make a shortcut to `/index.html`. This may not work for -client-side routers which expect the app to be served from `/`. Edit the web app -manifest at [`public/manifest.json`](public/manifest.json) and change -`start_url` to match the required URL scheme, for example: - -```js - "start_url": ".", -``` +When users install your app to the homescreen of their device the default configuration will make a shortcut to `/`. This may not work if you don't use a client-side router and expect the app to be served from `/index.html`. In this case, the web app manifest at [`public/manifest.json`](public/manifest.json) and change `start_url` to `./index.html`. ### Service Worker Considerations @@ -2024,8 +2016,7 @@ and work without requiring a network connection. If you are using the `pushState` history API and would like to enable service worker support for navigations to URLs like `/todos/42`, you need to -[`npm eject`](#npm-run-eject) and enable the -[`navigateFallback`](https://github.com/GoogleChrome/sw-precache#navigatefallback-string) +[`npm eject`](#npm-run-eject) and enable the [`navigateFallback`](https://github.com/GoogleChrome/sw-precache#navigatefallback-string) and [`navigateFallbackWhitelist`](https://github.com/GoogleChrome/sw-precache#navigatefallbackwhitelist-arrayregexp) options of the `SWPreachePlugin` [configuration](../config/webpack.config.prod.js). diff --git a/packages/react-scripts/template/public/manifest.json b/packages/react-scripts/template/public/manifest.json index ef19ec243e7..1f2f141fafd 100644 --- a/packages/react-scripts/template/public/manifest.json +++ b/packages/react-scripts/template/public/manifest.json @@ -8,7 +8,7 @@ "type": "image/x-icon" } ], - "start_url": "./index.html", + "start_url": ".", "display": "standalone", "theme_color": "#000000", "background_color": "#ffffff" From 776d2d6036a32172a310e8dd05c9ad2c71443470 Mon Sep 17 00:00:00 2001 From: aisensiy Date: Thu, 11 Jan 2018 15:49:30 +0800 Subject: [PATCH 0020/1323] Update jest to 22 and support watchPathIgnorePatterns configuration (#3124) * update jest to 21.0.2 to support watchPathIgnorePatterns configuration * update jest to 21.1.0 * Try bumping Jest * Bump babel-jest * Try to debug weird CI failure * Remove debug code * Bump other Jest packages * ffs * temp * Revert "temp" This reverts commit 62aec9ac1ae70a995a89548feb7ac7870e5324c0. --- packages/react-dev-utils/package.json | 2 +- packages/react-error-overlay/package.json | 2 +- packages/react-scripts/package.json | 4 ++-- packages/react-scripts/scripts/utils/createJestConfig.js | 1 + 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/packages/react-dev-utils/package.json b/packages/react-dev-utils/package.json index 18f37c971e4..d589710e67d 100644 --- a/packages/react-dev-utils/package.json +++ b/packages/react-dev-utils/package.json @@ -56,7 +56,7 @@ "text-table": "0.2.0" }, "devDependencies": { - "jest": "20.0.4" + "jest": "22.0.5" }, "scripts": { "test": "jest" diff --git a/packages/react-error-overlay/package.json b/packages/react-error-overlay/package.json index 87099dd5e82..208be0d4017 100644 --- a/packages/react-error-overlay/package.json +++ b/packages/react-error-overlay/package.json @@ -48,7 +48,7 @@ "eslint-plugin-react": "7.1.0", "flow-bin": "^0.63.1", "html-entities": "1.2.1", - "jest": "20.0.4", + "jest": "22.0.5", "jest-fetch-mock": "1.2.1", "object-assign": "4.1.1", "promise": "8.0.1", diff --git a/packages/react-scripts/package.json b/packages/react-scripts/package.json index bc1f07b34c1..59c6be2d13f 100644 --- a/packages/react-scripts/package.json +++ b/packages/react-scripts/package.json @@ -24,7 +24,7 @@ "autoprefixer": "7.1.6", "babel-core": "6.26.0", "babel-eslint": "7.2.3", - "babel-jest": "20.0.3", + "babel-jest": "22.0.4", "babel-loader": "7.1.2", "babel-preset-react-app": "^3.1.1", "babel-runtime": "6.26.0", @@ -44,7 +44,7 @@ "file-loader": "1.1.5", "fs-extra": "3.0.1", "html-webpack-plugin": "2.29.0", - "jest": "20.0.4", + "jest": "22.0.5", "object-assign": "4.1.1", "postcss-flexbugs-fixes": "3.2.0", "postcss-loader": "2.0.8", diff --git a/packages/react-scripts/scripts/utils/createJestConfig.js b/packages/react-scripts/scripts/utils/createJestConfig.js index b4c2cfa5ea9..4c2e6f1d002 100644 --- a/packages/react-scripts/scripts/utils/createJestConfig.js +++ b/packages/react-scripts/scripts/utils/createJestConfig.js @@ -62,6 +62,7 @@ module.exports = (resolve, rootDir, isEjecting) => { 'coverageReporters', 'coverageThreshold', 'snapshotSerializers', + 'watchPathIgnorePatterns', ]; if (overrides) { supportedKeys.forEach(key => { From 590df7eead1a2526828aa36ceff41397e82bd4dd Mon Sep 17 00:00:00 2001 From: Dan Abramov Date: Thu, 11 Jan 2018 14:14:17 +0000 Subject: [PATCH 0021/1323] Bump Jest to 22.0.6 (#3751) --- packages/react-dev-utils/package.json | 2 +- packages/react-error-overlay/package.json | 2 +- packages/react-scripts/package.json | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/react-dev-utils/package.json b/packages/react-dev-utils/package.json index d589710e67d..24f851b1cfc 100644 --- a/packages/react-dev-utils/package.json +++ b/packages/react-dev-utils/package.json @@ -56,7 +56,7 @@ "text-table": "0.2.0" }, "devDependencies": { - "jest": "22.0.5" + "jest": "22.0.6" }, "scripts": { "test": "jest" diff --git a/packages/react-error-overlay/package.json b/packages/react-error-overlay/package.json index 208be0d4017..c6cbfeca108 100644 --- a/packages/react-error-overlay/package.json +++ b/packages/react-error-overlay/package.json @@ -48,7 +48,7 @@ "eslint-plugin-react": "7.1.0", "flow-bin": "^0.63.1", "html-entities": "1.2.1", - "jest": "22.0.5", + "jest": "22.0.6", "jest-fetch-mock": "1.2.1", "object-assign": "4.1.1", "promise": "8.0.1", diff --git a/packages/react-scripts/package.json b/packages/react-scripts/package.json index 59c6be2d13f..0b2f62eb825 100644 --- a/packages/react-scripts/package.json +++ b/packages/react-scripts/package.json @@ -24,7 +24,7 @@ "autoprefixer": "7.1.6", "babel-core": "6.26.0", "babel-eslint": "7.2.3", - "babel-jest": "22.0.4", + "babel-jest": "22.0.6", "babel-loader": "7.1.2", "babel-preset-react-app": "^3.1.1", "babel-runtime": "6.26.0", @@ -44,7 +44,7 @@ "file-loader": "1.1.5", "fs-extra": "3.0.1", "html-webpack-plugin": "2.29.0", - "jest": "22.0.5", + "jest": "22.0.6", "object-assign": "4.1.1", "postcss-flexbugs-fixes": "3.2.0", "postcss-loader": "2.0.8", From 1552949a3bce629de9e6fde1794e01c07226bf9c Mon Sep 17 00:00:00 2001 From: Clement Hoang Date: Thu, 11 Jan 2018 18:42:33 -0500 Subject: [PATCH 0022/1323] Switch to Babel 7 (#3522) * Update dependencies in react-scripts * Add first pass of working dependencies for babel-preset-react-app and react-scripts * Bump more dependency versions * Adjust more versions and edit fix options * Restore functionality of old preset * Disable Uglify in iframe webpack * Apply prettier * Re-enable cache in dev and clean deps * Lock packages and move babel/core to dep in preset * Bump babel-jest * Re-enable uglify * Nest forceAllTransforms correctly in webpack config * Install babel-core bridge for jest * Add jest-cli and babel-core bridge to make tests in react-error-overlay pass * Re-enable transform-dynamic-import * Add dynamic import syntax support back * Use new babel in kitchensink * Transform modules in test * Revert "Transform modules in test" This reverts commit 539e46a1d77259898b7e70d778a5e43fc25edc2a. * Attempt fix for ejected tests * try this * Add regenerator back * Bump babel deps to beta.34 * Remove bad files * Use default when requiring babel transform plugin * Bump deps * Try the fix? * Oopsie * Remove some weird things * Run Babel on react-error-overlay tests * Try fixing kitchensink * Use new API for codeFrame * Add missing (?) babelrc * Maybe this helps? * Maybe fix mocha * I shouldn't have deleted this :facepalm: --- packages/babel-preset-react-app/index.js | 195 ++++++++---------- packages/babel-preset-react-app/package.json | 30 ++- packages/eslint-config-react-app/package.json | 2 +- packages/react-dev-utils/package.json | 2 +- packages/react-error-overlay/package.json | 12 +- .../src/containers/StackFrameCodeBlock.js | 15 +- .../webpack.config.iframe.js | 19 +- .../config/webpack.config.dev.js | 6 +- .../config/webpack.config.prod.js | 6 +- .../fixtures/kitchensink/.babelrc | 4 - .../kitchensink/.template.dependencies.json | 6 +- packages/react-scripts/package.json | 9 +- tasks/e2e-kitchensink.sh | 25 ++- tasks/replace-own-deps.js | 10 +- 14 files changed, 178 insertions(+), 163 deletions(-) delete mode 100644 packages/react-scripts/fixtures/kitchensink/.babelrc diff --git a/packages/babel-preset-react-app/index.js b/packages/babel-preset-react-app/index.js index d1639dd2161..1a153606e2a 100644 --- a/packages/babel-preset-react-app/index.js +++ b/packages/babel-preset-react-app/index.js @@ -6,138 +6,117 @@ */ 'use strict'; -const plugins = [ - // Experimental macros support. Will be documented after it's had some time - // in the wild. - require.resolve('babel-plugin-macros'), - // Necessary to include regardless of the environment because - // in practice some other transforms (such as object-rest-spread) - // don't work without it: https://github.com/babel/babel/issues/7215 - require.resolve('babel-plugin-transform-es2015-destructuring'), - // class { handleClick = () => { } } - require.resolve('babel-plugin-transform-class-properties'), - // The following two plugins use Object.assign directly, instead of Babel's - // extends helper. Note that this assumes `Object.assign` is available. - // { ...todo, completed: true } - [ - require.resolve('babel-plugin-transform-object-rest-spread'), - { - useBuiltIns: true, - }, - ], - // Transforms JSX - [ - require.resolve('babel-plugin-transform-react-jsx'), - { - useBuiltIns: true, - }, - ], - // Polyfills the runtime needed for async/await and generators - [ - require.resolve('babel-plugin-transform-runtime'), - { - helpers: false, - polyfill: false, - regenerator: true, - }, - ], -]; - -// This is similar to how `env` works in Babel: -// https://babeljs.io/docs/usage/babelrc/#env-option -// We are not using `env` because it’s ignored in versions > babel-core@6.10.4: -// https://github.com/babel/babel/issues/4539 -// https://github.com/facebookincubator/create-react-app/issues/720 -// It’s also nice that we can enforce `NODE_ENV` being specified. -var env = process.env.BABEL_ENV || process.env.NODE_ENV; -if (env !== 'development' && env !== 'test' && env !== 'production') { - throw new Error( - 'Using `babel-preset-react-app` requires that you specify `NODE_ENV` or ' + - '`BABEL_ENV` environment variables. Valid values are "development", ' + - '"test", and "production". Instead, received: ' + - JSON.stringify(env) + - '.' - ); -} +module.exports = function(api, opts) { + if (!opts) { + opts = {}; + } -if (env === 'development' || env === 'test') { - // The following two plugins are currently necessary to make React warnings - // include more valuable information. They are included here because they are - // currently not enabled in babel-preset-react. See the below threads for more info: - // https://github.com/babel/babel/issues/4702 - // https://github.com/babel/babel/pull/3540#issuecomment-228673661 - // https://github.com/facebookincubator/create-react-app/issues/989 - plugins.push.apply(plugins, [ - // Adds component stack to warning messages - require.resolve('babel-plugin-transform-react-jsx-source'), - // Adds __self attribute to JSX which React will use for some warnings - require.resolve('babel-plugin-transform-react-jsx-self'), - ]); -} + // This is similar to how `env` works in Babel: + // https://babeljs.io/docs/usage/babelrc/#env-option + // We are not using `env` because it’s ignored in versions > babel-core@6.10.4: + // https://github.com/babel/babel/issues/4539 + // https://github.com/facebookincubator/create-react-app/issues/720 + // It’s also nice that we can enforce `NODE_ENV` being specified. + var env = process.env.BABEL_ENV || process.env.NODE_ENV; + var isEnvDevelopment = env === 'development'; + var isEnvProduction = env === 'production'; + var isEnvTest = env === 'test'; + if (!isEnvDevelopment && !isEnvProduction && !isEnvTest) { + throw new Error( + 'Using `babel-preset-react-app` requires that you specify `NODE_ENV` or ' + + '`BABEL_ENV` environment variables. Valid values are "development", ' + + '"test", and "production". Instead, received: ' + + JSON.stringify(env) + + '.' + ); + } -if (env === 'test') { - module.exports = { + return { presets: [ - // ES features necessary for user's Node version - [ - require('babel-preset-env').default, + isEnvTest && [ + // ES features necessary for user's Node version + require('@babel/preset-env').default, { targets: { - node: 'current', + node: '6.12', }, }, ], - // JSX, Flow - require.resolve('babel-preset-react'), - ], - plugins: plugins.concat([ - // Compiles import() to a deferred require() - require.resolve('babel-plugin-dynamic-import-node'), - ]), - }; -} else { - module.exports = { - presets: [ - // Latest stable ECMAScript features - [ - require.resolve('babel-preset-env'), + (isEnvProduction || isEnvDevelopment) && [ + // Latest stable ECMAScript features + require('@babel/preset-env').default, { targets: { // React parses on ie 9, so we should too ie: 9, - // We currently minify with uglify - // Remove after https://github.com/mishoo/UglifyJS2/issues/448 - uglify: true, }, + // We currently minify with uglify + // Remove after https://github.com/mishoo/UglifyJS2/issues/448 + forceAllTransforms: true, // Disable polyfill transforms useBuiltIns: false, // Do not transform modules to CJS modules: false, }, ], - // JSX, Flow - require.resolve('babel-preset-react'), - ], - plugins: plugins.concat([ - // function* () { yield 42; yield 43; } [ - require.resolve('babel-plugin-transform-regenerator'), + require('@babel/preset-react').default, + { + // Adds component stack to warning messages + // Adds __self attribute to JSX which React will use for some warnings + development: isEnvDevelopment || isEnvTest, + }, + ], + [require('@babel/preset-flow').default], + ].filter(Boolean), + plugins: [ + // Experimental macros support. Will be documented after it's had some time + // in the wild. + require('babel-plugin-macros'), + // Necessary to include regardless of the environment because + // in practice some other transforms (such as object-rest-spread) + // don't work without it: https://github.com/babel/babel/issues/7215 + require('@babel/plugin-transform-destructuring').default, + // class { handleClick = () => { } } + require('@babel/plugin-proposal-class-properties').default, + // The following two plugins use Object.assign directly, instead of Babel's + // extends helper. Note that this assumes `Object.assign` is available. + // { ...todo, completed: true } + [ + require('@babel/plugin-proposal-object-rest-spread').default, + { + useBuiltIns: true, + }, + ], + // Transforms JSX + [ + require('@babel/plugin-transform-react-jsx').default, + { + useBuiltIns: true, + }, + ], + // Polyfills the runtime needed for async/await and generators + [ + require('@babel/plugin-transform-runtime').default, + { + helpers: false, + polyfill: false, + regenerator: true, + }, + ], + // function* () { yield 42; yield 43; } + !isEnvTest && [ + require('@babel/plugin-transform-regenerator').default, { // Async functions are converted to generators by babel-preset-env async: false, }, ], // Adds syntax support for import() - require.resolve('babel-plugin-syntax-dynamic-import'), - ]), + require('@babel/plugin-syntax-dynamic-import').default, + isEnvTest && + // Transform dynamic import to require + require('babel-plugin-transform-dynamic-import').default, + ].filter(Boolean), }; - - if (env === 'production') { - // Optimization: hoist JSX that never changes out of render() - // Disabled because of issues: https://github.com/facebookincubator/create-react-app/issues/553 - // TODO: Enable again when these issues are resolved. - // plugins.push.apply(plugins, [ - // require.resolve('babel-plugin-transform-react-constant-elements') - // ]); - } -} +}; diff --git a/packages/babel-preset-react-app/package.json b/packages/babel-preset-react-app/package.json index 108e1ea3cfa..adb596cadd4 100644 --- a/packages/babel-preset-react-app/package.json +++ b/packages/babel-preset-react-app/package.json @@ -11,22 +11,20 @@ "index.js" ], "dependencies": { - "babel-plugin-dynamic-import-node": "1.1.0", + "@babel/core": "7.0.0-beta.36", + "@babel/plugin-proposal-class-properties": "7.0.0-beta.36", + "@babel/plugin-syntax-dynamic-import": "^7.0.0-beta.36", + "@babel/plugin-transform-classes": "7.0.0-beta.36", + "@babel/plugin-transform-destructuring": "7.0.0-beta.36", + "@babel/plugin-transform-react-constant-elements": "7.0.0-beta.36", + "@babel/plugin-transform-react-display-name": "7.0.0-beta.36", + "@babel/plugin-transform-react-jsx": "7.0.0-beta.36", + "@babel/plugin-transform-regenerator": "7.0.0-beta.36", + "@babel/plugin-transform-runtime": "7.0.0-beta.36", + "@babel/preset-env": "7.0.0-beta.36", + "@babel/preset-flow": "7.0.0-beta.36", + "@babel/preset-react": "7.0.0-beta.36", "babel-plugin-macros": "2.0.0", - "babel-plugin-syntax-dynamic-import": "6.18.0", - "babel-plugin-transform-class-properties": "6.24.1", - "babel-plugin-transform-es2015-destructuring": "6.23.0", - "babel-plugin-transform-object-rest-spread": "6.26.0", - "babel-plugin-transform-react-constant-elements": "6.23.0", - "babel-plugin-transform-react-jsx": "6.24.1", - "babel-plugin-transform-react-jsx-self": "6.22.0", - "babel-plugin-transform-react-jsx-source": "6.22.0", - "babel-plugin-transform-regenerator": "6.26.0", - "babel-plugin-transform-runtime": "6.23.0", - "babel-preset-env": "1.6.1", - "babel-preset-react": "6.24.1" - }, - "peerDependencies": { - "babel-runtime": "^6.23.0" + "babel-plugin-transform-dynamic-import": "2.0.0" } } diff --git a/packages/eslint-config-react-app/package.json b/packages/eslint-config-react-app/package.json index c13b0417c46..86cdbbaf1ef 100644 --- a/packages/eslint-config-react-app/package.json +++ b/packages/eslint-config-react-app/package.json @@ -11,7 +11,7 @@ "index.js" ], "peerDependencies": { - "babel-eslint": "^7.2.3", + "babel-eslint": "^8.0.2", "eslint": "^4.1.1", "eslint-plugin-flowtype": "^2.34.1", "eslint-plugin-import": "^2.6.0", diff --git a/packages/react-dev-utils/package.json b/packages/react-dev-utils/package.json index 24f851b1cfc..1ab145a4b89 100644 --- a/packages/react-dev-utils/package.json +++ b/packages/react-dev-utils/package.json @@ -37,7 +37,7 @@ ], "dependencies": { "address": "1.0.3", - "babel-code-frame": "6.26.0", + "@babel/code-frame": "7.0.0-beta.36", "chalk": "1.1.3", "cross-spawn": "5.1.0", "detect-port-alt": "1.1.5", diff --git a/packages/react-error-overlay/package.json b/packages/react-error-overlay/package.json index c6cbfeca108..8b4aa4d443d 100644 --- a/packages/react-error-overlay/package.json +++ b/packages/react-error-overlay/package.json @@ -30,13 +30,15 @@ "lib/index.js" ], "devDependencies": { + "@babel/code-frame": "7.0.0-beta.36", + "@babel/core": "7.0.0-beta.36", + "@babel/runtime": "7.0.0-beta.36", "anser": "1.4.4", - "babel-code-frame": "6.26.0", - "babel-core": "^6.26.0", - "babel-eslint": "7.2.3", - "babel-loader": "^7.1.2", + "babel-core": "^7.0.0-bridge.0", + "babel-eslint": "^8.0.2", + "babel-jest": "^22.0.6", + "babel-loader": "^8.0.0-beta.0", "babel-preset-react-app": "^3.1.1", - "babel-runtime": "6.26.0", "chalk": "^2.1.0", "chokidar": "^1.7.0", "cross-env": "5.0.5", diff --git a/packages/react-error-overlay/src/containers/StackFrameCodeBlock.js b/packages/react-error-overlay/src/containers/StackFrameCodeBlock.js index 9bd36e019f7..eedf8006b84 100644 --- a/packages/react-error-overlay/src/containers/StackFrameCodeBlock.js +++ b/packages/react-error-overlay/src/containers/StackFrameCodeBlock.js @@ -14,7 +14,7 @@ import type { ScriptLine } from '../utils/stack-frame'; import { primaryErrorStyle, secondaryErrorStyle } from '../styles'; import generateAnsiHTML from '../utils/generateAnsiHTML'; -import codeFrame from 'babel-code-frame'; +import { codeFrameColumns } from '@babel/code-frame'; type StackFrameCodeBlockPropsType = {| lines: ScriptLine[], @@ -53,10 +53,17 @@ function StackFrameCodeBlock(props: Exact) { } sourceCode[line - 1] = text; }); - const ansiHighlight = codeFrame( + const ansiHighlight = codeFrameColumns( sourceCode.join('\n'), - lineNum, - columnNum == null ? 0 : columnNum - (isFinite(whiteSpace) ? whiteSpace : 0), + { + start: { + line: lineNum, + column: + columnNum == null + ? 0 + : columnNum - (isFinite(whiteSpace) ? whiteSpace : 0), + }, + }, { forceColor: true, linesAbove: contextSize, diff --git a/packages/react-error-overlay/webpack.config.iframe.js b/packages/react-error-overlay/webpack.config.iframe.js index c80b15afa14..2f26b43823f 100644 --- a/packages/react-error-overlay/webpack.config.iframe.js +++ b/packages/react-error-overlay/webpack.config.iframe.js @@ -19,7 +19,24 @@ module.exports = { rules: [ { test: /\.js$/, - include: path.resolve(__dirname, './src'), + include: [ + path.resolve(__dirname, './src'), + path.dirname( + require.resolve('chalk', { + paths: path.dirname(require.resolve('@babel/code-frame')), + }) + ), + path.dirname( + require.resolve( + 'ansi-styles', + path.dirname( + require.resolve('chalk', { + paths: path.dirname(require.resolve('@babel/code-frame')), + }) + ) + ) + ), + ], use: 'babel-loader', }, ], diff --git a/packages/react-scripts/config/webpack.config.dev.js b/packages/react-scripts/config/webpack.config.dev.js index b509af97054..2c6b364fe55 100644 --- a/packages/react-scripts/config/webpack.config.dev.js +++ b/packages/react-scripts/config/webpack.config.dev.js @@ -96,9 +96,9 @@ module.exports = { // Resolve Babel runtime relative to react-scripts. // It usually still works on npm 3 without this but it would be // unfortunate to rely on, as react-scripts could be symlinked, - // and thus babel-runtime might not be resolvable from the source. - 'babel-runtime': path.dirname( - require.resolve('babel-runtime/package.json') + // and thus @babel/runtime might not be resolvable from the source. + '@babel/runtime': path.dirname( + require.resolve('@babel/runtime/package.json') ), // @remove-on-eject-end // Support React Native Web diff --git a/packages/react-scripts/config/webpack.config.prod.js b/packages/react-scripts/config/webpack.config.prod.js index dea5b99eac6..0f1fc1c1704 100644 --- a/packages/react-scripts/config/webpack.config.prod.js +++ b/packages/react-scripts/config/webpack.config.prod.js @@ -103,9 +103,9 @@ module.exports = { // Resolve Babel runtime relative to react-scripts. // It usually still works on npm 3 without this but it would be // unfortunate to rely on, as react-scripts could be symlinked, - // and thus babel-runtime might not be resolvable from the source. - 'babel-runtime': path.dirname( - require.resolve('babel-runtime/package.json') + // and thus @babel/runtime might not be resolvable from the source. + '@babel/runtime': path.dirname( + require.resolve('@babel/runtime/package.json') ), // @remove-on-eject-end // Support React Native Web diff --git a/packages/react-scripts/fixtures/kitchensink/.babelrc b/packages/react-scripts/fixtures/kitchensink/.babelrc deleted file mode 100644 index 14397221e3b..00000000000 --- a/packages/react-scripts/fixtures/kitchensink/.babelrc +++ /dev/null @@ -1,4 +0,0 @@ -{ - "presets": ["react-app"], - "plugins": ["babel-plugin-transform-es2015-modules-commonjs"] -} diff --git a/packages/react-scripts/fixtures/kitchensink/.template.dependencies.json b/packages/react-scripts/fixtures/kitchensink/.template.dependencies.json index b8500f804b1..e4d3bec84f2 100644 --- a/packages/react-scripts/fixtures/kitchensink/.template.dependencies.json +++ b/packages/react-scripts/fixtures/kitchensink/.template.dependencies.json @@ -1,8 +1,8 @@ { "dependencies": { - "babel-register": "6.22.0", - "babel-plugin-transform-es2015-modules-commonjs": "6.22.0", - "babel-polyfill": "6.20.0", + "@babel/plugin-transform-modules-commonjs": "7.0.0-beta.36", + "@babel/polyfill": "7.0.0-beta.36", + "@babel/register": "7.0.0-beta.36", "chai": "3.5.0", "jsdom": "9.8.3", "mocha": "3.2.0", diff --git a/packages/react-scripts/package.json b/packages/react-scripts/package.json index 0b2f62eb825..357cc1bb376 100644 --- a/packages/react-scripts/package.json +++ b/packages/react-scripts/package.json @@ -21,13 +21,14 @@ "react-scripts": "./bin/react-scripts.js" }, "dependencies": { + "@babel/core": "7.0.0-beta.36", + "@babel/runtime": "7.0.0-beta.36", "autoprefixer": "7.1.6", - "babel-core": "6.26.0", - "babel-eslint": "7.2.3", + "babel-core": "7.0.0-bridge.0", + "babel-eslint": "8.0.2", "babel-jest": "22.0.6", - "babel-loader": "7.1.2", + "babel-loader": "8.0.0-beta.0", "babel-preset-react-app": "^3.1.1", - "babel-runtime": "6.26.0", "case-sensitive-paths-webpack-plugin": "2.1.1", "chalk": "1.1.3", "css-loader": "0.28.7", diff --git a/tasks/e2e-kitchensink.sh b/tasks/e2e-kitchensink.sh index d73c45ddbfa..7b17163ca9e 100755 --- a/tasks/e2e-kitchensink.sh +++ b/tasks/e2e-kitchensink.sh @@ -134,26 +134,37 @@ REACT_APP_SHELL_ENV_MESSAGE=fromtheshell \ NODE_ENV=test \ yarn test --no-cache --testPathPattern=src -# Test "development" environment +# Prepare "development" environment tmp_server_log=`mktemp` PORT=3001 \ REACT_APP_SHELL_ENV_MESSAGE=fromtheshell \ NODE_PATH=src \ nohup yarn start &>$tmp_server_log & grep -q 'You can now view' <(tail -f $tmp_server_log) + +# Before running Mocha, specify that it should use our preset +# TODO: this is very hacky and we should find some other solution +echo '{"presets":["react-app"]}' > .babelrc + +# Test "development" environment E2E_URL="http://localhost:3001" \ REACT_APP_SHELL_ENV_MESSAGE=fromtheshell \ CI=true NODE_PATH=src \ NODE_ENV=development \ - node_modules/.bin/mocha --require babel-register --require babel-polyfill integration/*.test.js - + BABEL_ENV=test \ + node_modules/.bin/mocha --compilers js:@babel/register --require @babel/polyfill integration/*.test.js # Test "production" environment E2E_FILE=./build/index.html \ CI=true \ NODE_PATH=src \ NODE_ENV=production \ + BABEL_ENV=test \ PUBLIC_URL=http://www.example.org/spa/ \ - node_modules/.bin/mocha --require babel-register --require babel-polyfill integration/*.test.js + node_modules/.bin/mocha --compilers js:@babel/register --require @babel/polyfill integration/*.test.js + +# Remove the config we just created for Mocha +# TODO: this is very hacky and we should find some other solution +rm .babelrc # ****************************************************************************** # Finally, let's check that everything still works after ejecting. @@ -193,15 +204,17 @@ E2E_URL="http://localhost:3002" \ REACT_APP_SHELL_ENV_MESSAGE=fromtheshell \ CI=true NODE_PATH=src \ NODE_ENV=development \ - node_modules/.bin/mocha --require babel-register --require babel-polyfill integration/*.test.js + BABEL_ENV=test \ + node_modules/.bin/mocha --compilers js:@babel/register --require @babel/polyfill integration/*.test.js # Test "production" environment E2E_FILE=./build/index.html \ CI=true \ NODE_ENV=production \ + BABEL_ENV=test \ NODE_PATH=src \ PUBLIC_URL=http://www.example.org/spa/ \ - node_modules/.bin/mocha --require babel-register --require babel-polyfill integration/*.test.js + node_modules/.bin/mocha --compilers js:@babel/register --require @babel/polyfill integration/*.test.js # Cleanup cleanup diff --git a/tasks/replace-own-deps.js b/tasks/replace-own-deps.js index 9178b01029e..15d53d9dc86 100755 --- a/tasks/replace-own-deps.js +++ b/tasks/replace-own-deps.js @@ -16,13 +16,15 @@ const packagesDir = path.join(__dirname, '../packages'); const pkgFilename = path.join(packagesDir, 'react-scripts/package.json'); const data = require(pkgFilename); -fs.readdirSync(packagesDir).forEach((name) => { +fs.readdirSync(packagesDir).forEach(name => { if (data.dependencies[name]) { data.dependencies[name] = 'file:' + path.join(packagesDir, name); } -}) +}); -fs.writeFile(pkgFilename, JSON.stringify(data, null, 2), 'utf8', (err) => { - if (err) throw err; +fs.writeFile(pkgFilename, JSON.stringify(data, null, 2), 'utf8', err => { + if (err) { + throw err; + } console.log('Replaced local dependencies.'); }); From b90f2337d1c4bee35561e7a2c63d15a97de55f6d Mon Sep 17 00:00:00 2001 From: Dan Date: Fri, 12 Jan 2018 13:24:16 +0000 Subject: [PATCH 0023/1323] wip --- .../webpack.config.iframe.js | 26 ++++++++++++------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/packages/react-error-overlay/webpack.config.iframe.js b/packages/react-error-overlay/webpack.config.iframe.js index 2f26b43823f..8e9bed55b42 100644 --- a/packages/react-error-overlay/webpack.config.iframe.js +++ b/packages/react-error-overlay/webpack.config.iframe.js @@ -23,21 +23,27 @@ module.exports = { path.resolve(__dirname, './src'), path.dirname( require.resolve('chalk', { - paths: path.dirname(require.resolve('@babel/code-frame')), + paths: [path.dirname(require.resolve('@babel/code-frame'))], }) ), path.dirname( - require.resolve( - 'ansi-styles', - path.dirname( - require.resolve('chalk', { - paths: path.dirname(require.resolve('@babel/code-frame')), - }) - ) - ) + require.resolve('ansi-styles', { + paths: [ + path.dirname( + require.resolve('chalk', { + paths: [path.dirname(require.resolve('@babel/code-frame'))], + }) + ), + ], + }) ), ], - use: 'babel-loader', + use: { + loader: 'babel-loader', + options: { + presets: ['react-app'], + }, + }, }, ], }, From c8970c4e9a99db27fb541b471ab82a124f228b14 Mon Sep 17 00:00:00 2001 From: Dan Date: Fri, 12 Jan 2018 18:10:40 +0000 Subject: [PATCH 0024/1323] Fix the build --- .../webpack.config.iframe.js | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/packages/react-error-overlay/webpack.config.iframe.js b/packages/react-error-overlay/webpack.config.iframe.js index 8e9bed55b42..1da7c9ba841 100644 --- a/packages/react-error-overlay/webpack.config.iframe.js +++ b/packages/react-error-overlay/webpack.config.iframe.js @@ -21,22 +21,7 @@ module.exports = { test: /\.js$/, include: [ path.resolve(__dirname, './src'), - path.dirname( - require.resolve('chalk', { - paths: [path.dirname(require.resolve('@babel/code-frame'))], - }) - ), - path.dirname( - require.resolve('ansi-styles', { - paths: [ - path.dirname( - require.resolve('chalk', { - paths: [path.dirname(require.resolve('@babel/code-frame'))], - }) - ), - ], - }) - ), + /\/node_modules\/(ansi-styles|chalk)\//, ], use: { loader: 'babel-loader', From 11b4fae3c746f4af5b51a6c458d93269418908e2 Mon Sep 17 00:00:00 2001 From: Dan Abramov Date: Fri, 12 Jan 2018 19:55:28 +0000 Subject: [PATCH 0025/1323] Update appveyor.cleanup-cache.txt --- appveyor.cleanup-cache.txt | 2 -- 1 file changed, 2 deletions(-) diff --git a/appveyor.cleanup-cache.txt b/appveyor.cleanup-cache.txt index ea6d1b9c010..d48a91fdf35 100644 --- a/appveyor.cleanup-cache.txt +++ b/appveyor.cleanup-cache.txt @@ -2,5 +2,3 @@ Edit this file to trigger a cache rebuild. http://help.appveyor.com/discussions/questions/1310-delete-cache ---- -Just testing if this works. -lalala. From a573d37f36ad17a4e9f0a04b8382a85c48bb38bd Mon Sep 17 00:00:00 2001 From: Dan Date: Fri, 12 Jan 2018 20:00:42 +0000 Subject: [PATCH 0026/1323] Fix windows build --- packages/react-error-overlay/webpack.config.iframe.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/react-error-overlay/webpack.config.iframe.js b/packages/react-error-overlay/webpack.config.iframe.js index 1da7c9ba841..e6a7f69de30 100644 --- a/packages/react-error-overlay/webpack.config.iframe.js +++ b/packages/react-error-overlay/webpack.config.iframe.js @@ -21,7 +21,7 @@ module.exports = { test: /\.js$/, include: [ path.resolve(__dirname, './src'), - /\/node_modules\/(ansi-styles|chalk)\//, + /[\/\\]node_modules[\/\\](ansi-styles|chalk)[\/\\]/, ], use: { loader: 'babel-loader', From bf02edbef2a20ff8af66b396d7ee6ae7901c45a0 Mon Sep 17 00:00:00 2001 From: Dan Abramov Date: Fri, 12 Jan 2018 22:43:40 +0000 Subject: [PATCH 0027/1323] Bump eslint-plugin-jsx-a11y version (#2690) * Bump eslint-plugin-jsx-a11y * Update index.js * Update index.js * Update package.json * Don't use links for non-linky things --- packages/eslint-config-react-app/index.js | 7 ++++++- packages/eslint-config-react-app/package.json | 2 +- packages/react-error-overlay/package.json | 2 +- .../src/containers/CompileErrorContainer.js | 4 ++-- packages/react-error-overlay/src/containers/StackFrame.js | 8 ++++---- packages/react-scripts/package.json | 2 +- 6 files changed, 15 insertions(+), 10 deletions(-) diff --git a/packages/eslint-config-react-app/index.js b/packages/eslint-config-react-app/index.js index 9b687663da9..836dd5aa0ae 100644 --- a/packages/eslint-config-react-app/index.js +++ b/packages/eslint-config-react-app/index.js @@ -270,13 +270,18 @@ module.exports = { 'jsx-a11y/accessible-emoji': 'warn', 'jsx-a11y/alt-text': 'warn', 'jsx-a11y/anchor-has-content': 'warn', + 'jsx-a11y/anchor-is-valid': [ + 'warn', + { + aspects: ['noHref', 'invalidHref'], + }, + ], 'jsx-a11y/aria-activedescendant-has-tabindex': 'warn', 'jsx-a11y/aria-props': 'warn', 'jsx-a11y/aria-proptypes': 'warn', 'jsx-a11y/aria-role': 'warn', 'jsx-a11y/aria-unsupported-elements': 'warn', 'jsx-a11y/heading-has-content': 'warn', - 'jsx-a11y/href-no-hash': 'warn', 'jsx-a11y/iframe-has-title': 'warn', 'jsx-a11y/img-redundant-alt': 'warn', 'jsx-a11y/no-access-key': 'warn', diff --git a/packages/eslint-config-react-app/package.json b/packages/eslint-config-react-app/package.json index 86cdbbaf1ef..b15be1dd29a 100644 --- a/packages/eslint-config-react-app/package.json +++ b/packages/eslint-config-react-app/package.json @@ -15,7 +15,7 @@ "eslint": "^4.1.1", "eslint-plugin-flowtype": "^2.34.1", "eslint-plugin-import": "^2.6.0", - "eslint-plugin-jsx-a11y": "^5.1.1", + "eslint-plugin-jsx-a11y": "^6.0.2", "eslint-plugin-react": "^7.1.0" } } diff --git a/packages/react-error-overlay/package.json b/packages/react-error-overlay/package.json index 8b4aa4d443d..8d9f429ce76 100644 --- a/packages/react-error-overlay/package.json +++ b/packages/react-error-overlay/package.json @@ -46,7 +46,7 @@ "eslint-config-react-app": "^2.1.0", "eslint-plugin-flowtype": "2.35.0", "eslint-plugin-import": "2.7.0", - "eslint-plugin-jsx-a11y": "5.1.1", + "eslint-plugin-jsx-a11y": "6.0.2", "eslint-plugin-react": "7.1.0", "flow-bin": "^0.63.1", "html-entities": "1.2.1", diff --git a/packages/react-error-overlay/src/containers/CompileErrorContainer.js b/packages/react-error-overlay/src/containers/CompileErrorContainer.js index 9d1e399fd10..3e9d4611860 100644 --- a/packages/react-error-overlay/src/containers/CompileErrorContainer.js +++ b/packages/react-error-overlay/src/containers/CompileErrorContainer.js @@ -32,14 +32,14 @@ class CompileErrorContainer extends PureComponent { return (
- editorHandler(errLoc) : null } style={canOpenInEditor ? codeAnchorStyle : null} > - +