diff --git a/.alexignore b/.alexignore
new file mode 100644
index 00000000000..0167c31e931
--- /dev/null
+++ b/.alexignore
@@ -0,0 +1,4 @@
+build
+
+CHANGELOG*
+CODE_OF_CONDUCT.md
diff --git a/.alexrc b/.alexrc
new file mode 100644
index 00000000000..8cda2010b9d
--- /dev/null
+++ b/.alexrc
@@ -0,0 +1,18 @@
+{
+ "allow": [
+ "attacks",
+ "colors",
+ "conservative",
+ "crashes",
+ "executed",
+ "executes",
+ "execution",
+ "failed",
+ "hook",
+ "host-hostess",
+ "hostesses-hosts",
+ "invalid",
+ "remain",
+ "watchman-watchwoman"
+ ]
+}
diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS
index ebb18e94002..2308496a692 100644
--- a/.github/CODEOWNERS
+++ b/.github/CODEOWNERS
@@ -1,2 +1,2 @@
-packages/ @amyrlam @bugzpodder @gaearon @ianschmitz @iansu @mrmckeb @petetnt @timer
+packages/ @bugzpodder @ianschmitz @iansu @mrmckeb @petetnt
docusaurus/ @amyrlam @iansu
diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE/bug_report.md
similarity index 91%
rename from .github/ISSUE_TEMPLATE.md
rename to .github/ISSUE_TEMPLATE/bug_report.md
index 2d4f8c8ae01..8153cffe3e2 100644
--- a/.github/ISSUE_TEMPLATE.md
+++ b/.github/ISSUE_TEMPLATE/bug_report.md
@@ -1,30 +1,26 @@
-
-
-### Is this a bug report?
-
-(write your answer here)
-
+---
+name: Bug report
+about: Create a report to help us improve
+labels: 'issue: bug report, needs triage'
+---
+### Describe the bug
+
+(Write your answer here.)
+
### Did you try recovering your dependencies?
-(paste the output of the command here)
-
+(paste the output of the command here.)
-### Steps to Reproduce
+### Steps to reproduce
+
+(Write your answer here.)
+
+### Describe the solution you'd like
+
+
+
+(Describe your proposed solution here.)
+
+### Describe alternatives you've considered
+
+
+
+(Write your answer here.)
+
+### Additional context
+
+
+
+(Write your answer here.)
diff --git a/.github/ISSUE_TEMPLATE/question.md b/.github/ISSUE_TEMPLATE/question.md
new file mode 100644
index 00000000000..147ea1dc458
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/question.md
@@ -0,0 +1,13 @@
+---
+name: Question
+about: Get help with Create React App
+labels: 'needs triage'
+---
+
+If you have a general question about Create React App or about building an app with Create React App we encourage you to post on our Spectrum community instead of this issue tracker. The maintainers and other community members can provide help and answer your questions there: https://spectrum.chat/create-react-app
+
+If you're looking for general information on using React, the React docs have a list of resources: https://reactjs.org/community/support.html
+
+If you've discovered a bug or would like to propose a change please use one of the other issue templates.
+
+Thanks!
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
new file mode 100644
index 00000000000..7b94526e804
--- /dev/null
+++ b/.github/workflows/build.yml
@@ -0,0 +1,13 @@
+name: Build
+
+on: [push]
+
+jobs:
+ build:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v1
+ - name: Install
+ run: yarn --no-progress --non-interactive --no-lockfile
+ - name: Build
+ run: yarn build
diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml
new file mode 100644
index 00000000000..a2e7567d1e1
--- /dev/null
+++ b/.github/workflows/lint.yml
@@ -0,0 +1,13 @@
+name: Lint
+
+on: [push]
+
+jobs:
+ lint:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v1
+ - name: Install
+ run: yarn --no-progress --non-interactive --no-lockfile
+ - name: Alex
+ run: yarn alex
diff --git a/.gitignore b/.gitignore
index ffa71fafc6d..a3e7a11d130 100644
--- a/.gitignore
+++ b/.gitignore
@@ -12,3 +12,4 @@ yarn-debug.log*
yarn-error.log*
/.changelog
.npm/
+yarn.lock
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index dda58096f90..00000000000
--- a/.travis.yml
+++ /dev/null
@@ -1,35 +0,0 @@
----
-dist: trusty
-language: node_js
-node_js:
- - 8
- - 10
-cache:
- yarn: true
- directories:
- - .npm
-before_install:
- - curl -o- -L https://yarnpkg.com/install.sh | bash -s
- - export PATH="$HOME/.yarn/bin:$PATH"
-install: true
-script:
- - 'if [ $TEST_SUITE = "simple" ]; then tasks/e2e-simple.sh; fi'
- - 'if [ $TEST_SUITE = "installs" ]; then tasks/e2e-installs.sh; fi'
- - 'if [ $TEST_SUITE = "kitchensink" ]; then tasks/e2e-kitchensink.sh; fi'
- - 'if [ $TEST_SUITE = "kitchensink-eject" ]; then tasks/e2e-kitchensink-eject.sh; fi'
- - 'if [ $TEST_SUITE = "old-node" ]; then tasks/e2e-old-node.sh; fi'
- - 'if [ $TEST_SUITE = "behavior" ]; then tasks/e2e-behavior.sh; fi'
-env:
- matrix:
- - TEST_SUITE=simple
- - TEST_SUITE=installs
- - TEST_SUITE=kitchensink
- - TEST_SUITE=kitchensink-eject
- - TEST_SUITE=behavior
-matrix:
- include:
- - os: osx
- node_js: 8
- env: TEST_SUITE=behavior
- - node_js: 6
- env: TEST_SUITE=old-node
diff --git a/CHANGELOG-1.x.md b/CHANGELOG-1.x.md
index ae2725af297..fb1b1cc1d2c 100644
--- a/CHANGELOG-1.x.md
+++ b/CHANGELOG-1.x.md
@@ -1,6 +1,6 @@
## 2.0.3 and Newer Versions
-**Please refer to [CHANGELOG.md](./CHANGELOG.md) for the newer versions.**
+**Please refer to [CHANGELOG-2.x.md](./CHANGELOG-2.x.md) for the 2.x range, and [CHANGELOG.md](CHANGELOG.md) for the newer versions.**
## 1.1.5 (August 24, 2018)
@@ -482,7 +482,7 @@ yarn add --exact react-scripts@1.0.16
- [#3150](https://github.com/facebook/create-react-app/pull/3150) Remove an useless negation in `registerServiceWorker.js`. ([@dunglas](https://github.com/dunglas))
- [#3158](https://github.com/facebook/create-react-app/pull/3158) Remove `output.path` from dev webpack config. ([@nikolas](https://github.com/nikolas))
- - [#3281](https://github.com/facebook/create-react-app/pull/3281) Add a workaround for Uglify incompatiblity with Safari 10.0 in the future. ([@satyavh](https://github.com/satyavh))
+ - [#3281](https://github.com/facebook/create-react-app/pull/3281) Add a workaround for Uglify incompatibility with Safari 10.0 in the future. ([@satyavh](https://github.com/satyavh))
- [#3146](https://github.com/facebook/create-react-app/pull/3146) Fix `reason-react` support. ([@lpalmes](https://github.com/lpalmes))
- [#3236](https://github.com/facebook/create-react-app/pull/3236) Update `style-loader` and disable inclusion of its HMR code in builds. ([@insin](https://github.com/insin))
- [#3246](https://github.com/facebook/create-react-app/pull/3246) Update `url-loader` to 0.6.2 for mime ReDoS vulnerability. ([@d3viant0ne](https://github.com/d3viant0ne))
@@ -1443,7 +1443,7 @@ yarn add --dev --exact react-scripts@1.0.1
## 1.0.0 (May 18, 2017)
-We’ve been working on this release for the past few months, and there are many big impovements, from migrating to webpack 2 to a brand new runtime error overlay and built-in support for Progressive Web Apps.
+We’ve been working on this release for the past few months, and there are many big improvements, from migrating to webpack 2 to a brand new runtime error overlay and built-in support for Progressive Web Apps.
So instead of just enumerating them here, we decided to write a blog post about all the new features.
Check it out: **[What’s New in Create React App](https://facebook.github.io/react/blog/2017/05/18/whats-new-in-create-react-app.html)**.
@@ -1577,20 +1577,20 @@ Unhandled Promise rejections will now crash tests. You can fix them by explicitl
After the regular update procedure above, add these line to `
` in `public/index.html`:
```html
-
-
-
+
```
Add `` to `` in `public/index.html`:
```html
-
- You need to enable JavaScript to run this app.
-
+
+ You need to enable JavaScript to run this app.
+
```
Then create a file called `public/manifest.json` that looks like this:
diff --git a/CHANGELOG-2.x.md b/CHANGELOG-2.x.md
index 27d74fd97dc..e30c5e63ec0 100644
--- a/CHANGELOG-2.x.md
+++ b/CHANGELOG-2.x.md
@@ -1,3 +1,7 @@
+## 3.0.0 and Newer Versions
+
+**Please refer to [CHANGELOG.md](./CHANGELOG.md) for the newer versions.**
+
## 2.1.8 (March 7, 2019)
v2.1.8 is a maintenance release that reapplies the TypeScript speed improvements ([#6406](https://github.com/facebook/create-react-app/pull/6406)) in a new major version of `react-dev-utils`.
diff --git a/CHANGELOG.md b/CHANGELOG.md
index c48afc861ce..08c995a14ab 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,398 @@
+## 3.2.0 (2019-10-03)
+
+v3.2.0 is a minor release that adds support for production profiling and ignoring TypeScript type errors to make migrating JavaScript projects to TypeScript easier. It also includes other minor bug fixes and documentation updates.
+
+#### :rocket: New Feature
+
+- `react-scripts`
+ - [#7737](https://github.com/facebook/create-react-app/pull/7737) Support production profiling with React Developer Tools ([@JacobMGEvans](https://github.com/JacobMGEvans))
+- `react-dev-utils`, `react-scripts`
+ - [#6931](https://github.com/facebook/create-react-app/pull/6931) Adds TSC_COMPILE_ON_ERROR env var... ([@kylebebak](https://github.com/kylebebak))
+
+#### :bug: Bug Fix
+
+- `react-scripts`
+ - [#7754](https://github.com/facebook/create-react-app/pull/7754) Fix linting error when using rest props ([@alexandrtovmach](https://github.com/alexandrtovmach))
+- `react-app-polyfill`
+ - [#7205](https://github.com/facebook/create-react-app/pull/7205) Guard polyfills against window possibly being undefined ([@jxom](https://github.com/jxom))
+
+#### :nail_care: Enhancement
+
+- `react-scripts`
+ - [#7687](https://github.com/facebook/create-react-app/pull/7687) Use installing package manager in README ([@ashr81](https://github.com/ashr81))
+ - [#7755](https://github.com/facebook/create-react-app/pull/7755) Support setting baseUrl to root directory ([@rovansteen](https://github.com/rovansteen))
+ - [#7530](https://github.com/facebook/create-react-app/pull/7530) only load eslint config when EXTEND_ESLINT environment variable is specified/ do not swallow eslint config errors ([@n1ru4l](https://github.com/n1ru4l))
+ - [#7742](https://github.com/facebook/create-react-app/pull/7742) set output.globalObject to 'this' ([@kentcdodds](https://github.com/kentcdodds))
+ - [#7721](https://github.com/facebook/create-react-app/pull/7721) Add "entrypoints" key to asset manifest ([@samuelmeuli](https://github.com/samuelmeuli))
+ - [#7562](https://github.com/facebook/create-react-app/pull/7562) enable .eslintignore again ([@igtm](https://github.com/igtm))
+- `react-dev-utils`
+ - [#6980](https://github.com/facebook/create-react-app/pull/6980) Stop hiding the column number of ESLint errors ([@justingrant](https://github.com/justingrant))
+
+#### :memo: Documentation
+
+- [#7302](https://github.com/facebook/create-react-app/pull/7302) docs: note that 2 to 3 migration may require deletion of node_modules ([@kimpers](https://github.com/kimpers))
+- [#7757](https://github.com/facebook/create-react-app/pull/7757) Documentation typo fix: accessbile→accessible ([@tomer](https://github.com/tomer))
+- [#7601](https://github.com/facebook/create-react-app/pull/7601) [Documentation] Updated list of supported Jest config overrides ([@neilbryson](https://github.com/neilbryson))
+- [#7705](https://github.com/facebook/create-react-app/pull/7705) Update runtime chunk name separator in docs ([@samuelmeuli](https://github.com/samuelmeuli))
+
+#### :house: Internal
+
+- `react-scripts`
+ - [#7752](https://github.com/facebook/create-react-app/pull/7752) Fix wrong letter casing ([@lewislbr](https://github.com/lewislbr))
+- `react-dev-utils`, `react-scripts`
+ - [#7707](https://github.com/facebook/create-react-app/pull/7707) Remove 'shortcut' link type before 'icon' ([@lewislbr](https://github.com/lewislbr))
+
+#### :hammer: Underlying Tools
+
+- `react-scripts`
+ - [#7729](https://github.com/facebook/create-react-app/pull/7729) Remove switch case ([@andrelmlins](https://github.com/andrelmlins))
+
+#### Committers: 19
+
+- Alexandr Tovmach ([@alexandrtovmach](https://github.com/alexandrtovmach))
+- André Lins ([@andrelmlins](https://github.com/andrelmlins))
+- Ashrith Reddy ([@ashr81](https://github.com/ashr81))
+- Federico Zivolo ([@FezVrasta](https://github.com/FezVrasta))
+- Iguchi Tomokatsu ([@igtm](https://github.com/igtm))
+- Jacob M-G Evans ([@JacobMGEvans](https://github.com/JacobMGEvans))
+- Jake Moxey ([@jxom](https://github.com/jxom))
+- Justin Grant ([@justingrant](https://github.com/justingrant))
+- Kent C. Dodds ([@kentcdodds](https://github.com/kentcdodds))
+- Kim Persson ([@kimpers](https://github.com/kimpers))
+- Kyle Bebak ([@kylebebak](https://github.com/kylebebak))
+- Laurin Quast ([@n1ru4l](https://github.com/n1ru4l))
+- Lewis Llobera ([@lewislbr](https://github.com/lewislbr))
+- Rakan Nimer ([@rakannimer](https://github.com/rakannimer))
+- Reece Dunham ([@RDIL](https://github.com/RDIL))
+- Robert van Steen ([@rovansteen](https://github.com/rovansteen))
+- Samuel Meuli ([@samuelmeuli](https://github.com/samuelmeuli))
+- Tomer Cohen ([@tomer](https://github.com/tomer))
+- neilbryson ([@neilbryson](https://github.com/neilbryson))
+
+### Migrating from 3.1.2 to 3.2.0
+
+Inside any created project that has not been ejected, run:
+
+```sh
+npm install --save --save-exact react-scripts@3.2.0
+```
+
+or
+
+```sh
+yarn add --exact react-scripts@3.2.0
+```
+
+## 3.1.2 (2019-09-19)
+
+v3.1.2 is a maintenance release that includes minor bug fixes and documentation updates.
+
+#### :bug: Bug Fix
+
+- `react-scripts`
+ - [#7679](https://github.com/facebook/create-react-app/pull/7679) Change runtime chunk name separator from tilde to dash ([@javadoug](https://github.com/javadoug))
+ - [#7538](https://github.com/facebook/create-react-app/pull/7538) Explicitly checking that EXTEND_ESLINT is true ([@BrockWills](https://github.com/BrockWills))
+- `babel-preset-react-app`, `react-error-overlay`, `react-scripts`
+ - [#7662](https://github.com/facebook/create-react-app/pull/7662) Fix build ([@ianschmitz](https://github.com/ianschmitz))
+
+#### :nail_care: Enhancement
+
+- `react-scripts`
+ - [#7704](https://github.com/facebook/create-react-app/pull/7704) Add new logo ([@iansu](https://github.com/iansu))
+ - [#7587](https://github.com/facebook/create-react-app/pull/7587) Minor performance improvements ([@deftomat](https://github.com/deftomat))
+ - [#7633](https://github.com/facebook/create-react-app/pull/7633) Disable babel-loader's cacheCompression ([@jleclanche](https://github.com/jleclanche))
+
+#### :memo: Documentation
+
+- [#7616](https://github.com/facebook/create-react-app/pull/7616) Update deployment.md with another AWS example ([@AndrewBestbier](https://github.com/AndrewBestbier))
+- [#7663](https://github.com/facebook/create-react-app/pull/7663) Remove --single-quote from prettier examples ([@brlewis](https://github.com/brlewis))
+- [#7659](https://github.com/facebook/create-react-app/pull/7659) Update running-tests.md ([@weyert](https://github.com/weyert))
+- [#7459](https://github.com/facebook/create-react-app/pull/7459) Update troubleshooting.md ([@prevostc](https://github.com/prevostc))
+- [#7650](https://github.com/facebook/create-react-app/pull/7650) Adopt Contributor Covenant ([@iansu](https://github.com/iansu))
+- [#7620](https://github.com/facebook/create-react-app/pull/7620) cleanup-after-each is no longer necessary! ([@iHmD](https://github.com/iHmD))
+- [#7613](https://github.com/facebook/create-react-app/pull/7613) Fix seams between changelog majors ([@emilpalsson](https://github.com/emilpalsson))
+- [#7368](https://github.com/facebook/create-react-app/pull/7368) Correcting proxy sample ([@szabolcs-szilagyi](https://github.com/szabolcs-szilagyi))
+- [#7536](https://github.com/facebook/create-react-app/pull/7536) add a migration step to remove static from robots.txt ([@lookfirst](https://github.com/lookfirst))
+- [#7521](https://github.com/facebook/create-react-app/pull/7521) Show logo for mobile views in create-react-app.dev ([@GrooChu](https://github.com/GrooChu))
+
+#### :house: Internal
+
+- `react-scripts`
+ - [#7526](https://github.com/facebook/create-react-app/pull/7526) The variable dotenvFiles is never reassigned - use const instead ([@Primajin](https://github.com/Primajin))
+ - [#7585](https://github.com/facebook/create-react-app/pull/7585) remove trailing spaces ([@xiaoxiangmoe](https://github.com/xiaoxiangmoe))
+
+#### :hammer: Underlying Tools
+
+- `babel-plugin-named-asset-import`, `confusing-browser-globals`, `react-app-polyfill`, `react-dev-utils`, `react-error-overlay`, `react-scripts`
+ - [#7681](https://github.com/facebook/create-react-app/pull/7681) Bump dependencies ([@ianschmitz](https://github.com/ianschmitz))
+- `react-scripts`
+ - [#7531](https://github.com/facebook/create-react-app/pull/7531) Upgrade dotenv-expand to fix issues ([@DominicTobias](https://github.com/DominicTobias))
+- `eslint-config-react-app`, `react-scripts`
+ - [#7540](https://github.com/facebook/create-react-app/pull/7540) Bump version of @typescript-eslint/\* ([@pierreneter](https://github.com/pierreneter))
+
+#### Committers: 20
+
+- Andrew ([@AndrewBestbier](https://github.com/AndrewBestbier))
+- Brock Wills ([@BrockWills](https://github.com/BrockWills))
+- Clément Prévost ([@prevostc](https://github.com/prevostc))
+- Dominic Tobias ([@DominicTobias](https://github.com/DominicTobias))
+- Doug Ross ([@javadoug](https://github.com/javadoug))
+- Emil Pålsson ([@emilpalsson](https://github.com/emilpalsson))
+- Federico Zivolo ([@FezVrasta](https://github.com/FezVrasta))
+- Ian Schmitz ([@ianschmitz](https://github.com/ianschmitz))
+- Ian Sutherland ([@iansu](https://github.com/iansu))
+- Jannis Hell ([@Primajin](https://github.com/Primajin))
+- Jerome Leclanche ([@jleclanche](https://github.com/jleclanche))
+- Jon Stevens ([@lookfirst](https://github.com/lookfirst))
+- Sabesh Rajendran ([@GrooChu](https://github.com/GrooChu))
+- Tomáš Szabo ([@deftomat](https://github.com/deftomat))
+- Weyert de Boer ([@weyert](https://github.com/weyert))
+- ZHAO Jinxiang ([@xiaoxiangmoe](https://github.com/xiaoxiangmoe))
+- [@brlewis](https://github.com/brlewis)
+- [@iHmD](https://github.com/iHmD)
+- [@pierreneter](https://github.com/pierreneter)
+- szabi ([@szabolcs-szilagyi](https://github.com/szabolcs-szilagyi))
+
+### Migrating from 3.1.1 to 3.1.2
+
+Inside any created project that has not been ejected, run:
+
+```sh
+npm install --save --save-exact react-scripts@3.1.2
+```
+
+or
+
+```sh
+yarn add --exact react-scripts@3.1.2
+```
+
+## 3.1.1 (2019-08-13)
+
+v3.1.1 is a maintenance release that includes minor bug fixes and documentation updates.
+
+#### :bug: Bug Fix
+
+- `react-scripts`
+ - [#7513](https://github.com/facebook/create-react-app/pull/7513) Fix ESLint 6 support ([@ianschmitz](https://github.com/ianschmitz))
+ - [#7508](https://github.com/facebook/create-react-app/pull/7508) Don't block static files in robots.txt ([@iansu](https://github.com/iansu))
+
+#### :nail_care: Enhancement
+
+- `eslint-config-react-app`
+ - [#7393](https://github.com/facebook/create-react-app/pull/7393) Ignore "jsx-a11y/aria-role" for React components ([@deftomat](https://github.com/deftomat))
+
+#### :memo: Documentation
+
+- [#7527](https://github.com/facebook/create-react-app/pull/7527) Update Netlify config ([@iansu](https://github.com/iansu))
+- [#7500](https://github.com/facebook/create-react-app/pull/7500) Add links to Spectrum in README and docs ([@iansu](https://github.com/iansu))
+
+#### Committers: 3
+
+- Ian Schmitz ([@ianschmitz](https://github.com/ianschmitz))
+- Ian Sutherland ([@iansu](https://github.com/iansu))
+- Tomáš Szabo ([@deftomat](https://github.com/deftomat))
+
+### Migrating from 3.1.0 to 3.1.1
+
+Optionally remove `Disallow: /static/` from `public/robots.txt` if you want to allow your images and other static files to be indexed by search engines [#7508](https://github.com/facebook/create-react-app/pull/7508)
+
+Inside any created project that has not been ejected, run:
+
+```sh
+npm install --save --save-exact react-scripts@3.1.1
+```
+
+or
+
+```sh
+yarn add --exact react-scripts@3.1.1
+```
+
+## 3.1.0 (2019-08-09)
+
+v3.1.0 is a minor release that adds ESLint 6 support as well as experimental support for extended and customizing the ESLint config along with other minor bug fixes and documentation updates. The upgrade to ESLint 6 is a breaking change _only_ if you're using `eslint-config-react-app` or `react-error-overlay` outside of Create React App.
+
+# Highlights
+
+- ESLint 6: #7415
+- Experimental ESLint config customization: #7036
+- More Jest config options: #6055
+- Option to configure or disable image inlining: #6060
+
+#### :rocket: New Feature
+
+- `eslint-config-react-app`, `react-error-overlay`, `react-scripts`
+ - [#7415](https://github.com/facebook/create-react-app/pull/7415) Add ESLint 6 support ([@mrmckeb](https://github.com/mrmckeb))
+- `eslint-config-react-app`, `react-scripts`
+ - [#7036](https://github.com/facebook/create-react-app/pull/7036) Add ESLint extend support to eslint-loader ([@mrmckeb](https://github.com/mrmckeb))
+- `react-dev-utils`
+ - [#7277](https://github.com/facebook/create-react-app/pull/7277) Handle browser arguments ([@arvigeus](https://github.com/arvigeus))
+- `react-scripts`
+ - [#6060](https://github.com/facebook/create-react-app/pull/6060) Add environment variable to control image inlining threshold ([@peterbe](https://github.com/peterbe))
+ - [#6055](https://github.com/facebook/create-react-app/pull/6055) Support for graceful extension of Jest config ([@jamesmfriedman](https://github.com/jamesmfriedman))
+
+#### :boom: Breaking Change
+
+- `eslint-config-react-app`, `react-error-overlay`, `react-scripts`
+ - [#7415](https://github.com/facebook/create-react-app/pull/7415) Add ESLint 6 support ([@mrmckeb](https://github.com/mrmckeb))
+
+#### :bug: Bug Fix
+
+- `react-dev-utils`
+ - [#7444](https://github.com/facebook/create-react-app/pull/7444) Fix for #6720: HMR not working in Firefox if proxy option present ([@dmile](https://github.com/dmile))
+- `react-scripts`
+ - [#5829](https://github.com/facebook/create-react-app/pull/5829) Resolve relative paths for preprocessor styles ([@iamandrewluca](https://github.com/iamandrewluca))
+ - [#7433](https://github.com/facebook/create-react-app/pull/7433) Add explicit check for --watchAll=false ([@mrmckeb](https://github.com/mrmckeb))
+ - [#7378](https://github.com/facebook/create-react-app/pull/7378) Update url-loader to 2.0.1 ([@heyimalex](https://github.com/heyimalex))
+- `eslint-config-react-app`
+ - [#7230](https://github.com/facebook/create-react-app/pull/7230) jsx-no-duplicate-props ignore case fix ([@rommguy](https://github.com/rommguy))
+ - [#7219](https://github.com/facebook/create-react-app/pull/7219) fix: eslintrc overrides key should be an array, not object ([@ivan-aksamentov](https://github.com/ivan-aksamentov))
+ - [#7079](https://github.com/facebook/create-react-app/pull/7079) Adjust typescript-eslint to not warn about typedefs when used before defined ([@vincentjames501](https://github.com/vincentjames501))
+- `react-error-overlay`, `react-scripts`
+ - [#7257](https://github.com/facebook/create-react-app/pull/7257) Upgrade webpack to 4.35.0 to fix dynamic import issue ([@iansu](https://github.com/iansu))
+
+#### :nail_care: Enhancement
+
+- `react-scripts`
+ - [#7497](https://github.com/facebook/create-react-app/pull/7497) add readonly modifier for css module ([@xiaoxiangmoe](https://github.com/xiaoxiangmoe))
+ - [#7496](https://github.com/facebook/create-react-app/pull/7496) bump sass-loader ([@xiaoxiangmoe](https://github.com/xiaoxiangmoe))
+ - [#7176](https://github.com/facebook/create-react-app/pull/7176) Fix RegExp from navigateFallbackBlacklist (workbox) ([@nuragic](https://github.com/nuragic))
+ - [#7080](https://github.com/facebook/create-react-app/pull/7080) Support configuring coveragePathIgnorePatterns ([@kentcdodds](https://github.com/kentcdodds))
+ - [#7482](https://github.com/facebook/create-react-app/pull/7482) 100% lighthouse score for progressive web app ([@dscanlan](https://github.com/dscanlan))
+ - [#5951](https://github.com/facebook/create-react-app/pull/5951) Set jsonpFunction by default ([@sibiraj-s](https://github.com/sibiraj-s))
+ - [#7472](https://github.com/facebook/create-react-app/pull/7472) Typescript init: suggest `jsx: "react"` in tsconfig ([@kingdaro](https://github.com/kingdaro))
+ - [#7118](https://github.com/facebook/create-react-app/pull/7118) Append title element to SVG component via title prop ([@sudkumar](https://github.com/sudkumar))
+- `react-dev-utils`
+ - [#7028](https://github.com/facebook/create-react-app/pull/7028) Add vscodium to the editor list ([@leonardodino](https://github.com/leonardodino))
+ - [#7277](https://github.com/facebook/create-react-app/pull/7277) Handle browser arguments ([@arvigeus](https://github.com/arvigeus))
+- `eslint-config-react-app`, `react-error-overlay`, `react-scripts`
+ - [#7415](https://github.com/facebook/create-react-app/pull/7415) Add ESLint 6 support ([@mrmckeb](https://github.com/mrmckeb))
+- `eslint-config-react-app`
+ - [#7179](https://github.com/facebook/create-react-app/pull/7179) Disabled Typescript no-undef rule per typescript-eslint #477 ([@andyhopp](https://github.com/andyhopp))
+- `create-react-app`
+ - [#6941](https://github.com/facebook/create-react-app/pull/6941) Fix compatibility of create-react-app to Node.js v0.10+ ([@tobiasbueschel](https://github.com/tobiasbueschel))
+
+#### :memo: Documentation
+
+- Other
+ - [#7488](https://github.com/facebook/create-react-app/pull/7488) Adjusted deployment documentation for ZEIT Now ([@leo](https://github.com/leo))
+ - [#7462](https://github.com/facebook/create-react-app/pull/7462) Added dependencies to bootstrap article when using custom SCSS. ([@eclectic-coding](https://github.com/eclectic-coding))
+ - [#7340](https://github.com/facebook/create-react-app/pull/7340) Update testing-library related npm package names in README ([@balazsorban44](https://github.com/balazsorban44))
+ - [#7423](https://github.com/facebook/create-react-app/pull/7423) Add question issue template ([@iansu](https://github.com/iansu))
+ - [#7260](https://github.com/facebook/create-react-app/pull/7260) Docs: remove an outdated TypeScript-related note ([@MidnightDesign](https://github.com/MidnightDesign))
+ - [#7372](https://github.com/facebook/create-react-app/pull/7372) proposal dynamic import are stage 4 ([@gespispace](https://github.com/gespispace))
+ - [#7374](https://github.com/facebook/create-react-app/pull/7374) docs(svg): add tip for title props accessibility ([@sudkumar](https://github.com/sudkumar))
+ - [#7182](https://github.com/facebook/create-react-app/pull/7182) Update minimum Node versions in docs ([@JESii](https://github.com/JESii))
+ - [#7317](https://github.com/facebook/create-react-app/pull/7317) Fix typo ([@mvasin](https://github.com/mvasin))
+ - [#7262](https://github.com/facebook/create-react-app/pull/7262) Docs: replace the command line to install relay/macro ([@soufDev](https://github.com/soufDev))
+ - [#7170](https://github.com/facebook/create-react-app/pull/7170) Update deprecated package reference ([@bnewcomb](https://github.com/bnewcomb))
+ - [#7133](https://github.com/facebook/create-react-app/pull/7133) Make the OOM abreviation more clear ([@tlehtimaki](https://github.com/tlehtimaki))
+ - [#7086](https://github.com/facebook/create-react-app/pull/7086) Improve breaking changes info for CRA 3.0.0 ([@falldowngoboone](https://github.com/falldowngoboone))
+ - [#7059](https://github.com/facebook/create-react-app/pull/7059) Correct spelling of browserslist ([@amyrlam](https://github.com/amyrlam))
+ - [#7039](https://github.com/facebook/create-react-app/pull/7039) docs: fix env-cmd example in deployment section ([@VMois](https://github.com/VMois))
+ - [#7041](https://github.com/facebook/create-react-app/pull/7041) Updates the relay docs ([@orta](https://github.com/orta))
+- `eslint-config-react-app`
+ - [#7451](https://github.com/facebook/create-react-app/pull/7451) Update README for ESLint config ([@mrmckeb](https://github.com/mrmckeb))
+ - [#7274](https://github.com/facebook/create-react-app/pull/7274) Update peer dependencies ([@ThewBear](https://github.com/ThewBear))
+- `react-error-overlay`, `react-scripts`
+ - [#7355](https://github.com/facebook/create-react-app/pull/7355) Fix typos ([@minho42](https://github.com/minho42))
+
+#### :house: Internal
+
+- `babel-preset-react-app`
+ - [#5818](https://github.com/facebook/create-react-app/pull/5818) Remove unused dependencies in babel-preset-react-app ([@iansu](https://github.com/iansu))
+ - [#7208](https://github.com/facebook/create-react-app/pull/7208) Use correct babel transform for dynamic import in dependencies ([@jamesknelson](https://github.com/jamesknelson))
+- `react-scripts`
+ - [#7433](https://github.com/facebook/create-react-app/pull/7433) Add explicit check for --watchAll=false ([@mrmckeb](https://github.com/mrmckeb))
+ - [#6877](https://github.com/facebook/create-react-app/pull/6877) Upgrade svgr to 4.2.0 ([@iansu](https://github.com/iansu))
+- Other
+ - [#7385](https://github.com/facebook/create-react-app/pull/7385) Attempt at fixing CI issue on windows ([@heyimalex](https://github.com/heyimalex))
+ - [#7269](https://github.com/facebook/create-react-app/pull/7269) Update issue templates ([@mrmckeb](https://github.com/mrmckeb))
+ - [#7220](https://github.com/facebook/create-react-app/pull/7220) Disable Travis build ([@ianschmitz](https://github.com/ianschmitz))
+ - [#7096](https://github.com/facebook/create-react-app/pull/7096) Add Azure DevOps build pipeline ([@ianschmitz](https://github.com/ianschmitz))
+ - [#6858](https://github.com/facebook/create-react-app/pull/6858) Add test to make sure .d.ts files are ignored when checking for TypeScript ([@iansu](https://github.com/iansu))
+- `react-error-overlay`, `react-scripts`
+ - [#7355](https://github.com/facebook/create-react-app/pull/7355) Fix typos ([@minho42](https://github.com/minho42))
+
+#### :hammer: Underlying Tools
+
+- `babel-plugin-named-asset-import`, `babel-preset-react-app`, `confusing-browser-globals`, `create-react-app`, `react-app-polyfill`, `react-dev-utils`, `react-error-overlay`, `react-scripts`
+ - [#7473](https://github.com/facebook/create-react-app/pull/7473) Bump dependencies ([@ianschmitz](https://github.com/ianschmitz))
+- `eslint-config-react-app`, `react-error-overlay`, `react-scripts`
+ - [#7415](https://github.com/facebook/create-react-app/pull/7415) Add ESLint 6 support ([@mrmckeb](https://github.com/mrmckeb))
+- `eslint-config-react-app`, `react-scripts`
+ - [#7036](https://github.com/facebook/create-react-app/pull/7036) Add ESLint extend support to eslint-loader ([@mrmckeb](https://github.com/mrmckeb))
+- `react-scripts`
+ - [#7118](https://github.com/facebook/create-react-app/pull/7118) Append title element to SVG component via title prop ([@sudkumar](https://github.com/sudkumar))
+ - [#7222](https://github.com/facebook/create-react-app/pull/7222) Update @typescript-eslint package versions ([@ianschmitz](https://github.com/ianschmitz))
+ - [#7131](https://github.com/facebook/create-react-app/pull/7131) Update fsevents dependency version ([@eps1lon](https://github.com/eps1lon))
+- `react-dev-utils`
+ - [#7058](https://github.com/facebook/create-react-app/pull/7058) fix: Replaced opn (deprecated) with open ([@jamesgeorge007](https://github.com/jamesgeorge007))
+
+#### Committers: 46
+
+- Adeel Imran ([@adeelibr](https://github.com/adeelibr))
+- Alex Guerra ([@heyimalex](https://github.com/heyimalex))
+- Amy Lam ([@amyrlam](https://github.com/amyrlam))
+- Andrea Puddu ([@nuragic](https://github.com/nuragic))
+- Andrew Luca ([@iamandrewluca](https://github.com/iamandrewluca))
+- Andy Hopper ([@andyhopp](https://github.com/andyhopp))
+- Balázs Orbán ([@balazsorban44](https://github.com/balazsorban44))
+- Ben Newcomb ([@bnewcomb](https://github.com/bnewcomb))
+- Brian Muenzenmeyer ([@bmuenzenmeyer](https://github.com/bmuenzenmeyer))
+- Brody McKee ([@mrmckeb](https://github.com/mrmckeb))
+- Chuck ([@eclectic-coding](https://github.com/eclectic-coding))
+- Darius Tall ([@kingdaro](https://github.com/kingdaro))
+- Dmitry Lepskiy ([@dmile](https://github.com/dmile))
+- Guy Romm ([@rommguy](https://github.com/rommguy))
+- Ian Schmitz ([@ianschmitz](https://github.com/ianschmitz))
+- Ian Sutherland ([@iansu](https://github.com/iansu))
+- Igor Muchychka ([@mucsi96](https://github.com/mucsi96))
+- Ivan Aksamentov ([@ivan-aksamentov](https://github.com/ivan-aksamentov))
+- Ivan Pegashev ([@gespispace](https://github.com/gespispace))
+- Jack Cross ([@crosscompile](https://github.com/crosscompile))
+- James Friedman ([@jamesmfriedman](https://github.com/jamesmfriedman))
+- James George ([@jamesgeorge007](https://github.com/jamesgeorge007))
+- James K Nelson ([@jamesknelson](https://github.com/jamesknelson))
+- Jon Seidel ([@JESii](https://github.com/JESii))
+- Kent C. Dodds ([@kentcdodds](https://github.com/kentcdodds))
+- Leo Lamprecht ([@leo](https://github.com/leo))
+- Leonardo Dino ([@leonardodino](https://github.com/leonardodino))
+- Mikhail Vasin ([@mvasin](https://github.com/mvasin))
+- Min ho Kim ([@minho42](https://github.com/minho42))
+- Nikolay Stoynov ([@arvigeus](https://github.com/arvigeus))
+- Orta ([@orta](https://github.com/orta))
+- Peter Bengtsson ([@peterbe](https://github.com/peterbe))
+- Rudolph Gottesheim ([@MidnightDesign](https://github.com/MidnightDesign))
+- Ryan Boone ([@falldowngoboone](https://github.com/falldowngoboone))
+- Ryan Marsh ([@ryanwmarsh](https://github.com/ryanwmarsh))
+- Sebastian Silbermann ([@eps1lon](https://github.com/eps1lon))
+- Sibiraj ([@sibiraj-s](https://github.com/sibiraj-s))
+- Soufiane AIT AKKACHE ([@soufDev](https://github.com/soufDev))
+- Sudhir Mitharwal ([@sudkumar](https://github.com/sudkumar))
+- Thew Dhanat ([@ThewBear](https://github.com/ThewBear))
+- Tobias Büschel ([@tobiasbueschel](https://github.com/tobiasbueschel))
+- Toni ([@tlehtimaki](https://github.com/tlehtimaki))
+- Vincent Pizzo ([@vincentjames501](https://github.com/vincentjames501))
+- Vladyslav Moisieienkov ([@VMois](https://github.com/VMois))
+- ZHAO Jinxiang ([@xiaoxiangmoe](https://github.com/xiaoxiangmoe))
+- dominic scanlan ([@dscanlan](https://github.com/dscanlan))
+
+### Migrating from 3.0.1 to 3.1.0
+
+Inside any created project that has not been ejected, run:
+
+```sh
+npm install --save --save-exact react-scripts@3.1.0
+```
+
+or
+
+```sh
+yarn add --exact react-scripts@3.1.0
+```
+
## 3.0.1 (2019-05-08)
v3.0.1 is a maintenance release that adjusts some ESLint rules for TypeScript along with other minor bug fixes and documentation updates.
@@ -103,6 +498,8 @@ or
yarn add --exact react-scripts@3.0.0
```
+**NOTE: You may need to delete your `node_modules` folder and reinstall your dependencies by running `yarn` (or `npm install`) if you encounter errors after upgrading.**
+
If you previously ejected but now want to upgrade, one common solution is to find the commits where you ejected (and any subsequent commits changing the configuration), revert them, upgrade, and later optionally eject again. It’s also possible that the feature you ejected for is now supported out of the box.
## Breaking Changes
diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md
index 0fb245803d8..d38bf51a16f 100644
--- a/CODE_OF_CONDUCT.md
+++ b/CODE_OF_CONDUCT.md
@@ -1,3 +1,76 @@
# 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.fb.com/codeofconduct/) so that you can understand what actions will and will not be tolerated.
+## Our Pledge
+
+In the interest of fostering an open and welcoming environment, we as
+contributors and maintainers pledge to make participation in our project and
+our community a harassment-free experience for everyone, regardless of age, body
+size, disability, ethnicity, sex characteristics, gender identity and expression,
+level of experience, education, socio-economic status, nationality, personal
+appearance, race, religion, or sexual identity and orientation.
+
+## Our Standards
+
+Examples of behavior that contributes to creating a positive environment
+include:
+
+- Using welcoming and inclusive language
+- Being respectful of differing viewpoints and experiences
+- Gracefully accepting constructive criticism
+- Focusing on what is best for the community
+- Showing empathy towards other community members
+
+Examples of unacceptable behavior by participants include:
+
+- The use of sexualized language or imagery and unwelcome sexual attention or
+ advances
+- Trolling, insulting/derogatory comments, and personal or political attacks
+- Public or private harassment
+- Publishing others' private information, such as a physical or electronic
+ address, without explicit permission
+- Other conduct which could reasonably be considered inappropriate in a
+ professional setting
+
+## Our Responsibilities
+
+Project maintainers are responsible for clarifying the standards of acceptable
+behavior and are expected to take appropriate and fair corrective action in
+response to any instances of unacceptable behavior.
+
+Project maintainers have the right and responsibility to remove, edit, or
+reject comments, commits, code, wiki edits, issues, and other contributions
+that are not aligned to this Code of Conduct, or to ban temporarily or
+permanently any contributor for other behaviors that they deem inappropriate,
+threatening, offensive, or harmful.
+
+## Scope
+
+This Code of Conduct applies within all project spaces, and it also applies when
+an individual is representing the project or its community in public spaces.
+Examples of representing a project or community include using an official
+project e-mail address, posting via an official social media account, or acting
+as an appointed representative at an online or offline event. Representation of
+a project may be further defined and clarified by project maintainers.
+
+## Enforcement
+
+Instances of abusive, harassing, or otherwise unacceptable behavior may be
+reported by contacting the project team at . All
+complaints will be reviewed and investigated and will result in a response that
+is deemed necessary and appropriate to the circumstances. The project team is
+obligated to maintain confidentiality with regard to the reporter of an incident.
+Further details of specific enforcement policies may be posted separately.
+
+Project maintainers who do not follow or enforce the Code of Conduct in good
+faith may face temporary or permanent repercussions as determined by other
+members of the project's leadership.
+
+## Attribution
+
+This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
+available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
+
+[homepage]: https://www.contributor-covenant.org
+
+For answers to common questions about this code of conduct, see
+https://www.contributor-covenant.org/faq
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 76e704dacb1..cf94d0dbdac 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -2,7 +2,7 @@
Loving Create React App and want to get involved? Thanks! There are plenty of ways you can help.
-Please take a moment to review this document in order to make the contribution process easy and effective for everyone involved.
+Please take a moment to review this document in order to make the contribution process straightforward and effective for everyone involved.
Following these guidelines helps to communicate that you respect the time of the developers managing and developing this open source project. In return, they should reciprocate that respect in addressing your issue or assessing patches and features.
@@ -15,23 +15,27 @@ Here are a few examples of them in action.
### Convention
+
+
Instead of letting the user specify the entry filename, we always assume it to be `src/index.js`. Rather than letting the user specify the output bundle name, we generate it, but make sure to include the content hash in it. Whenever possible, we want to leverage convention to make good choices for the user, especially in cases where it’s easy to misconfigure something.
### Heuristics
Normally, `npm start` runs on port `3000`, and this is not explicitly configurable. However, some environments like cloud IDEs want the programs to run on a specific port to serve their output. We want to play well with different environments, so Create React App reads `PORT` environment variable and prefers it when it is specified. The trick is that we know cloud IDEs already specify it automatically, so there is no need for the user to do anything. Create React App relies on heuristics to do the right thing depending on environment.
+
+
Another example of this is how `npm test` normally launches the watcher, but if the `CI` environment variable is set, it will run tests once. We know that popular CI environments set this variable, so the user doesn’t need to do anything. It just works.
### Interactivity
-We prefer to add interactivity to the command line interface rather than add configuration flags. For example, `npm start` will attempt to run with port `3000` by default, but it may be busy. Many other tools just fail in this case and ask that you pass a different port, but Create React App will display a prompt asking if you’d like to run the app on the next available port.
+We prefer to add interactivity to the command line interface rather than add configuration flags. For example, `npm start` will attempt to run with port `3000` by default, but it may be busy. Many other tools fail in this case and ask that you pass a different port, but Create React App will display a prompt asking if you’d like to run the app on the next available port.
Another example of interactivity is `npm test` watcher interface. Instead of asking people to pass command line flags for switching between test runner modes or search patterns, we print a hint with keys that you can press during the test session to instruct watcher what to do. Jest supports both flags and interactive CLI but Create React App prefers long-running sessions to keep user immersed in the flow over short-running sessions with different flags.
### Breaking the Rules
-No rules are perfect. Sometimes we may introduce flags or configuration if we believe the value is high enough to justify the mental cost. For example, we know that apps may be hosted paths different from the root, and we need to support this use case. However, we still try to fall back to heuristics when possible. In this example, we ask that you specify `homepage` in `package.json`, and infer the correct path based on it. We also nudge the user to fill out the `homepage` after the build, so the user becomes aware that the feature exists.
+No rules are perfect. Sometimes we may introduce flags or configuration if we believe the value is high enough to justify the complexity. For example, we know that apps may be hosted paths different from the root, and we need to support this use case. However, we still try to fall back to heuristics when possible. In this example, we ask that you specify `homepage` in `package.json`, and infer the correct path based on it. We also nudge the user to fill out the `homepage` after the build, so the user becomes aware that the feature exists.
## Submitting a Pull Request
@@ -76,7 +80,7 @@ This package is enabled by default for all `create-react-app` scaffolded applica
#### [react-dev-utils](https://github.com/facebook/create-react-app/tree/master/packages/react-dev-utils)
-This package contains utilities used for `react-scripts` and sister packages.
+This package contains utilities used for `react-scripts` and sibling packages.
Its main purpose is to conceal code which the user shouldn't be burdened with upon ejecting.
#### [react-scripts](https://github.com/facebook/create-react-app/tree/master/packages/react-scripts)
@@ -90,7 +94,7 @@ All functionality must be retained (and configuration given to the user) if they
2. Run `yarn` in the root `create-react-app` folder.
-Once it is done, you can modify any file locally and run `yarn start`, `yarn test` or `yarn build` just like in a generated project.
+Once it is done, you can modify any file locally and run `yarn start`, `yarn test` or `yarn build` like you can in a generated project.
If you want to try out the end-to-end flow with the global CLI, you can do this too:
@@ -105,7 +109,7 @@ and then run `yarn start` or `yarn build`.
**TL;DR** use the command `yarn e2e:docker` to run unit and e2e tests.
-More detailed information are in the dedicated [README](/packages/react-scripts/fixtures/kitchensink/README.md).
+More detailed information are in the dedicated [README](/test/README.md).
### CI testing with private packages
@@ -113,7 +117,7 @@ More detailed information are in the dedicated [README](/packages/react-scripts/
#### Customizing E2E registry configuration
-We use [verdaccio](https://github.com/verdaccio/verdaccio) to emulate packages publishing in a registry using a default configuration. You might modify the current behaviour just editing the file `task/verdaccio.yaml`.
+We use [verdaccio](https://github.com/verdaccio/verdaccio) to emulate packages publishing in a registry using a default configuration. You might modify the current behaviour by editing the file `task/verdaccio.yaml`.
For more information about the configuration check out the [Verdaccio documentation](https://verdaccio.org/docs/en/configuration).
@@ -135,8 +139,8 @@ By default git would use `CRLF` line endings which would cause the scripts to fa
## Cutting a Release
-1. Tag all merged pull requests that go into the release with the relevant milestone. Each merged PR should also be labeled with one of the [labels](https://github.com/facebook/create-react-app/labels) named `tag: ...` to indicate what kind of change it is.
-2. Close the milestone.
+1. Tag all merged pull requests that go into the release with the relevant milestone. Each merged PR should also be labeled with one of the [labels](https://github.com/facebook/create-react-app/labels) named `tag: ...` to indicate what kind of change it is. **Make sure all breaking changes are correctly labelled with `tag: breaking change`.**
+2. Close the milestone and create a new one for the next release.
3. In most releases, only `react-scripts` needs to be released. If you don’t have any changes to the `packages/create-react-app` folder, you don’t need to bump its version or publish it (the publish script will publish only changed packages).
4. Note that files in `packages/create-react-app` should be modified with extreme caution. Since it’s a global CLI, any version of `create-react-app` (global CLI) including very old ones should work with the latest version of `react-scripts`.
5. Run `yarn compile:lockfile`. The command will generate an updated lockfile in `packages/create-react-app` that should be committed.
@@ -148,11 +152,18 @@ By default git would use `CRLF` line endings which would cause the scripts to fa
- 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.
7. Make sure to include “Migrating from ...” instructions for the previous release. Often you can copy and paste them.
-8. Run `npm run publish`. (It has to be `npm run publish` exactly, not just `npm publish` or `yarn publish`.)
+8. Run `npm run publish`. (It has to be `npm run publish` exactly, not `npm publish` or `yarn publish`.)
9. 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.
10. After publishing, create a GitHub Release with the same text as the changelog entry. See previous Releases for inspiration.
-Make sure to test the released version! If you want to be extra careful, you can publish a prerelease by running `npm run publish -- prepatch --canary --preid next --dist-tag next --npm-client npm --force-publish` instead of `npm run publish`.
+Make sure to test the released version! If you want to be extra careful, you can publish a prerelease by running `npm run publish -- --canary --exact --preid next --dist-tag=next --force-publish=* minor` instead of `npm run publish`.
+
+## Releasing the Docs
+
+1. Go to the `docusaurus/website` directory
+2. Run `yarn build`
+3. You'll need an [access token for the GitHub API](https://help.github.com/articles/creating-an-access-token-for-command-line-use/). Save it to this environment variable: `export GITHUB_AUTH="..."`
+4. Run `GIT_USER= CURRENT_BRANCH=master USE_SSH=true yarn deploy`
---
diff --git a/README.md b/README.md
index 347d4359760..586da9a8b5d 100644
--- a/README.md
+++ b/README.md
@@ -6,7 +6,8 @@ Create React apps with no build configuration.
- [User Guide](https://facebook.github.io/create-react-app/) – How to develop apps bootstrapped with Create React App.
Create React App works on macOS, Windows, and Linux.
-If something doesn’t work, please [file an issue](https://github.com/facebook/create-react-app/issues/new).
+If something doesn’t work, please [file an issue](https://github.com/facebook/create-react-app/issues/new).
+If you have questions or need help, please ask in our [Spectrum](https://spectrum.chat/create-react-app) community.
## Quick Overview
@@ -22,7 +23,7 @@ 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`.
-
+
### Get Started Immediately
@@ -30,11 +31,11 @@ When you’re ready to deploy to production, create a minified bundle with `npm
You **don’t** need to install or configure tools like Webpack or Babel.
They are preconfigured and hidden so that you can focus on the code.
-Just create a project, and you’re good to go.
+Create a project, and you’re good to go.
## Creating an App
-**You’ll need to have Node 8.10.0 or later on your local development machine** (but it’s not required on the server). You can use [nvm](https://github.com/creationix/nvm#installation) (macOS/Linux) or [nvm-windows](https://github.com/coreybutler/nvm-windows#node-version-manager-nvm-for-windows) to easily switch Node versions between different projects.
+**You’ll need to have Node 8.16.0 or Node 10.16.0 or later version on your local development machine** (but it’s not required on the server). You can use [nvm](https://github.com/creationix/nvm#installation) (macOS/Linux) or [nvm-windows](https://github.com/coreybutler/nvm-windows#node-version-manager-nvm-for-windows) to switch Node versions between different projects.
To create a new app, you may choose one of the following methods:
@@ -44,7 +45,7 @@ To create a new app, you may choose one of the following methods:
npx create-react-app my-app
```
-_([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))_
+_([npx](https://medium.com/@maybekatz/introducing-npx-an-npm-package-runner-55f7d4bd282b) is a package runner tool that comes with npm 5.2+ and higher, see [instructions for older npm versions](https://gist.github.com/gaearon/4064d3c23a77c74a3614c498a8bb1c5f))_
### npm
@@ -85,7 +86,7 @@ my-app
└── serviceWorker.js
```
-No configuration or complicated folder structures, just the files you need to build your app.
+No configuration or complicated folder structures, only the files you need to build your app.
Once the installation is done, you can open your project folder:
```sh
@@ -103,7 +104,7 @@ The page will automatically reload if you make changes to the code.
You will see the build errors and lint warnings in the console.
-
+
### `npm test` or `yarn test`
@@ -132,7 +133,7 @@ Please refer to the [User Guide](https://facebook.github.io/create-react-app/doc
## Philosophy
-- **One Dependency:** There is just one build dependency. It uses Webpack, Babel, ESLint, and other amazing projects, but provides a cohesive curated experience on top of them.
+- **One Dependency:** There is only one build dependency. It uses Webpack, Babel, ESLint, and other amazing projects, but provides a cohesive curated experience on top of them.
- **No Configuration Required:** You don't need to configure anything. A reasonably good configuration of both development and production builds is handled for you so you can focus on writing code.
@@ -171,7 +172,7 @@ Here are a few common cases where you might want to try something else:
- If you need to **publish a React component**, [nwb](https://github.com/insin/nwb) can [also do this](https://github.com/insin/nwb#react-components-and-libraries), as well as [Neutrino's react-components preset](https://neutrino.js.org/packages/react-components/).
-- If you want to do **server rendering** with React and Node.js, check out [Next.js](https://github.com/zeit/next.js/) or [Razzle](https://github.com/jaredpalmer/razzle). Create React App is agnostic of the backend, and just produces static HTML/JS/CSS bundles.
+- If you want to do **server rendering** with React and Node.js, check out [Next.js](https://github.com/zeit/next.js/) or [Razzle](https://github.com/jaredpalmer/razzle). Create React App is agnostic of the backend, and only produces static HTML/JS/CSS bundles.
- If your website is **mostly static** (for example, a portfolio or a blog), consider using [Gatsby](https://www.gatsbyjs.org/) instead. Unlike Create React App, it pre-renders the website into HTML at the build time.
diff --git a/azure-pipelines-test-job.yml b/azure-pipelines-test-job.yml
index 18000d462cb..7073bf3eab6 100644
--- a/azure-pipelines-test-job.yml
+++ b/azure-pipelines-test-job.yml
@@ -6,35 +6,35 @@ parameters:
name: ''
testScript: ''
configurations:
- LinuxNode8: { vmImage: 'ubuntu-16.04', nodeVersion: 8.x }
- LinuxNode10: { vmImage: 'ubuntu-16.04', nodeVersion: 10.x }
- WindowsNode8: { vmImage: 'vs2017-win2016', nodeVersion: 8.x }
- WindowsNode10: { vmImage: 'vs2017-win2016', nodeVersion: 10.x }
-
+ LinuxNode8: { vmImage: 'ubuntu-16.04', nodeVersion: 8.x }
+ LinuxNode10: { vmImage: 'ubuntu-16.04', nodeVersion: 10.x }
+ # WindowsNode8: { vmImage: 'vs2017-win2016', nodeVersion: 8.x }
+ # WindowsNode10: { vmImage: 'vs2017-win2016', nodeVersion: 10.x }
+
jobs:
-- job: ${{ parameters.name }}
- strategy:
- matrix:
- ${{ insert }}: ${{ parameters.configurations }}
- pool:
- vmImage: $(vmImage)
- steps:
- - script: |
- git config --global core.autocrlf false
- git config --global user.name "Create React App"
- git config --global user.email "cra@email.com"
- displayName: 'Initialize Git config'
+ - job: ${{ parameters.name }}
+ strategy:
+ matrix:
+ ${{ insert }}: ${{ parameters.configurations }}
+ pool:
+ vmImage: $(vmImage)
+ steps:
+ - script: |
+ git config --global core.autocrlf false
+ git config --global user.name "Create React App"
+ git config --global user.email "cra@email.com"
+ displayName: 'Initialize Git config'
- - checkout: self
- path: create-react-app
+ - checkout: self
+ path: create-react-app
- - task: NodeTool@0
- inputs:
- versionSpec: $(nodeVersion)
- displayName: 'Install Node.js'
+ - task: NodeTool@0
+ inputs:
+ versionSpec: $(nodeVersion)
+ displayName: 'Install Node.js'
- - script: yarn --frozen-lockfile
- displayName: 'Run yarn'
+ - script: yarn --frozen-lockfile
+ displayName: 'Run yarn'
- - bash: ${{ parameters.testScript }}
- displayName: 'Run tests'
+ - bash: ${{ parameters.testScript }}
+ displayName: 'Run tests'
diff --git a/azure-pipelines.yml b/azure-pipelines.yml
index c51be42da86..6c39dc98f90 100644
--- a/azure-pipelines.yml
+++ b/azure-pipelines.yml
@@ -1,78 +1,79 @@
-#
-# Azure Pipelines configuration for building and testing create-react-app on Linux, Windows, and macOS.
-#
-
-trigger:
-- master
-
-variables:
- CI: true
- # Overrides the Yarn and NPM cache directories so they are on the same drive as the source. This helps improve build performance on Windows hosted agents.
- YARN_CACHE_FOLDER: $(Build.SourcesDirectory)/../yarn-cache
- NPM_CONFIG_CACHE: $(Build.SourcesDirectory)/../npm-cache
- # Sets TEMP to be on the same drive as the cloned source on Windows. This avoids test scripts that "cd" into a directory under TEMP from failing because this directory is on a different drive from the current directory.
- VSTS_OVERWRITE_TEMP: True
- # Override Verdaccio package to use. This is temoporary and is needed to avoid socket timeouts on hosted Windows agent (on Azure). This also changes Verdaccio to return a 503 (service unavailable) instead of a 404 (not found) when the connection to the uplink timesout.
- VERDACCIO_PACKAGE: https://github.com/willsmythe/verdaccio/releases/download/create-react-app/verdaccio-4.0.0-alpha.8.tgz
-
-# ******************************************************************************
-# Simple test suite
-# ******************************************************************************
-jobs:
-- template: azure-pipelines-test-job.yml
- parameters:
- name: Simple
- testScript: tasks/e2e-simple.sh
-
-# ******************************************************************************
-# Installs test suite
-# ******************************************************************************
-- template: azure-pipelines-test-job.yml
- parameters:
- name: Installs
- testScript: tasks/e2e-installs.sh
-
-# ******************************************************************************
-# Kitchensink test suite
-# ******************************************************************************
-- template: azure-pipelines-test-job.yml
- parameters:
- name: Kitchensink
- testScript: tasks/e2e-kitchensink.sh
-
-# ******************************************************************************
-# Kitchensink Eject test suite
-# ******************************************************************************
-- template: azure-pipelines-test-job.yml
- parameters:
- name: KitchensinkEject
- testScript: tasks/e2e-kitchensink-eject.sh
-
-# ******************************************************************************
-# Behavior test suite
-# ******************************************************************************
-- template: azure-pipelines-test-job.yml
- parameters:
- name: Behavior
- testScript: tasks/e2e-behavior.sh
- configurations:
- LinuxNode8: { vmImage: 'ubuntu-16.04', nodeVersion: 8.x }
- LinuxNode10: { vmImage: 'ubuntu-16.04', nodeVersion: 10.x }
- WindowsNode8: { vmImage: 'vs2017-win2016', nodeVersion: 8.x }
- WindowsNode10: { vmImage: 'vs2017-win2016', nodeVersion: 10.x }
- MacNode8: { vmImage: 'macOS-10.13', nodeVersion: 8.x }
- MacNode10: { vmImage: 'macOS-10.13', nodeVersion: 10.x }
-
-# ******************************************************************************
-# Old Node test suite
-# ******************************************************************************
-- job: OldNode
- pool:
- vmImage: ubuntu-16.04
- steps:
- - task: NodeTool@0
- inputs:
- versionSpec: 6.x
- displayName: 'Install Node.js 6.x'
- - bash: tasks/e2e-old-node.sh
- displayName: 'Run tests'
+#
+# Azure Pipelines configuration for building and testing create-react-app on Linux, Windows, and macOS.
+#
+
+trigger:
+ - master
+
+variables:
+ CI: true
+ # Overrides the Yarn and NPM cache directories so they are on the same drive as the source. This helps improve build performance on Windows hosted agents.
+ YARN_CACHE_FOLDER: $(Build.SourcesDirectory)/../yarn-cache
+ NPM_CONFIG_CACHE: $(Build.SourcesDirectory)/../npm-cache
+ # Sets TEMP to be on the same drive as the cloned source on Windows. This avoids test scripts that "cd" into a directory under TEMP from failing because this directory is on a different drive from the current directory.
+ VSTS_OVERWRITE_TEMP: True
+ # Override Verdaccio package to use. This is temporary and is needed to avoid socket timeouts on hosted Windows agent (on Azure). This also changes Verdaccio to return a 503 (service unavailable) instead of a 404 (not found) when the connection to the uplink timesout.
+ VERDACCIO_PACKAGE: https://github.com/willsmythe/verdaccio/releases/download/create-react-app/verdaccio-4.0.0-alpha.8.tgz
+ CRA_INTERNAL_TEST: true
+
+# ******************************************************************************
+# Simple test suite
+# ******************************************************************************
+jobs:
+ - template: azure-pipelines-test-job.yml
+ parameters:
+ name: Simple
+ testScript: tasks/e2e-simple.sh
+
+ # ******************************************************************************
+ # Installs test suite
+ # ******************************************************************************
+ - template: azure-pipelines-test-job.yml
+ parameters:
+ name: Installs
+ testScript: tasks/e2e-installs.sh
+
+ # ******************************************************************************
+ # Kitchensink test suite
+ # ******************************************************************************
+ - template: azure-pipelines-test-job.yml
+ parameters:
+ name: Kitchensink
+ testScript: tasks/e2e-kitchensink.sh
+
+ # ******************************************************************************
+ # Kitchensink Eject test suite
+ # ******************************************************************************
+ - template: azure-pipelines-test-job.yml
+ parameters:
+ name: KitchensinkEject
+ testScript: tasks/e2e-kitchensink-eject.sh
+
+ # ******************************************************************************
+ # Behavior test suite
+ # ******************************************************************************
+ - template: azure-pipelines-test-job.yml
+ parameters:
+ name: Behavior
+ testScript: tasks/e2e-behavior.sh
+ configurations:
+ LinuxNode8: { vmImage: 'ubuntu-16.04', nodeVersion: 8.x }
+ LinuxNode10: { vmImage: 'ubuntu-16.04', nodeVersion: 10.x }
+ # WindowsNode8: { vmImage: 'vs2017-win2016', nodeVersion: 8.x }
+ # WindowsNode10: { vmImage: 'vs2017-win2016', nodeVersion: 10.x }
+ MacNode8: { vmImage: 'macOS-10.13', nodeVersion: 8.x }
+ MacNode10: { vmImage: 'macOS-10.13', nodeVersion: 10.x }
+
+ # ******************************************************************************
+ # Old Node test suite
+ # ******************************************************************************
+ - job: OldNode
+ pool:
+ vmImage: ubuntu-16.04
+ steps:
+ - task: NodeTool@0
+ inputs:
+ versionSpec: 6.x
+ displayName: 'Install Node.js 6.x'
+ - bash: tasks/e2e-old-node.sh
+ displayName: 'Run tests'
diff --git a/docusaurus/docs/adding-bootstrap.md b/docusaurus/docs/adding-bootstrap.md
index 7a8167050aa..1bbffda0854 100644
--- a/docusaurus/docs/adding-bootstrap.md
+++ b/docusaurus/docs/adding-bootstrap.md
@@ -29,9 +29,22 @@ import 'bootstrap/dist/css/bootstrap.css';
> Note: this feature is available with `react-scripts@2.0.0` and higher.
-Sometimes you might need to tweak the visual styles of Bootstrap (or equivalent package).
+Sometimes you might need to tweak the visual styles of Bootstrap (or equivalent package).
+
As of `react-scripts@2.0.0` you can import `.scss` files. This makes it possible to use a package's built-in Sass variables for global style preferences.
+To enable `scss` in Create React App you will need to install `node-sass`.
+
+```sh
+npm install --save node-sass
+```
+
+Alternatively you may use `yarn`:
+
+```sh
+yarn add node-sass
+```
+
To customize Bootstrap, create a file called `src/custom.scss` (or similar) and import the Bootstrap source stylesheet. Add any overrides _before_ the imported file(s). You can reference [Bootstrap's documentation](https://getbootstrap.com/docs/4.1/getting-started/theming/#css-variables) for the names of the available variables.
```scss
diff --git a/docusaurus/docs/adding-custom-environment-variables.md b/docusaurus/docs/adding-custom-environment-variables.md
index 97fc21fd11d..b604a10c810 100644
--- a/docusaurus/docs/adding-custom-environment-variables.md
+++ b/docusaurus/docs/adding-custom-environment-variables.md
@@ -12,13 +12,13 @@ Your project can consume variables declared in your environment as if they were
>
> Environment variables are embedded into the build, meaning anyone can view them by inspecting your app's files.
-**The environment variables are embedded during the build time**. Since Create React App produces a static HTML/CSS/JS bundle, it can’t possibly read them at runtime. To read them at runtime, you would need to load HTML into memory on the server and replace placeholders in runtime, just like [described here](title-and-meta-tags.md#injecting-data-from-the-server-into-the-page). Alternatively you can rebuild the app on the server anytime you change them.
+**The environment variables are embedded during the build time**. Since Create React App produces a static HTML/CSS/JS bundle, it can’t possibly read them at runtime. To read them at runtime, you would need to load HTML into memory on the server and replace placeholders in runtime, as [described here](title-and-meta-tags.md#injecting-data-from-the-server-into-the-page). Alternatively you can rebuild the app on the server anytime you change them.
> Note: You must create custom environment variables beginning with `REACT_APP_`. Any other variables except `NODE_ENV` will be ignored to avoid accidentally [exposing a private key on the machine that could have the same name](https://github.com/facebook/create-react-app/issues/865#issuecomment-252199527). Changing any environment variables will require you to restart the development server if it is running.
These environment variables will be defined for you on `process.env`. For example, having an environment variable named `REACT_APP_NOT_SECRET_CODE` will be exposed in your JS as `process.env.REACT_APP_NOT_SECRET_CODE`.
-There is also a special built-in environment variable called `NODE_ENV`. You can read it from `process.env.NODE_ENV`. When you run `npm start`, it is always equal to `'development'`, when you run `npm test` it is always equal to `'test'`, and when you run `npm run build` to make a production bundle, it is always equal to `'production'`. **You cannot override `NODE_ENV` manually.** This prevents developers from accidentally deploying a slow development build to production.
+There is also a built-in environment variable called `NODE_ENV`. You can read it from `process.env.NODE_ENV`. When you run `npm start`, it is always equal to `'development'`, when you run `npm test` it is always equal to `'test'`, and when you run `npm run build` to make a production bundle, it is always equal to `'production'`. **You cannot override `NODE_ENV` manually.** This prevents developers from accidentally deploying a slow development build to production.
These environment variables can be useful for displaying information conditionally based on where the project is deployed or consuming sensitive data that lives outside of version control.
@@ -136,7 +136,8 @@ Files on the left have more priority than files on the right:
- `npm run build`: `.env.production.local`, `.env.production`, `.env.local`, `.env`
- `npm test`: `.env.test.local`, `.env.test`, `.env` (note `.env.local` is missing)
-These variables will act as the defaults if the machine does not explicitly set them.
+These variables will act as the defaults if the machine does not explicitly set them.
+
Please refer to the [dotenv documentation](https://github.com/motdotla/dotenv) for more details.
> Note: If you are defining environment variables for development, your CI and/or hosting platform will most likely need
diff --git a/docusaurus/docs/adding-flow.md b/docusaurus/docs/adding-flow.md
index a495a6cc677..321605261e9 100644
--- a/docusaurus/docs/adding-flow.md
+++ b/docusaurus/docs/adding-flow.md
@@ -14,8 +14,15 @@ To add Flow to a Create React App project, follow these steps:
3. Run `npm run flow init` (or `yarn flow init`) to create a [`.flowconfig` file](https://flow.org/en/docs/config/) in the root directory.
4. Add `// @flow` to any files you want to type check (for example, to `src/App.js`).
-Now you can run `npm run flow` (or `yarn flow`) to check the files for type errors.
-You can optionally use an IDE like [Nuclide](https://nuclide.io/docs/languages/flow/) for a better integrated experience.
-In the future we plan to integrate it into Create React App even more closely.
+Now you can run `npm run flow` (or `yarn flow`) to check the files for type errors.
+You can optionally enable an extension for your IDE, such as [Flow Language Support](https://github.com/flowtype/flow-for-vscode) for Visual Studio Code, or leverage the Language Server Protocol standard (e.g. [vim LSP](https://github.com/prabirshrestha/vim-lsp/wiki/Servers-Flow)) to get hints while you type.
+
+If you'd like to use [absolute imports](/docs/importing-a-component#absolute-imports) with Flow,
+make sure to add the following line to your `.flowconfig` to make Flow aware of it:
+
+```diff
+ [options]
++ module.name_mapper='^\([^\.].*\)$' -> '/src/\1'
+```
To learn more about Flow, check out [its documentation](https://flow.org/).
diff --git a/docusaurus/docs/adding-images-fonts-and-files.md b/docusaurus/docs/adding-images-fonts-and-files.md
index ef1d4d8697e..3489670e705 100644
--- a/docusaurus/docs/adding-images-fonts-and-files.md
+++ b/docusaurus/docs/adding-images-fonts-and-files.md
@@ -7,7 +7,7 @@ With Webpack, using static assets like images and fonts works similarly to CSS.
You can **`import` a file right in a JavaScript module**. This tells Webpack to include that file in the bundle. Unlike CSS imports, importing a file gives you a string value. This value is the final path you can reference in your code, e.g. as the `src` attribute of an image or the `href` of a link to a PDF.
-To reduce the number of requests to the server, importing images that are less than 10,000 bytes returns a [data URI](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs) instead of a path. This applies to the following file extensions: bmp, gif, jpg, jpeg, and png. SVG files are excluded due to [#1153](https://github.com/facebook/create-react-app/issues/1153).
+To reduce the number of requests to the server, importing images that are less than 10,000 bytes returns a [data URI](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs) instead of a path. This applies to the following file extensions: bmp, gif, jpg, jpeg, and png. SVG files are excluded due to [#1153](https://github.com/facebook/create-react-app/issues/1153). You can control the 10,000 byte threshold by setting the `IMAGE_INLINE_SIZE_LIMIT` environment variable as documented in our [advanced configuration](advanced-configuration.md).
Here is an example:
@@ -35,11 +35,12 @@ This works in CSS too:
}
```
-Webpack finds all relative module references in CSS (they start with `./`) and replaces them with the final paths from the compiled bundle. If you make a typo or accidentally delete an important file, you will see a compilation error, just like when you import a non-existent JavaScript module. The final filenames in the compiled bundle are generated by Webpack from content hashes. If the file content changes in the future, Webpack will give it a different name in production so you don’t need to worry about long-term caching of assets.
+Webpack finds all relative module references in CSS (they start with `./`) and replaces them with the final paths from the compiled bundle. If you make a typo or accidentally delete an important file, you will see a compilation error, like when you import a non-existent JavaScript module. The final filenames in the compiled bundle are generated by Webpack from content hashes. If the file content changes in the future, Webpack will give it a different name in production so you don’t need to worry about long-term caching of assets.
Please be advised that this is also a custom feature of Webpack.
-**It is not required for React** but many people enjoy it (and React Native uses a similar mechanism for images).
+**It is not required for React** but many people enjoy it (and React Native uses a similar mechanism for images).
+
An alternative way of handling static assets is described in the next section.
## Adding SVGs
@@ -58,4 +59,6 @@ const App = () => (
);
```
-This is handy if you don't want to load SVG as a separate file. Don't forget the curly braces in the import! The `ReactComponent` import name is special and tells Create React App that you want a React component that renders an SVG, rather than its filename.
+This is handy if you don't want to load SVG as a separate file. Don't forget the curly braces in the import! The `ReactComponent` import name is significant and tells Create React App that you want a React component that renders an SVG, rather than its filename.
+
+> **Tip:** The imported SVG React Component accepts a `title` prop along with other props that a `svg` element accepts. Use this prop to add an accessible title to your svg component.
diff --git a/docusaurus/docs/adding-relay.md b/docusaurus/docs/adding-relay.md
index b44d6b31b54..022248b9f22 100644
--- a/docusaurus/docs/adding-relay.md
+++ b/docusaurus/docs/adding-relay.md
@@ -3,7 +3,7 @@ id: adding-relay
title: Adding Relay
---
-Relay is a framework for building data-driven React applications powered by GraphQL. The current release of Relay works with Create React App projects out of the box using Babel Macros. Simply set up your project as laid out in the [Relay documentation](https://facebook.github.io/relay/), then make sure you have a version of the babel plugin providing the macro.
+Relay is a framework for building data-driven React applications powered by GraphQL. The current release of Relay works with Create React App projects out of the box using Babel Macros. Set up your project as shown in the [Relay documentation](https://facebook.github.io/relay/), then make sure you have a version of the babel plugin providing the macro.
To add it, run:
@@ -14,7 +14,7 @@ npm install --save babel-plugin-relay
Alternatively you may use `yarn`:
```sh
-yarn upgrade babel-plugin-relay
+yarn add babel-plugin-relay
```
Then, wherever you use the `graphql` template tag, import the macro:
diff --git a/docusaurus/docs/adding-typescript.md b/docusaurus/docs/adding-typescript.md
index 1fb14a82ba1..40c9c2242a8 100644
--- a/docusaurus/docs/adding-typescript.md
+++ b/docusaurus/docs/adding-typescript.md
@@ -7,17 +7,21 @@ title: Adding TypeScript
[TypeScript](https://www.typescriptlang.org/) is a typed superset of JavaScript that compiles to plain JavaScript.
+## Installation
+
To start a new Create React App project with [TypeScript](https://www.typescriptlang.org/), you can run:
```sh
-npx create-react-app my-app --typescript
+npx create-react-app my-app --template typescript
# or
-yarn create react-app my-app --typescript
+yarn create react-app my-app --template typescript
```
> If you've previously installed `create-react-app` globally via `npm install -g create-react-app`, we recommend you uninstall the package using `npm uninstall -g create-react-app` to ensure that `npx` always uses the latest version.
+>
+> Global installs of `create-react-app` are no longer supported.
To add [TypeScript](https://www.typescriptlang.org/) to a Create React App project, first install it:
@@ -31,18 +35,20 @@ yarn add typescript @types/node @types/react @types/react-dom @types/jest
Next, rename any file to be a TypeScript file (e.g. `src/index.js` to `src/index.tsx`) and **restart your development server**!
-Type errors will show up in the same console as the build one.
+Type errors will show up in the same console as the build one. You'll have to fix these type errors before you continue development or build your project. For advanced configuration, [see here](advanced-configuration.md).
+
+## Getting Started with TypeScript and React
-To learn more about TypeScript, check out [its documentation](https://www.typescriptlang.org/).
+You are not required to make a [`tsconfig.json` file](https://www.typescriptlang.org/docs/handbook/tsconfig-json.html), one will be made for you. You are allowed to edit the generated TypeScript configuration.
-> **Note:** If your project is not created with TypeScript enabled, npx may be using a cached version of `create-react-app`.
-> Remove previously installed versions with `npm uninstall -g create-react-app` (see [#6119](https://github.com/facebook/create-react-app/issues/6119#issuecomment-451614035)).
+- [TypeScript Handbook](https://www.typescriptlang.org/)
+- [TypeScript Example on React](https://www.typescriptlang.org/play/index.html?jsx=2&esModuleInterop=true&e=196#example/typescript-with-react)
+- [React + TypeScript Cheatsheets](https://github.com/typescript-cheatsheets/react-typescript-cheatsheet#reacttypescript-cheatsheets) has a good overview on how to use React with TypeScript
-> **Note:** You are not required to make a [`tsconfig.json` file](https://www.typescriptlang.org/docs/handbook/tsconfig-json.html), one will be made for you.
-> You are allowed to edit the generated TypeScript configuration.
+## Troubleshooting
-> **Note:** If you are currently using [create-react-app-typescript](https://github.com/wmonk/create-react-app-typescript/), see [this blog post](https://vincenttunru.com/migrate-create-react-app-typescript-to-create-react-app/) for instructions on how to migrate to Create React App.
+If your project is not created with TypeScript enabled, npx may be using a cached version of `create-react-app`. Remove previously installed versions with `npm uninstall -g create-react-app` (see [#6119](https://github.com/facebook/create-react-app/issues/6119#issuecomment-451614035)).
-> **Note:** We recommend using [VSCode](https://code.visualstudio.com/) for a better integrated experience.
+If you are currently using [create-react-app-typescript](https://github.com/wmonk/create-react-app-typescript/), see [this blog post](https://vincenttunru.com/migrate-create-react-app-typescript-to-create-react-app/) for instructions on how to migrate to Create React App.
-> **Note:** Constant enums and namespaces are not supported.
+Constant enums and namespaces are not supported, you can learn about the constraints of [using Babel with TypeScript here](https://babeljs.io/docs/en/babel-plugin-transform-typescript#caveats).
diff --git a/docusaurus/docs/advanced-configuration.md b/docusaurus/docs/advanced-configuration.md
index 86bac9fa451..871edd2f49d 100644
--- a/docusaurus/docs/advanced-configuration.md
+++ b/docusaurus/docs/advanced-configuration.md
@@ -3,20 +3,24 @@ id: advanced-configuration
title: Advanced Configuration
---
-You can adjust various development and production settings by setting environment variables in your shell or with [.env](adding-custom-environment-variables.md#adding-development-environment-variables-in-env).
+You can adjust various development and production settings by setting environment variables in your shell or with [.env](adding-custom-environment-variables.md#adding-development-environment-variables-in-env).
> Note: You do not need to declare `REACT_APP_` before the below variables as you would with custom environment variables.
-| Variable | Development | Production | Usage |
-| :------------------- | :---------: | :--------: | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| BROWSER | ✅ Used | 🚫 Ignored | By default, Create React App will open the default system browser, favoring Chrome on macOS. Specify a [browser](https://github.com/sindresorhus/opn#app) to override this behavior, or set it to `none` to disable it completely. If you need to customize the way the browser is launched, you can specify a node script instead. Any arguments passed to `npm start` will also be passed to this script, and the url where your app is served will be the last argument. Your script's file name must have the `.js` extension. |
-| HOST | ✅ Used | 🚫 Ignored | By default, the development web server binds to `localhost`. You may use this variable to specify a different host. |
-| PORT | ✅ Used | 🚫 Ignored | By default, the development web server will attempt to listen on port 3000 or prompt you to attempt the next available port. You may use this variable to specify a different port. |
-| HTTPS | ✅ Used | 🚫 Ignored | When set to `true`, Create React App will run the development server in `https` mode. |
-| PUBLIC_URL | 🚫 Ignored | ✅ Used | Create React App assumes your application is hosted at the serving web server's root or a subpath as specified in [`package.json` (`homepage`)](deployment#building-for-relative-paths). Normally, Create React App ignores the hostname. You may use this variable to force assets to be referenced verbatim to the url you provide (hostname included). This may be particularly useful when using a CDN to host your application. |
-| CI | ✅ Used | ✅ Used | When set to `true`, Create React App treats warnings as failures in the build. It also makes the test runner non-watching. Most CIs set this flag by default. |
-| REACT_EDITOR | ✅ Used | 🚫 Ignored | When an app crashes in development, you will see an error overlay with clickable stack trace. When you click on it, Create React App will try to determine the editor you are using based on currently running processes, and open the relevant source file. You can [send a pull request to detect your editor of choice](https://github.com/facebook/create-react-app/issues/2636). Setting this environment variable overrides the automatic detection. If you do it, make sure your systems [PATH]() environment variable points to your editor’s bin folder. You can also set it to `none` to disable it completely. |
-| CHOKIDAR_USEPOLLING | ✅ Used | 🚫 Ignored | When set to `true`, the watcher runs in polling mode, as necessary inside a VM. Use this option if `npm start` isn't detecting changes. |
-| GENERATE_SOURCEMAP | 🚫 Ignored | ✅ Used | When set to `false`, source maps are not generated for a production build. This solves out of memory (OOM) issues on some smaller machines. |
-| NODE_PATH | ✅ Used | ✅ Used | Same as [`NODE_PATH` in Node.js](https://nodejs.org/api/modules.html#modules_loading_from_the_global_folders), but only relative folders are allowed. Can be handy for emulating a monorepo setup by setting `NODE_PATH=src`. |
-| INLINE_RUNTIME_CHUNK | 🚫 Ignored | ✅ Used | By default, Create React App will embed the runtime script into `index.html` during the production build. When set to `false`, the script will not be embedded and will be imported as usual. This is normally required when dealing with CSP. |
+| Variable | Development | Production | Usage |
+| :---------------------- | :---------: | :--------: | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| BROWSER | ✅ Used | 🚫 Ignored | By default, Create React App will open the default system browser, favoring Chrome on macOS. Specify a [browser](https://github.com/sindresorhus/open#app) to override this behavior, or set it to `none` to disable it completely. If you need to customize the way the browser is launched, you can specify a node script instead. Any arguments passed to `npm start` will also be passed to this script, and the url where your app is served will be the last argument. Your script's file name must have the `.js` extension. |
+| BROWSER_ARGS | ✅ Used | 🚫 Ignored | When the `BROWSER` environment variable is specified, any arguments that you set to this environment variable will be passed to the browser instance. Multiple arguments are supported as a space separated list. By default, no arguments are passed through to browsers. |
+| HOST | ✅ Used | 🚫 Ignored | By default, the development web server binds to all hostnames on the device (`localhost`, LAN network address, etc.). You may use this variable to specify a different host. |
+| PORT | ✅ Used | 🚫 Ignored | By default, the development web server will attempt to listen on port 3000 or prompt you to attempt the next available port. You may use this variable to specify a different port. |
+| HTTPS | ✅ Used | 🚫 Ignored | When set to `true`, Create React App will run the development server in `https` mode. |
+| PUBLIC_URL | 🚫 Ignored | ✅ Used | Create React App assumes your application is hosted at the serving web server's root or a subpath as specified in [`package.json` (`homepage`)](deployment#building-for-relative-paths). Normally, Create React App ignores the hostname. You may use this variable to force assets to be referenced verbatim to the url you provide (hostname included). This may be particularly useful when using a CDN to host your application. |
+| CI | ✅ Used | ✅ Used | When set to `true`, Create React App treats warnings as failures in the build. It also makes the test runner non-watching. Most CIs set this flag by default. |
+| REACT_EDITOR | ✅ Used | 🚫 Ignored | When an app crashes in development, you will see an error overlay with clickable stack trace. When you click on it, Create React App will try to determine the editor you are using based on currently running processes, and open the relevant source file. You can [send a pull request to detect your editor of choice](https://github.com/facebook/create-react-app/issues/2636). Setting this environment variable overrides the automatic detection. If you do it, make sure your systems [PATH]() environment variable points to your editor’s bin folder. You can also set it to `none` to disable it completely. |
+| CHOKIDAR_USEPOLLING | ✅ Used | 🚫 Ignored | When set to `true`, the watcher runs in polling mode, as necessary inside a VM. Use this option if `npm start` isn't detecting changes. |
+| GENERATE_SOURCEMAP | 🚫 Ignored | ✅ Used | When set to `false`, source maps are not generated for a production build. This solves out of memory (OOM) issues on some smaller machines. |
+| NODE_PATH | ✅ Used | ✅ Used | Same as [`NODE_PATH` in Node.js](https://nodejs.org/api/modules.html#modules_loading_from_the_global_folders), but only relative folders are allowed. Can be handy for emulating a monorepo setup by setting `NODE_PATH=src`. |
+| INLINE_RUNTIME_CHUNK | 🚫 Ignored | ✅ Used | By default, Create React App will embed the runtime script into `index.html` during the production build. When set to `false`, the script will not be embedded and will be imported as usual. This is normally required when dealing with CSP. |
+| IMAGE_INLINE_SIZE_LIMIT | 🚫 Ignored | ✅ Used | By default, images smaller than 10,000 bytes are encoded as a data URI in base64 and inlined in the CSS or JS build artifact. Set this to control the size limit in bytes. Setting it to 0 will disable the inlining of images. |
+| EXTEND_ESLINT | ✅ Used | ✅ Used | When set to `true`, ESLint configs that extend `eslint-config-react-app` will be used by `eslint-loader`. Any rules that are set to `"error"` will stop the application from building. |
+| TSC_COMPILE_ON_ERROR | ✅ Used | ✅ Used | When set to `true`, you can run and properly build TypeScript projects even if there are TypeScript type check errors. These errors are printed as warnings in the terminal and/or browser console. |
diff --git a/docusaurus/docs/alternatives-to-ejecting.md b/docusaurus/docs/alternatives-to-ejecting.md
index 7a37673eb0c..a7255aa938f 100644
--- a/docusaurus/docs/alternatives-to-ejecting.md
+++ b/docusaurus/docs/alternatives-to-ejecting.md
@@ -3,4 +3,4 @@ id: alternatives-to-ejecting
title: Alternatives to Ejecting
---
-[Ejecting](available-scripts.md#npm-run-eject) lets you customize anything, but from that point on you have to maintain the configuration and scripts yourself. This can be daunting if you have many similar projects. In such cases instead of ejecting we recommend to _fork_ `react-scripts` and any other packages you need. [This article](https://auth0.com/blog/how-to-configure-create-react-app/) dives into how to do it in depth. You can find more discussion in [this issue](https://github.com/facebook/create-react-app/issues/682).
+[Ejecting](available-scripts.md#npm-run-eject) lets you customize anything, but from that point on you have to maintain the configuration and scripts yourself. This can be daunting if you have many similar projects. In such cases instead of ejecting we recommend to _fork_ `react-scripts` and any other packages you need. [This article](https://auth0.com/blog/how-to-configure-create-react-app/) covers how to do it in depth. You can find more discussion in [this issue](https://github.com/facebook/create-react-app/issues/682).
diff --git a/docusaurus/docs/available-scripts.md b/docusaurus/docs/available-scripts.md
index b171147528d..effdc2b7936 100644
--- a/docusaurus/docs/available-scripts.md
+++ b/docusaurus/docs/available-scripts.md
@@ -20,7 +20,7 @@ Launches the test runner in the interactive watch mode. See the section about [r
Builds the app for production to the `build` folder. It correctly bundles React in production mode and optimizes the build for the best performance.
-The build is minified and the filenames include the hashes. See the [production build](production-build.md) section for more information.
+The build is minified and the filenames include the hashes. If necessary, classnames and function names can be enabled for profiling purposes. See the [production build](production-build.md) section for more information.
Your app is ready to be deployed! See the section about [deployment](deployment.md) for more information about deploying your application to popular hosting providers.
diff --git a/docusaurus/docs/can-i-use-decorators.md b/docusaurus/docs/can-i-use-decorators.md
index f4ccf4e4504..474d5139d56 100644
--- a/docusaurus/docs/can-i-use-decorators.md
+++ b/docusaurus/docs/can-i-use-decorators.md
@@ -3,13 +3,15 @@ id: can-i-use-decorators
title: Can I Use Decorators?
---
-Some popular libraries use [decorators](https://medium.com/google-developers/exploring-es7-decorators-76ecb65fb841) in their documentation.
+Some popular libraries use [decorators](https://medium.com/google-developers/exploring-es7-decorators-76ecb65fb841) in their documentation.
+
Create React App intentionally doesn’t support decorator syntax at the moment because:
- It is an experimental proposal and is subject to change (in fact, it has already changed once, and will change again).
- Most libraries currently support only the old version of the proposal — which will never be a standard.
-However in many cases you can rewrite decorator-based code without decorators just as fine.
+However in many cases you can rewrite decorator-based code without decorators and achieve the same result.
+
Please refer to these two threads for reference:
- [#214](https://github.com/facebook/create-react-app/issues/214)
diff --git a/docusaurus/docs/code-splitting.md b/docusaurus/docs/code-splitting.md
index ace13fdfcce..2fabb6b40c0 100644
--- a/docusaurus/docs/code-splitting.md
+++ b/docusaurus/docs/code-splitting.md
@@ -5,7 +5,7 @@ title: Code Splitting
Instead of downloading the entire app before users can use it, code splitting allows you to split your code into small chunks which you can then load on demand.
-This project setup supports code splitting via [dynamic `import()`](http://2ality.com/2017/01/import-operator.html#loading-code-on-demand). Its [proposal](https://github.com/tc39/proposal-dynamic-import) is in stage 3. The `import()` function-like form takes the module name as an argument and returns a [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) which always resolves to the namespace object of the module.
+This project setup supports code splitting via [dynamic `import()`](http://2ality.com/2017/01/import-operator.html#loading-code-on-demand). Its [proposal](https://github.com/tc39/proposal-dynamic-import) is in stage 4. The `import()` function-like form takes the module name as an argument and returns a [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) which always resolves to the namespace object of the module.
Here is an example:
@@ -51,6 +51,6 @@ You can also use it with `async` / `await` syntax if you prefer it.
## With React Router
-If you are using React Router check out [this tutorial](https://serverless-stack.com/chapters/code-splitting-in-create-react-app.html) on how to use code splitting with it. You can find the companion GitHub repository [here](https://github.com/AnomalyInnovations/serverless-stack-demo-client/tree/code-splitting-in-create-react-app).
+If you are using React Router check out [this tutorial](https://reactjs.org/docs/code-splitting.html#route-based-code-splitting)
Also check out the [Code Splitting](https://reactjs.org/docs/code-splitting.html) section in React documentation.
diff --git a/docusaurus/docs/debugging-tests.md b/docusaurus/docs/debugging-tests.md
index d3d1aa4cb38..398ff94696a 100644
--- a/docusaurus/docs/debugging-tests.md
+++ b/docusaurus/docs/debugging-tests.md
@@ -32,7 +32,7 @@ Open the following in Chrome
about:inspect
```
-After opening that link, the Chrome Developer Tools will be displayed. Select `inspect` on your process and a breakpoint will be set at the first line of the react script (this is done simply to give you time to open the developer tools and to prevent Jest from executing before you have time to do so). Click the button that looks like a "play" button in the upper right hand side of the screen to continue execution. When Jest executes the test that contains the debugger statement, execution will pause and you can examine the current scope and call stack.
+After opening that link, the Chrome Developer Tools will be displayed. Select `inspect` on your process and a breakpoint will be set at the first line of the react script (this is done to give you time to open the developer tools and to prevent Jest from executing before you have time to do so). Click the button that looks like a "play" button in the upper right hand side of the screen to continue execution. When Jest executes the test that contains the debugger statement, execution will pause and you can examine the current scope and call stack.
> Note: the --runInBand cli option makes sure Jest runs test in the same process rather than spawning processes for individual tests. Normally Jest parallelizes test runs across processes but it is hard to debug many processes at the same time.
@@ -51,16 +51,13 @@ Use the following [`launch.json`](https://code.visualstudio.com/docs/editor/debu
"type": "node",
"request": "launch",
"runtimeExecutable": "${workspaceRoot}/node_modules/.bin/react-scripts",
- "args": [
- "test",
- "--runInBand",
- "--no-cache",
- "--watchAll=false"
- ],
+ "args": ["test", "--runInBand", "--no-cache", "--watchAll=false"],
"cwd": "${workspaceRoot}",
"protocol": "inspector",
"console": "integratedTerminal",
- "internalConsoleOptions": "neverOpen"
+ "internalConsoleOptions": "neverOpen",
+ "env": { "CI": "true" },
+ "disableOptimisticBPs": true
}
]
}
diff --git a/docusaurus/docs/deployment.md b/docusaurus/docs/deployment.md
index 848b7aed750..dfb2e13d6aa 100644
--- a/docusaurus/docs/deployment.md
+++ b/docusaurus/docs/deployment.md
@@ -29,7 +29,7 @@ serve -h
## Other Solutions
-You don’t necessarily need a static server in order to run a Create React App project in production. It works just as fine integrated into an existing dynamic one.
+You don’t necessarily need a static server in order to run a Create React App project in production. It also works well when integrated into an existing server side app.
Here’s a programmatic example using [Node](https://nodejs.org/) and [Express](https://expressjs.com/):
@@ -100,7 +100,8 @@ When users install your app to the homescreen of their device the default config
## Building for Relative Paths
-By default, Create React App produces a build assuming your app is hosted at the server root.
+By default, Create React App produces a build assuming your app is hosted at the server root.
+
To override this, specify the `homepage` in your `package.json`, for example:
```js
@@ -109,10 +110,10 @@ To override this, specify the `homepage` in your `package.json`, for example:
This will let Create React App correctly infer the root path to use in the generated HTML file.
-**Note**: If you are using `react-router@^4`, you can root ` `s using the `basename` prop on any ``.
-More information [here](https://reacttraining.com/react-router/web/api/BrowserRouter/basename-string).
+**Note**: If you are using `react-router@^4`, you can root ` `s using the `basename` prop on any ``.
+
+More information [here](https://reacttraining.com/react-router/web/api/BrowserRouter/basename-string).
-
For example:
```js
@@ -162,7 +163,7 @@ Variables in `.env.production` will be used as fallback because `NODE_ENV` will
## [AWS Amplify](http://console.amplify.aws)
-The AWS Amplify Console provides continuous deployment and hosting for modern web apps (single page apps and static site generators) with serverless backends. The Amplify Console offers globally available CDNs, easy custom domain setup, feature branch deployments, and password protection.
+The AWS Amplify Console provides continuous deployment and hosting for modern web apps (single page apps and static site generators) with serverless backends. The Amplify Console offers globally available CDNs, custom domain setup, feature branch deployments, and password protection.
1. Login to the Amplify Console [here](https://console.aws.amazon.com/amplify/home).
1. Connect your Create React App repo and pick a branch. If you're looking for a Create React App+Amplify starter, try the [create-react-app-auth-amplify starter](https://github.com/swaminator/create-react-app-auth-amplify) that demonstrates setting up auth in 10 minutes with Create React App.
@@ -188,7 +189,7 @@ Then run the `firebase init` command from your project’s root. You need to cho
First, let's associate this project directory with a Firebase project.
You can create multiple project aliases by running firebase use --add,
- but for now we'll just set up a default project.
+ but for now we'll set up a default project.
? What Firebase project do you want to associate as default? Example app (example-app-fd690)
@@ -256,7 +257,7 @@ For more information see [Firebase Hosting](https://firebase.google.com/docs/hos
### Step 1: Add `homepage` to `package.json`
-**The step below is important!**
+**The step below is important!**
**If you skip it, your app will not deploy correctly.**
@@ -332,7 +333,7 @@ npm run deploy
Finally, make sure **GitHub Pages** option in your GitHub project settings is set to use the `gh-pages` branch:
-
+
### Step 5: Optionally, configure the domain
@@ -349,7 +350,7 @@ mywebsite.com
GitHub Pages doesn’t support routers that use the HTML5 `pushState` history API under the hood (for example, React Router using `browserHistory`). This is because when there is a fresh page load for a url like `http://user.github.io/todomvc/todos/42`, where `/todos/42` is a frontend route, the GitHub Pages server returns 404 because it knows nothing of `/todos/42`. If you want to add a router to a project hosted on GitHub Pages, here are a couple of solutions:
- You could switch from using HTML5 history API to routing with hashes. If you use React Router, you can switch to `hashHistory` for this effect, but the URL will be longer and more verbose (for example, `http://user.github.io/todomvc/#/todos/42?_k=yknaj`). [Read more](https://reacttraining.com/react-router/web/api/Router) about different history implementations in React Router.
-- Alternatively, you can use a trick to teach GitHub Pages to handle 404 by redirecting to your `index.html` page with a special redirect parameter. You would need to add a `404.html` file with the redirection code to the `build` folder before deploying your project, and you’ll need to add code handling the redirect parameter to `index.html`. You can find a detailed explanation of this technique [in this guide](https://github.com/rafrex/spa-github-pages).
+- Alternatively, you can use a trick to teach GitHub Pages to handle 404s by redirecting to your `index.html` page with a custom redirect parameter. You would need to add a `404.html` file with the redirection code to the `build` folder before deploying your project, and you’ll need to add code handling the redirect parameter to `index.html`. You can find a detailed explanation of this technique [in this guide](https://github.com/rafrex/spa-github-pages).
### Troubleshooting
@@ -371,7 +372,8 @@ If, when deploying, you get `Cannot read property 'email' of null`, try the foll
## [Heroku](https://www.heroku.com/)
-Use the [Heroku Buildpack for Create React App](https://github.com/mars/create-react-app-buildpack).
+Use the [Heroku Buildpack for Create React App](https://github.com/mars/create-react-app-buildpack).
+
You can find instructions in [Deploying React with Zero Configuration](https://blog.heroku.com/deploying-react-with-zero-configuration).
### Resolving Heroku Deployment Errors
@@ -436,39 +438,47 @@ To support `pushState`, make sure to create a `public/_redirects` file with the
When you build the project, Create React App will place the `public` folder contents into the build output.
-## [Now](https://zeit.co/now)
+## [ZEIT Now](https://zeit.co)
+
+[ZEIT Now](https://zeit.co) is a cloud platform for websites and serverless APIs, that you can use to deploy your Create React App projects to your personal domain (or a free `.now.sh` suffixed URL).
-[Now](https://zeit.co/docs) offers a simple, single-command deployment. You can use `now` to deploy your app for free.
+This guide will show you how to get started in a few quick steps:
-The first step is to install Now. You can do this by installing [the Now Desktop app](https://zeit.co/download), which also installs Now CLI and keeps it up-to-date, or by [installing Now CLI](https://zeit.co/download#now-cli) directly with npm:
+### Step 1: Installing Now CLI
+
+To install their command-line interface with [npm](https://www.npmjs.com/package/now), run the following command:
```shell
npm i -g now
```
-To deploy your built project directly with Now CLI in your terminal, without any configuration:
+### Step 2: Deploying
+
+You can deploy your application by running the following command in the root of the project directory:
-1. Build your app by running `npm run build`.
+```shell
+now
+```
-2. Move into the build directory by running `cd build`.
+**Alternatively**, you can also use their integration for [GitHub](https://zeit.co/github) or [GitLab](https://zeit.co/gitlab).
-3. Run `now --name your-project-name` from within the build directory. You will be given a **now.sh** URL as a response as your build is deployed, similar to the following: https://my-cra-project-4rx7b16z3.now.sh/
+That’s all!
-Click or paste the deployment URL into your browser when the build is complete and you will see your deployed app.
+Your site will now deploy, and you will receive a link similar to the following: https://react.now-examples.now.sh
-For more information on deploying React applications with Now, including automatically building your application fresh in the cloud, setting up routes to rewrite all paths to the index.html file, and setting up caching headers for speed, see [the ZEIT Guide for Deploying a React app with Create React App](https://zeit.co/guides/deploying-react-with-now-cra/).
+Out of the box, you are preconfigured for client-side routing compatibility and appropriate default caching headers. This behaviour can be overwritten [like this](https://zeit.co/docs/v2/advanced/routes/).
## [Render](https://render.com)
Render offers free [static site](https://render.com/docs/static-sites) hosting with fully managed SSL, a global CDN and continuous auto deploys from GitHub.
-Deploy your app in just a few minutes by following the [Create React App deployment guide](https://render.com/docs/deploy-create-react-app).
+Deploy your app in only a few minutes by following the [Create React App deployment guide](https://render.com/docs/deploy-create-react-app).
Use invite code `cra` to sign up or use [this link](https://render.com/i/cra).
## [S3](https://aws.amazon.com/s3) and [CloudFront](https://aws.amazon.com/cloudfront/)
-See this [blog post](https://medium.com/@omgwtfmarc/deploying-create-react-app-to-s3-or-cloudfront-48dae4ce0af) on how to deploy your React app to Amazon Web Services S3 and CloudFront.
+See this [blog post](https://medium.com/@omgwtfmarc/deploying-create-react-app-to-s3-or-cloudfront-48dae4ce0af) on how to deploy your React app to Amazon Web Services S3 and CloudFront. If you are looking to add a custom domain, HTTPS and continuous deployment see this [blog post](https://medium.com/dailyjs/a-guide-to-deploying-your-react-app-with-aws-s3-including-https-a-custom-domain-a-cdn-and-58245251f081).
## [Surge](https://surge.sh/)
diff --git a/docusaurus/docs/developing-components-in-isolation.md b/docusaurus/docs/developing-components-in-isolation.md
index 9286348d77e..90baae5a1de 100644
--- a/docusaurus/docs/developing-components-in-isolation.md
+++ b/docusaurus/docs/developing-components-in-isolation.md
@@ -4,7 +4,7 @@ title: Developing Components in Isolation
---
Usually, in an app, you have a lot of UI components, and each of them has many different states.
-For an example, a simple button component could have the following states:
+For an example, a basic button component could have the following states:
- In a regular state, with a text label.
- In the disabled mode.
@@ -12,7 +12,7 @@ For an example, a simple button component could have the following states:
Usually, it’s hard to see these states without running a sample app or some examples.
-Create React App doesn’t include any tools for this by default, but you can easily add [Storybook for React](https://storybook.js.org) ([source](https://github.com/storybooks/storybook)) or [React Styleguidist](https://react-styleguidist.js.org/) ([source](https://github.com/styleguidist/react-styleguidist)) to your project. **These are third-party tools that let you develop components and see all their states in isolation from your app**.
+Create React App doesn’t include any tools for this by default, but you can add [Storybook for React](https://storybook.js.org) ([source](https://github.com/storybooks/storybook)) or [React Styleguidist](https://react-styleguidist.js.org/) ([source](https://github.com/styleguidist/react-styleguidist)) to your project. **These are third-party tools that let you develop components and see all their states in isolation from your app**.
![Storybook for React Demo](https://i.imgur.com/7CIAWpB.gif)
diff --git a/docusaurus/docs/fetching-data-with-ajax-requests.md b/docusaurus/docs/fetching-data-with-ajax-requests.md
index 8dff9f8ce58..22f37e09a06 100644
--- a/docusaurus/docs/fetching-data-with-ajax-requests.md
+++ b/docusaurus/docs/fetching-data-with-ajax-requests.md
@@ -6,7 +6,7 @@ sidebar_label: Fetching Data
React doesn't prescribe a specific approach to data fetching, but people commonly use either a library like [axios](https://github.com/axios/axios) or the [`fetch()` API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) provided by the browser.
-The global `fetch` function allows you to easily make AJAX requests. It takes in a URL as an input and returns a `Promise` that resolves to a `Response` object. You can find more information about `fetch` [here](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch).
+The global `fetch` function allows you to make AJAX requests. It takes in a URL as an input and returns a `Promise` that resolves to a `Response` object. You can find more information about `fetch` [here](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch).
A Promise represents the eventual result of an asynchronous operation, you can find more information about Promises [here](https://www.promisejs.org/) and [here](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise). Both axios and `fetch()` use Promises under the hood. You can also use the [`async / await`](https://davidwalsh.name/async-await) syntax to reduce the callback nesting.
diff --git a/docusaurus/docs/getting-started.md b/docusaurus/docs/getting-started.md
index ab52bc6c7b5..7651ad9dc5b 100644
--- a/docusaurus/docs/getting-started.md
+++ b/docusaurus/docs/getting-started.md
@@ -23,18 +23,18 @@ 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`.
-
+
### Get Started Immediately
You **don’t** need to install or configure tools like Webpack or Babel. They are preconfigured and hidden so that you can focus on the code.
-Just create a project, and you’re good to go.
+Create a project, and you’re good to go.
## Creating an App
-**You’ll need to have Node >= 8.10 on your local development machine** (but it’s not required on the server). You can use [nvm](https://github.com/creationix/nvm#installation) (macOS/Linux) or [nvm-windows](https://github.com/coreybutler/nvm-windows#node-version-manager-nvm-for-windows) to easily switch Node versions between different projects.
+**You’ll need to have Node >= 8.10 on your local development machine** (but it’s not required on the server). You can use [nvm](https://github.com/creationix/nvm#installation) (macOS/Linux) or [nvm-windows](https://github.com/coreybutler/nvm-windows#node-version-manager-nvm-for-windows) to switch Node versions between different projects.
To create a new app, you may choose one of the following methods:
@@ -62,9 +62,37 @@ yarn create react-app my-app
_`yarn create` is available in Yarn 0.25+_
-### Creating a TypeScript app
+### Selecting a template
-Follow our [Adding TypeScript](adding-typescript.md) documentation to create a TypeScript app.
+You can now optionally start a new app from a template by appending `--template [template-name]` to the creation command.
+
+If you don't select a template, we'll create your project with our base template.
+
+Templates are always named in the format `cra-template-[template-name]`, however you only need to provide the `[template-name]` to the creation command.
+
+```sh
+npx create-react-app my-app --template [template-name]
+```
+
+> You can find a a list of available templates by searching for ["cra-template-\*"](https://www.npmjs.com/search?q=cra-template-*) on npm.
+
+#### Creating a TypeScript app
+
+You can start a new TypeScript app using templates. To use our provided TypeScript template, append `--template typescript` to the creation command.
+
+```sh
+npx create-react-app my-app --template typescript
+```
+
+If you already have a project and would like to add TypeScript, see our [Adding TypeScript](adding-typescript.md) documentation.
+
+### Selecting a package manager
+
+When you create a new app, the CLI will use [Yarn](https://yarnpkg.com/) to install dependencies (when available). If you have Yarn installed, but would prefer to use npm, you can append `--use-npm` to the creation command. For example:
+
+```sh
+npx create-react-app my-app --use-npm
+```
## Output
@@ -79,7 +107,10 @@ my-app
├── public
│ ├── favicon.ico
│ ├── index.html
-│ └── manifest.json
+│ ├── logo192.png
+│ ├── logo512.png
+│ ├── manifest.json
+│ └── robots.txt
└── src
├── App.css
├── App.js
@@ -90,7 +121,7 @@ my-app
└── serviceWorker.js
```
-No configuration or complicated folder structures, just the files you need to build your app. Once the installation is done, you can open your project folder:
+No configuration or complicated folder structures, only the files you need to build your app. Once the installation is done, you can open your project folder:
```sh
cd my-app
@@ -107,7 +138,7 @@ Runs the app in development mode. Open [http://localhost:3000](http://localhost:
The page will automatically reload if you make changes to the code. You will see the build errors and lint warnings in the console.
-
+
### `npm test` or `yarn test`
diff --git a/docusaurus/docs/importing-a-component.md b/docusaurus/docs/importing-a-component.md
index a04670a9a0a..61fc9b0d492 100644
--- a/docusaurus/docs/importing-a-component.md
+++ b/docusaurus/docs/importing-a-component.md
@@ -3,7 +3,8 @@ id: importing-a-component
title: Importing a Component
---
-This project setup supports ES6 modules thanks to Webpack.
+This project setup supports ES6 modules thanks to Webpack.
+
While you can still use `require()` and `module.exports`, we encourage you to use [`import` and `export`](http://exploringjs.com/es6/ch_modules.html) instead.
For example:
diff --git a/docusaurus/docs/installing-a-dependency.md b/docusaurus/docs/installing-a-dependency.md
index 6e356315ab2..07559840a6e 100644
--- a/docusaurus/docs/installing-a-dependency.md
+++ b/docusaurus/docs/installing-a-dependency.md
@@ -15,4 +15,4 @@ Alternatively you may use `yarn`:
yarn add react-router-dom
```
-This works for any library, not just `react-router-dom`.
+This works for any library, not only `react-router-dom`.
diff --git a/docusaurus/docs/integrating-with-an-api-backend.md b/docusaurus/docs/integrating-with-an-api-backend.md
index bae06982988..60b9b1f43cd 100644
--- a/docusaurus/docs/integrating-with-an-api-backend.md
+++ b/docusaurus/docs/integrating-with-an-api-backend.md
@@ -23,3 +23,8 @@ You can find the companion GitHub repository [here](https://github.com/fullstack
It allows creating hypermedia and GraphQL APIs in minutes.
It is shipped with an official Progressive Web App generator as well as a dynamic administration interface, both built for Create React App.
Check out [this tutorial](https://api-platform.com/docs/distribution).
+
+
+## C# (ASP.NET Core)
+
+ASP.NET Core has a React project template that uses Create React App. Check out [their documentation](https://docs.microsoft.com/en-us/aspnet/core/client-side/spa/react).
diff --git a/docusaurus/docs/making-a-progressive-web-app.md b/docusaurus/docs/making-a-progressive-web-app.md
index 0eb7d404edf..e8e9c1bddde 100644
--- a/docusaurus/docs/making-a-progressive-web-app.md
+++ b/docusaurus/docs/making-a-progressive-web-app.md
@@ -64,7 +64,7 @@ following into account:
these 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/serviceWorker.js`](https://github.com/facebook/create-react-app/blob/master/packages/react-scripts/template/src/serviceWorker.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
+ scenario, and which as a default, only logs appropriate messages to the
JavaScript console.
1. Service workers [require HTTPS](https://developers.google.com/web/fundamentals/getting-started/primers/service-workers#you_need_https),
@@ -80,7 +80,7 @@ following into account:
changes you've made locally.
1. If you _need_ to test your offline-first service worker locally, build
- the application (using `npm run build`) and run a simple http server from your
+ the application (using `npm run build`) and run a standard http server from your
build directory. After running the build script, `create-react-app` will give
instructions for one way to test your production build locally and the [deployment instructions](deployment.md) have
instructions for using other methods. _Be sure to always use an
diff --git a/docusaurus/docs/post-processing-css.md b/docusaurus/docs/post-processing-css.md
index b7589d2719f..1a456b9f1c5 100644
--- a/docusaurus/docs/post-processing-css.md
+++ b/docusaurus/docs/post-processing-css.md
@@ -39,5 +39,6 @@ becomes this:
If you need to disable autoprefixing for some reason, [follow this section](https://github.com/postcss/autoprefixer#disabling).
[CSS Grid Layout](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Grid_Layout) prefixing is disabled by default, but it will **not** strip manual prefixing.
-If you'd like to opt-in to CSS Grid prefixing, [first familiarize yourself about its limitations](https://github.com/postcss/autoprefixer#does-autoprefixer-polyfill-grid-layout-for-ie).
+If you'd like to opt-in to CSS Grid prefixing, [first familiarize yourself about its limitations](https://github.com/postcss/autoprefixer#does-autoprefixer-polyfill-grid-layout-for-ie).
+
To enable CSS Grid prefixing, add `/* autoprefixer grid: autoplace */` to the top of your CSS file.
diff --git a/docusaurus/docs/production-build.md b/docusaurus/docs/production-build.md
index 7bafc5bf743..8acb30fc9eb 100644
--- a/docusaurus/docs/production-build.md
+++ b/docusaurus/docs/production-build.md
@@ -15,7 +15,7 @@ When running a production build of freshly created Create React App application,
- These files can either be _vendor_ code, or [code splitting chunks](code-splitting.md). _Vendor_ code includes modules that you've imported from within `node_modules`. One of the potential advantages with splitting your _vendor_ and _application_ code is to enable [long term caching techniques](#static-file-caching) to improve application loading performance. Since _vendor_ code tends to change less often than the actual _application_ code, the browser will be able to cache them separately, and won't re-download them each time the app code changes.
-`runtime~main.[hash].js`
+`runtime-main.[hash].js`
- This is a small chunk of [webpack runtime](https://webpack.js.org/configuration/optimization/#optimization-runtimechunk) logic which is used to load and run your application. The contents of this will be embedded in your `build/index.html` file by default to save an additional network request. You can opt out of this by specifying `INLINE_RUNTIME_CHUNK=false` as documented in our [advanced configuration](advanced-configuration.md), which will load this chunk instead of embedding it in your `index.html`.
@@ -28,3 +28,9 @@ Each file inside of the `build/static` directory will have a unique hash appende
To deliver the best performance to your users, it's best practice to specify a `Cache-Control` header for `index.html`, as well as the files within `build/static`. This header allows you to control the length of time that the browser as well as CDNs will cache your static assets. If you aren't familiar with what `Cache-Control` does, see [this article](https://jakearchibald.com/2016/caching-best-practices/) for a great introduction.
Using `Cache-Control: max-age=31536000` for your `build/static` assets, and `Cache-Control: no-cache` for everything else is a safe and effective starting point that ensures your user's browser will always check for an updated `index.html` file, and will cache all of the `build/static` files for one year. Note that you can use the one year expiration on `build/static` safely because the file contents hash is embedded into the filename.
+
+## Profiling
+
+ReactDOM automatically supports profiling in development mode for v16.5+, but since profiling adds some small
+additional overhead it is opt-in for production mode. You can opt-in by using the `--profile` flag. Use `npm run build -- --profile` or `yarn build --profile` to enable profiling in the production build. See the [React docs](https://reactjs.org/docs/optimizing-performance.html#profiling-components-with-the-devtools-profiler) for details about profiling
+using the React DevTools.
diff --git a/docusaurus/docs/proxying-api-requests-in-development.md b/docusaurus/docs/proxying-api-requests-in-development.md
index a113f4d4211..3fdfb778069 100644
--- a/docusaurus/docs/proxying-api-requests-in-development.md
+++ b/docusaurus/docs/proxying-api-requests-in-development.md
@@ -6,7 +6,8 @@ sidebar_label: Proxying in Development
> Note: this feature is available with `react-scripts@0.2.3` and higher.
-People often serve the front-end React app from the same host and port as their backend implementation.
+People often serve the front-end React app from the same host and port as their backend implementation.
+
For example, a production setup might look like this after the app is deployed:
/ - static server returns index.html with React app
@@ -31,7 +32,8 @@ Fetch API cannot load http://localhost:4000/api/todos. No 'Access-Control-Allow-
Keep in mind that `proxy` only has effect in development (with `npm start`), and it is up to you to ensure that URLs like `/api/todos` point to the right thing in production. You don’t have to use the `/api` prefix. Any unrecognized request without a `text/html` accept header will be redirected to the specified `proxy`.
-The `proxy` option supports HTTP, HTTPS and WebSocket connections.
+The `proxy` option supports HTTP, HTTPS and WebSocket connections.
+
If the `proxy` option is **not** flexible enough for you, alternatively you can:
- [Configure the proxy yourself](#configuring-the-proxy-manually)
@@ -96,7 +98,13 @@ You can now register proxies as you wish! Here's an example using the above `htt
const proxy = require('http-proxy-middleware');
module.exports = function(app) {
- app.use(proxy('/api', { target: 'http://localhost:5000/' }));
+ app.use(
+ '/api',
+ proxy({
+ target: 'http://localhost:5000',
+ changeOrigin: true,
+ })
+ );
};
```
diff --git a/docusaurus/docs/running-tests.md b/docusaurus/docs/running-tests.md
index e166c71dfd0..f416b64d33f 100644
--- a/docusaurus/docs/running-tests.md
+++ b/docusaurus/docs/running-tests.md
@@ -3,7 +3,7 @@ id: running-tests
title: Running Tests
---
-> Note: this feature is available with `react-scripts@0.3.0` and higher.
+> Note: this feature is available with `react-scripts@0.3.0` and higher.
> [Read the migration guide to learn how to enable it in older projects!](https://github.com/facebook/create-react-app/blob/master/CHANGELOG-0.x.md#migrating-from-023-to-030)
@@ -25,11 +25,11 @@ Jest will look for test files with any of the following popular naming conventio
The `.test.js` / `.spec.js` files (or the `__tests__` folders) can be located at any depth under the `src` top level folder.
-We recommend to put the test files (or `__tests__` folders) next to the code they are testing so that relative imports appear shorter. For example, if `App.test.js` and `App.js` are in the same folder, the test just needs to `import App from './App'` instead of a long relative path. Collocation also helps find tests more quickly in larger projects.
+We recommend to put the test files (or `__tests__` folders) next to the code they are testing so that relative imports appear shorter. For example, if `App.test.js` and `App.js` are in the same folder, the test only needs to `import App from './App'` instead of a long relative path. Collocation also helps find tests more quickly in larger projects.
## Command Line Interface
-When you run `npm test`, Jest will launch in watch mode\* . Every time you save a file, it will re-run the tests, just like `npm start` recompiles the code.
+When you run `npm test`, Jest will launch in watch mode\* . Every time you save a file, it will re-run the tests, like how `npm start` recompiles the code.
The watcher includes an interactive command-line interface with the ability to run all tests, or focus on a search pattern. It is designed this way so that you can keep it open and enjoy fast re-runs. You can learn the commands from the “Watch Usage” note that the watcher prints after every run:
@@ -60,14 +60,15 @@ it('sums numbers', () => {
});
```
-All `expect()` matchers supported by Jest are [extensively documented here](https://jestjs.io/docs/en/expect.html#content).
+All `expect()` matchers supported by Jest are [extensively documented here](https://jestjs.io/docs/en/expect.html#content).
+
You can also use [`jest.fn()` and `expect(fn).toBeCalled()`](https://jestjs.io/docs/en/expect.html#tohavebeencalled) to create “spies” or mock functions.
## Testing Components
There is a broad spectrum of component testing techniques. They range from a “smoke test” verifying that a component renders without throwing, to shallow rendering and testing some of the output, to full rendering and testing component lifecycle and state changes.
-Different projects choose different testing tradeoffs based on how often components change, and how much logic they contain. If you haven’t decided on a testing strategy yet, we recommend that you start with creating simple smoke tests for your components:
+Different projects choose different testing tradeoffs based on how often components change, and how much logic they contain. If you haven’t decided on a testing strategy yet, we recommend that you start with creating basic smoke tests for your components:
```js
import React from 'react';
@@ -111,8 +112,6 @@ import Adapter from 'enzyme-adapter-react-16';
configure({ adapter: new Adapter() });
```
-> Note: When using TypeScript with Babel, all your files need to have at least one export, otherwise you will get the error `Cannot compile namespaces when the '--isolatedModules' flag is provided.`. To fix this, you can add `export default undefined` to `src/setupTests.ts`.
-
> Note: Keep in mind that if you decide to "eject" before creating `src/setupTests.js`, the resulting `package.json` file won't contain any reference to it. [Read here](#initializing-test-environment) to learn how to add this after ejecting.
Now you can write a smoke test with it:
@@ -146,10 +145,11 @@ it('renders welcome message', () => {
});
```
-All Jest matchers are [extensively documented here](https://jestjs.io/docs/en/expect.html).
+All Jest matchers are [extensively documented here](https://jestjs.io/docs/en/expect.html).
+
Nevertheless you can use a third-party assertion library like [Chai](https://chaijs.com/) if you want to, as described below.
-Additionally, you might find [jest-enzyme](https://github.com/blainekasten/enzyme-matchers) helpful to simplify your tests with readable matchers. The above `contains` code can be written more simply with jest-enzyme.
+Additionally, you might find [jest-enzyme](https://github.com/blainekasten/enzyme-matchers) helpful to improve your tests with readable matchers. The above `contains` code can be written more concisely with jest-enzyme.
```js
expect(wrapper).toContainReact(welcome);
@@ -175,28 +175,26 @@ import 'jest-enzyme';
### Option 2: React Testing Library
-As an alternative or companion to `enzyme`, you may consider using `react-testing-library`. [`react-testing-library`](https://github.com/kentcdodds/react-testing-library) is a library for testing React components in a way that resembles the way the components are used by end users. It is well suited for unit, integration, and end-to-end testing of React components and applications. It works more directly with DOM nodes, and therefore it's recommended to use with [`jest-dom`](https://github.com/gnapse/jest-dom) for improved assertions.
+As an alternative or companion to `enzyme`, you may consider using `react-testing-library`. [`react-testing-library`](https://github.com/testing-library/react-testing-library) is a library for testing React components in a way that resembles the way the components are used by end users. It is well suited for unit, integration, and end-to-end testing of React components and applications. It works more directly with DOM nodes, and therefore it's recommended to use with [`jest-dom`](https://github.com/testing-library/jest-dom) for improved assertions.
To install `react-testing-library` and `jest-dom`, you can run:
```sh
-npm install --save @testing-library/react jest-dom
+npm install --save @testing-library/react @testing-library/jest-dom
```
Alternatively you may use `yarn`:
```sh
-yarn add @testing-library/react jest-dom
+yarn add @testing-library/react @testing-library/jest-dom
```
Similar to `enzyme` you can create a `src/setupTests.js` file to avoid boilerplate in your test files:
```js
// react-testing-library renders your components to document.body,
-// this will ensure they're removed after each test.
-import '@testing-library/react/cleanup-after-each';
// this adds jest-dom's custom assertions
-import 'jest-dom/extend-expect';
+import '@testing-library/jest-dom/extend-expect';
```
Here's an example of using `react-testing-library` and `jest-dom` for testing that the ` ` component renders "Welcome to React".
@@ -208,7 +206,7 @@ import App from './App';
it('renders welcome message', () => {
const { getByText } = render( );
- expect(getByText('Welcome to React')).toBeInTheDocument();
+ expect(getByText('Learn React')).toBeInTheDocument();
});
```
@@ -231,7 +229,7 @@ and then use them in your tests like you normally do.
> Note: this feature is available with `react-scripts@0.4.0` and higher.
-If your app uses a browser API that you need to mock in your tests or if you just need a global setup before running your tests, add a `src/setupTests.js` to your project. It will be automatically executed before running your tests.
+If your app uses a browser API that you need to mock in your tests or if you need a global setup before running your tests, add a `src/setupTests.js` to your project. It will be automatically executed before running your tests.
For example:
@@ -258,12 +256,14 @@ global.localStorage = localStorageMock;
## Focusing and Excluding Tests
-You can replace `it()` with `xit()` to temporarily exclude a test from being executed.
+You can replace `it()` with `xit()` to temporarily exclude a test from being executed.
+
Similarly, `fit()` lets you focus on a specific test without running any other tests.
## Coverage Reporting
-Jest has an integrated coverage reporter that works well with ES6 and requires no configuration.
+Jest has an integrated coverage reporter that works well with ES6 and requires no configuration.
+
Run `npm test -- --coverage` (note extra `--` in the middle) to include a coverage report like this:
![coverage report](https://i.imgur.com/5bFhnTS.png)
@@ -276,10 +276,21 @@ The default Jest coverage configuration can be overridden by adding any of the f
Supported overrides:
+- [`clearMocks`](https://jestjs.io/docs/en/configuration.html#clearmocks-boolean)
- [`collectCoverageFrom`](https://jestjs.io/docs/en/configuration.html#collectcoveragefrom-array)
- [`coverageReporters`](https://jestjs.io/docs/en/configuration.html#coveragereporters-array-string)
- [`coverageThreshold`](https://jestjs.io/docs/en/configuration.html#coveragethreshold-object)
+- [`displayName`](https://jestjs.io/docs/en/configuration.html#displayname-string-object)
+- [`extraGlobals`](https://jestjs.io/docs/en/configuration.html#extraglobals-array-string)
+- [`globalSetup`](https://jestjs.io/docs/en/configuration.html#globalsetup-string)
+- [`globalTeardown`](https://jestjs.io/docs/en/configuration.html#globalteardown-string)
+- [`moduleNameMapper`](https://jestjs.io/docs/en/configuration.html#modulenamemapper-object-string-string)
+- [`resetMocks`](https://jestjs.io/docs/en/configuration.html#resetmocks-boolean)
+- [`resetModules`](https://jestjs.io/docs/en/configuration.html#resetmodules-boolean)
- [`snapshotSerializers`](https://jestjs.io/docs/en/configuration.html#snapshotserializers-array-string)
+- [`transform`](https://jestjs.io/docs/en/configuration.html#transform-object-string-pathtotransformer-pathtotransformer-object)
+- [`transformIgnorePatterns`](https://jestjs.io/docs/en/configuration.html#transformignorepatterns-array-string)
+- [`watchPathIgnorePatterns`](https://jestjs.io/docs/en/configuration.html#watchpathignorepatterns-array-string)
Example package.json:
@@ -376,7 +387,7 @@ CI=true npm run build
The test command will force Jest to run in CI-mode, and tests will only run once instead of launching the watcher.
-For non-CI environments, you can simply pass the `--watchAll=false` flag to disable test-watching.
+For non-CI environments, you can pass the `--watchAll=false` flag to disable test-watching.
The build command will check for linter warnings and fail if any are found.
diff --git a/docusaurus/docs/setting-up-your-editor.md b/docusaurus/docs/setting-up-your-editor.md
index 869592d2915..95dbaa598b6 100644
--- a/docusaurus/docs/setting-up-your-editor.md
+++ b/docusaurus/docs/setting-up-your-editor.md
@@ -12,21 +12,15 @@ To configure the syntax highlighting in your favorite text editor, head to the [
## Displaying Lint Output in the Editor
-> Note: this feature is available with `react-scripts@0.2.0` and higher.
-> It works out of the box for newly created projects with `react-scripts@2.0.3` and higher.
+> Note: this feature is available with `react-scripts@0.2.0` and higher.
+
+> It works out of the box for newly created projects with `react-scripts@2.0.3` and higher.
+
> It also only works with npm 3 or higher.
Some editors, including Sublime Text, Atom, and Visual Studio Code, provide plugins for ESLint.
-They are not required for linting. You should see the linter output right in your terminal as well as the browser console. However, if you prefer the lint results to appear right in your editor, there are some extra steps you can do.
-
-You would need to install an ESLint plugin for your editor first. Then, add a file called `.eslintrc.json` to the project root:
-
-```json
-{
- "extends": "react-app"
-}
-```
+They are not required for linting. You should see the linter output right in your terminal as well as the browser console. If you prefer the lint results to appear right in your editor, please make sure you install an ESLint plugin/extension.
If you're using TypeScript and Visual Studio Code, the [ESLint Visual Studio Code extension](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint#overview) currently [doesn't have TypeScript support enabled by default](https://github.com/Microsoft/vscode-eslint/issues/609). To enable TypeScript support in the ESLint extension, add the following to your project's Visual Studio Code settings file, located at `.vscode/settings.json` (you can create this file if it doesn't already exist):
@@ -43,10 +37,47 @@ If you're using TypeScript and Visual Studio Code, the [ESLint Visual Studio Cod
Now your editor should report the linting warnings.
-Note that even if you edit your `.eslintrc.json` file further, these changes will **only affect the editor integration**. They won’t affect the terminal and in-browser lint output. This is because Create React App intentionally provides a minimal set of rules that find common mistakes.
+Note that even if you customise your ESLint config, these changes will **only affect the editor integration**. They won’t affect the terminal and in-browser lint output. This is because Create React App intentionally provides a minimal set of rules that find common mistakes.
If you want to enforce a coding style for your project, consider using [Prettier](https://github.com/jlongster/prettier) instead of ESLint style rules.
+### Experimental: Extending the ESLint config
+
+We recognise that in some cases, further customisation is required. It is now possible to extend the base ESLint config by setting the `EXTEND_ESLINT` environment variable to `true`. See [advanced configuration](advanced-configuration.md) for more information on available environment variables.
+
+Note that any rules set to `"error"` will stop the project from building.
+
+There are a few things to remember:
+
+1. We highly recommend extending the base config, as removing it could introduce hard-to-find issues.
+1. `.eslintignore` files will be respected
+1. When working with TypeScript, you'll need to provide an `overrides` object for rules that should _only_ target TypeScript files.
+
+In the below example:
+
+- the base config has been extended by a shared ESLint config,
+- a new rule has been set that applies to all JavaScript and TypeScript files, and
+- a new rule has been set that only targets TypeScript files.
+
+```json
+{
+ "eslintConfig": {
+ "extends": ["react-app", "shared-config"],
+ "rules": {
+ "additional-rule": "warn"
+ },
+ "overrides": [
+ {
+ "files": ["**/*.ts?(x)"],
+ "rules": {
+ "additional-typescript-only-rule": "warn"
+ }
+ }
+ ]
+ }
+}
+```
+
## Debugging in the Editor
**This feature is currently only supported by [Visual Studio Code](https://code.visualstudio.com) and [WebStorm](https://www.jetbrains.com/webstorm/).**
@@ -111,7 +142,7 @@ Alternatively you may use `yarn`:
yarn add husky lint-staged prettier
```
-- `husky` makes it easy to use githooks as if they are npm scripts.
+- `husky` makes it possible to use githooks as if they are npm scripts.
- `lint-staged` allows us to run scripts on staged files in git. See this [blog post about lint-staged to learn more about it](https://medium.com/@okonetchnikov/make-linting-great-again-f3890e1ad6b8).
- `prettier` is the JavaScript formatter we will run before commits.
@@ -135,13 +166,13 @@ Next we add a 'lint-staged' field to the `package.json`, for example:
},
+ "lint-staged": {
+ "src/**/*.{js,jsx,ts,tsx,json,css,scss,md}": [
-+ "prettier --single-quote --write",
++ "prettier --write",
+ "git add"
+ ]
+ },
"scripts": {
```
-Now, whenever you make a commit, Prettier will format the changed files automatically. You can also run `./node_modules/.bin/prettier --single-quote --write "src/**/*.{js,jsx,ts,tsx,json,css,scss,md}"` to format your entire project for the first time.
+Now, whenever you make a commit, Prettier will format the changed files automatically. You can also run `./node_modules/.bin/prettier --write "src/**/*.{js,jsx,ts,tsx,json,css,scss,md}"` to format your entire project for the first time.
Next you might want to integrate Prettier in your favorite editor. Read the section on [Editor Integration](https://prettier.io/docs/en/editors.html) on the Prettier GitHub page.
diff --git a/docusaurus/docs/supported-browsers-features.md b/docusaurus/docs/supported-browsers-features.md
index 32b205a23e9..b43648bb1bf 100644
--- a/docusaurus/docs/supported-browsers-features.md
+++ b/docusaurus/docs/supported-browsers-features.md
@@ -15,7 +15,7 @@ This project supports a superset of the latest JavaScript standard. In addition
- [Exponentiation Operator](https://github.com/rwaldron/exponentiation-operator) (ES2016).
- [Async/await](https://github.com/tc39/ecmascript-asyncawait) (ES2017).
- [Object Rest/Spread Properties](https://github.com/tc39/proposal-object-rest-spread) (ES2018).
-- [Dynamic import()](https://github.com/tc39/proposal-dynamic-import) (stage 3 proposal)
+- [Dynamic import()](https://github.com/tc39/proposal-dynamic-import) (stage 4 proposal)
- [Class Fields and Static Properties](https://github.com/tc39/proposal-class-public-fields) (part of stage 3 proposal).
- [JSX](https://facebook.github.io/react/docs/introducing-jsx.html), [Flow](./adding-flow) and [TypeScript](./adding-typescript).
@@ -52,4 +52,4 @@ Here is an example `browserslist` that is specified in `package.json`:
> Note that this does not include polyfills automatically for you. You will still need to polyfill language features (see above) as needed based on the browsers your are supporting.
-> When editing the `browserslist` config, you may notice that your changes don't get picked up right away. This is due to an [issue in babel-loader](https://github.com/babel/babel-loader/issues/690) not detecting the change in your `package.json`. An easy solution is to delete the `node_modules/.cache` folder and try again.
+> When editing the `browserslist` config, you may notice that your changes don't get picked up right away. This is due to an [issue in babel-loader](https://github.com/babel/babel-loader/issues/690) not detecting the change in your `package.json`. An quick solution is to delete the `node_modules/.cache` folder and try again.
diff --git a/docusaurus/docs/title-and-meta-tags.md b/docusaurus/docs/title-and-meta-tags.md
index 0da67432532..1bea575503b 100644
--- a/docusaurus/docs/title-and-meta-tags.md
+++ b/docusaurus/docs/title-and-meta-tags.md
@@ -19,16 +19,18 @@ If you use a custom server for your app in production and want to modify the tit
Since Create React App doesn’t support server rendering, you might be wondering how to make ` ` tags dynamic and reflect the current URL. To solve this, we recommend to add placeholders into the HTML, like this:
```html
-
+
-
-
+
+
+
+
```
-Then, on the server, regardless of the backend you use, you can read `index.html` into memory and replace `__OG_TITLE__`, `__OG_DESCRIPTION__`, and any other placeholders with values depending on the current URL. Just make sure to sanitize and escape the interpolated values so that they are safe to embed into HTML!
+Then, on the server, regardless of the backend you use, you can read `index.html` into memory and replace `__OG_TITLE__`, `__OG_DESCRIPTION__`, and any other placeholders with values depending on the current URL. Make sure to sanitize and escape the interpolated values so that they are safe to embed into HTML!
-If you use a Node server, you can even share the route matching logic between the client and the server. However duplicating it also works fine in simple cases.
+If you use a Node server, you can even share the route matching logic between the client and the server. However duplicating it also works fine in basic cases.
## Injecting Data from the Server into the Page
diff --git a/docusaurus/docs/troubleshooting.md b/docusaurus/docs/troubleshooting.md
index 10ca720c6af..38892e77a78 100644
--- a/docusaurus/docs/troubleshooting.md
+++ b/docusaurus/docs/troubleshooting.md
@@ -6,9 +6,11 @@ sidebar_label: Troubleshooting
## `npm start` doesn’t detect changes
-When you save a file while `npm start` is running, the browser should refresh with the updated code.
+When you save a file while `npm start` is running, the browser should refresh with the updated code.
+
If this doesn’t happen, try one of the following workarounds:
+- Check that your file is imported by your entrypoint. TypeScript will show errors on any of your source files, but webpack only reloads your files if they are directly or indirectly imported by one of your entrypoints.
- If your project is in a Dropbox folder, try moving it out.
- If the watcher doesn’t see a file called `index.js` and you’re referencing it by the folder name, you [need to restart the watcher](https://github.com/facebook/create-react-app/issues/1164) due to a Webpack bug.
- Some editors like Vim and IntelliJ have a “safe write” feature that currently breaks the watcher. You will need to disable it. Follow the instructions in [“Adjusting Your Text Editor”](https://webpack.js.org/guides/development/#adjusting-your-text-editor).
@@ -59,7 +61,8 @@ Please refer to [this section](deployment.md#resolving-heroku-deployment-errors)
If you use a [Moment.js](https://momentjs.com/), you might notice that only the English locale is available by default. This is because the locale files are large, and you probably only need a subset of [all the locales provided by Moment.js](https://momentjs.com/#multiple-locale-support).
-To add a specific Moment.js locale to your bundle, you need to import it explicitly.
+To add a specific Moment.js locale to your bundle, you need to import it explicitly.
+
For example:
```js
diff --git a/docusaurus/docs/using-global-variables.md b/docusaurus/docs/using-global-variables.md
index ee9ad8a6d94..2f5b20a2672 100644
--- a/docusaurus/docs/using-global-variables.md
+++ b/docusaurus/docs/using-global-variables.md
@@ -11,6 +11,6 @@ You can avoid this by reading the global variable explicitly from the `window` o
const $ = window.$;
```
-This makes it obvious you are using a global variable intentionally rather than because of a typo.
+This makes it clear you are using a global variable intentionally rather than because of a typo.
Alternatively, you can force the linter to ignore any line by adding `// eslint-disable-line` after it.
diff --git a/docusaurus/docs/using-https-in-development.md b/docusaurus/docs/using-https-in-development.md
index 4dbb2536d70..3541e356b8e 100644
--- a/docusaurus/docs/using-https-in-development.md
+++ b/docusaurus/docs/using-https-in-development.md
@@ -31,3 +31,14 @@ HTTPS=true npm start
```
Note that the server will use a self-signed certificate, so your web browser will almost definitely display a warning upon accessing the page.
+
+To avoid having to set the environment variable each time, you can either include in the `npm start` script like so:
+
+```json
+{
+ "start": "HTTPS=true react-scripts start"
+}
+```
+
+Or you can create a `.env` file with `HTTPS=true` set.
+[Learn more about environment variables in CRA](https://create-react-app.dev/docs/adding-custom-environment-variables).
diff --git a/docusaurus/docs/using-the-public-folder.md b/docusaurus/docs/using-the-public-folder.md
index 9a935827bae..378bdb604c3 100644
--- a/docusaurus/docs/using-the-public-folder.md
+++ b/docusaurus/docs/using-the-public-folder.md
@@ -24,12 +24,12 @@ This mechanism provides a number of benefits:
However there is an **escape hatch** that you can use to add an asset outside of the module system.
-If you put a file into the `public` folder, it will **not** be processed by Webpack. Instead it will be copied into the build folder untouched. To reference assets in the `public` folder, you need to use a special variable called `PUBLIC_URL`.
+If you put a file into the `public` folder, it will **not** be processed by Webpack. Instead it will be copied into the build folder untouched. To reference assets in the `public` folder, you need to use an environment variable called `PUBLIC_URL`.
Inside `index.html`, you can use it like this:
```html
-
+
```
Only files inside the `public` folder will be accessible by `%PUBLIC_URL%` prefix. If you need to use a file from `src` or `node_modules`, you’ll have to copy it there to explicitly specify your intention to make this file a part of the build.
diff --git a/docusaurus/website/.gitignore b/docusaurus/website/.gitignore
new file mode 100644
index 00000000000..1b34df5127b
--- /dev/null
+++ b/docusaurus/website/.gitignore
@@ -0,0 +1,20 @@
+# dependencies
+/node_modules
+
+# production
+/build
+
+# generated files
+.docusaurus
+.cache-loader
+
+# misc
+.DS_Store
+.env.local
+.env.development.local
+.env.test.local
+.env.production.local
+
+npm-debug.log*
+yarn-debug.log*
+yarn-error.log*
\ No newline at end of file
diff --git a/docusaurus/website/README.md b/docusaurus/website/README.md
index 13b5047f3bb..71505291a8a 100644
--- a/docusaurus/website/README.md
+++ b/docusaurus/website/README.md
@@ -1,144 +1,33 @@
-This website was created with [Docusaurus](https://docusaurus.io/).
+# Website
-# What's In This Document
+This website is built using Docusaurus 2, a modern static website generator.
-* [Get Started in 5 Minutes](#get-started-in-5-minutes)
-* [Directory Structure](#directory-structure)
-* [Editing Content](#editing-content)
-* [Adding Content](#adding-content)
-* [Full Documentation](#full-documentation)
+### Installation
-# Get Started in 5 Minutes
-
-1. Make sure all the dependencies for the website are installed:
-
-```sh
-# Install dependencies
-$ yarn
```
-2. Run your dev server:
-
-```sh
-# Start the site
-$ yarn start
+$ yarn
```
-## Directory Structure
-
-Your project file structure should look something like this
+### Local Development
```
-my-docusaurus/
- docs/
- doc-1.md
- doc-2.md
- doc-3.md
- website/
- core/
- node_modules/
- pages/
- static/
- css/
- img/
- package.json
- sidebar.json
- siteConfig.js
-```
-
-# Editing Content
-
-## Editing an existing docs page
-
-Edit docs by navigating to `docs/` and editing the corresponding document:
-
-`docs/doc-to-be-edited.md`
-
-```markdown
----
-id: page-needs-edit
-title: This Doc Needs To Be Edited
----
-
-Edit me...
+$ yarn start
```
-For more information about docs, click [here](https://docusaurus.io/docs/en/navigation)
-
-# Adding Content
-
-## Adding a new docs page to an existing sidebar
-
-1. Create the doc as a new markdown file in `/docs`, example `docs/newly-created-doc.md`:
+This command starts a local development server and open up a browser window. Most changes are reflected live without having to restart the server.
-```md
----
-id: newly-created-doc
-title: This Doc Needs To Be Edited
----
+### Build
-My new content here..
```
-
-1. Refer to that doc's ID in an existing sidebar in `website/sidebar.json`:
-
-```javascript
-// Add newly-created-doc to the Getting Started category of docs
-{
- "docs": {
- "Getting Started": [
- "quick-start",
- "newly-created-doc" // new doc here
- ],
- ...
- },
- ...
-}
+$ yarn build
```
-For more information about adding new docs, click [here](https://docusaurus.io/docs/en/navigation)
-
-## Adding items to your site's top navigation bar
+This command generates static content into the `build` directory and can be served using any static contents hosting service.
-1. Add links to docs, custom pages or external links by editing the headerLinks field of `website/siteConfig.js`:
+### Deployment
-`website/siteConfig.js`
-```javascript
-{
- headerLinks: [
- ...
- /* you can add docs */
- { doc: 'my-examples', label: 'Examples' },
- /* you can add custom pages */
- { page: 'help', label: 'Help' },
- /* you can add external links */
- { href: 'https://github.com/facebook/Docusaurus', label: 'GitHub' },
- ...
- ],
- ...
-}
```
-
-For more information about the navigation bar, click [here](https://docusaurus.io/docs/en/navigation)
-
-## Adding custom pages
-
-1. Docusaurus uses React components to build pages. The components are saved as .js files in `website/pages/en`:
-1. If you want your page to show up in your navigation header, you will need to update `website/siteConfig.js` to add to the `headerLinks` element:
-
-`website/siteConfig.js`
-```javascript
-{
- headerLinks: [
- ...
- { page: 'my-new-custom-page', label: 'My New Custom Page' },
- ...
- ],
- ...
-}
+$ GIT_USER= USE_SSH=1 yarn deploy
```
-For more information about custom pages, click [here](https://docusaurus.io/docs/en/custom-pages).
-
-# Full Documentation
-
-Full documentation can be found on the [website](https://docusaurus.io/).
+If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch.
diff --git a/docusaurus/website/core/Footer.js b/docusaurus/website/core/Footer.js
deleted file mode 100644
index aeb252c4204..00000000000
--- a/docusaurus/website/core/Footer.js
+++ /dev/null
@@ -1,116 +0,0 @@
-/**
- * Copyright (c) 2017-present, Facebook, Inc.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-
-const React = require('react');
-
-class Footer extends React.Component {
- docUrl(doc) {
- // FIXME: this is a second argument but for some reason /en/ links don't work.
- let language = '';
-
- const baseUrl = this.props.config.baseUrl;
- return `${baseUrl}docs/${language ? `${language}/` : ''}${doc}`;
- }
-
- pageUrl(doc) {
- // FIXME: this is a second argument but for some reason /en/ links don't work.
- let language = '';
-
- const baseUrl = this.props.config.baseUrl;
- return baseUrl + (language ? `${language}/` : '') + doc;
- }
-
- render() {
- return (
-
- );
- }
-}
-
-module.exports = Footer;
diff --git a/docusaurus/website/docusaurus.config.js b/docusaurus/website/docusaurus.config.js
new file mode 100644
index 00000000000..ad263b653cf
--- /dev/null
+++ b/docusaurus/website/docusaurus.config.js
@@ -0,0 +1,118 @@
+/**
+ * Copyright (c) 2017-present, Facebook, Inc.
+ *
+ * This source code is licensed under the MIT license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
+
+const siteConfig = {
+ title: 'Create React App',
+ tagline: 'Set up a modern web app by running one command.',
+ url: 'https://create-react-app.dev',
+ baseUrl: '/',
+ projectName: 'create-react-app',
+ organizationName: 'facebook',
+ favicon: 'img/favicon/favicon.ico',
+ presets: [
+ [
+ '@docusaurus/preset-classic',
+ {
+ docs: {
+ path: '../docs',
+ sidebarPath: require.resolve('./sidebars.json'),
+ editUrl:
+ 'https://github.com/facebook/create-react-app/edit/master/docusaurus/docs/',
+ showLastUpdateAuthor: true,
+ showLastUpdateTime: true,
+ },
+ theme: {
+ customCss: require.resolve('./src/css/custom.css'),
+ },
+ },
+ ],
+ ],
+ themeConfig: {
+ image: 'img/logo-og.png',
+ algolia: {
+ apiKey: '3be60f4f8ffc24c75da84857d6323791',
+ indexName: 'create-react-app',
+ },
+ navbar: {
+ title: 'Create React App',
+ logo: {
+ alt: 'Create React App Logo',
+ src: 'img/logo.svg',
+ },
+ links: [
+ { to: 'docs/getting-started', label: 'Docs', position: 'right' },
+ {
+ href: 'https://reactjs.org/community/support.html',
+ label: 'Help',
+ position: 'right',
+ },
+ {
+ href: 'https://www.github.com/facebook/create-react-app',
+ label: 'GitHub',
+ position: 'right',
+ },
+ ],
+ },
+ footer: {
+ style: 'dark',
+ links: [
+ {
+ title: 'Docs',
+ items: [
+ {
+ label: 'Get Started',
+ to: 'docs/getting-started',
+ },
+ {
+ label: 'Learn React',
+ href: 'https://reactjs.org/',
+ },
+ ],
+ },
+ {
+ title: 'Community',
+ items: [
+ {
+ label: 'Stack Overflow',
+ href:
+ 'https://stackoverflow.com/questions/tagged/create-react-app',
+ },
+ {
+ label: 'Spectrum',
+ href: 'https://spectrum.chat/create-react-app',
+ },
+ {
+ label: 'Twitter',
+ href: 'https://twitter.com/reactjs',
+ },
+ {
+ label: 'Contributor Covenant',
+ href:
+ 'https://www.contributor-covenant.org/version/1/4/code-of-conduct',
+ },
+ ],
+ },
+ {
+ title: 'Social',
+ items: [
+ {
+ label: 'GitHub',
+ href: 'https://www.github.com/facebook/create-react-app',
+ },
+ ],
+ },
+ ],
+ logo: {
+ alt: 'Facebook Open Source Logo',
+ src: 'img/oss_logo.png',
+ },
+ copyright: `Copyright © ${new Date().getFullYear()} Facebook, Inc.`,
+ },
+ },
+};
+
+module.exports = siteConfig;
diff --git a/docusaurus/website/i18n/en.json b/docusaurus/website/i18n/en.json
deleted file mode 100644
index 193c7bc09b9..00000000000
--- a/docusaurus/website/i18n/en.json
+++ /dev/null
@@ -1,174 +0,0 @@
-{
- "_comment": "This file is auto-generated by write-translations.js",
- "localized-strings": {
- "next": "Next",
- "previous": "Previous",
- "tagline": "Set up a modern web app by running one command.",
- "docs": {
- "adding-a-css-modules-stylesheet": {
- "title": "Adding a CSS Modules Stylesheet",
- "sidebar_label": "Adding CSS Modules"
- },
- "adding-a-router": {
- "title": "Adding a Router"
- },
- "adding-a-sass-stylesheet": {
- "title": "Adding a Sass Stylesheet",
- "sidebar_label": "Adding Sass Stylesheets"
- },
- "adding-a-stylesheet": {
- "title": "Adding a Stylesheet",
- "sidebar_label": "Adding Stylesheets"
- },
- "adding-bootstrap": {
- "title": "Adding Bootstrap"
- },
- "adding-custom-environment-variables": {
- "title": "Adding Custom Environment Variables",
- "sidebar_label": "Environment Variables"
- },
- "adding-flow": {
- "title": "Adding Flow"
- },
- "adding-images-fonts-and-files": {
- "title": "Adding Images, Fonts, and Files"
- },
- "adding-relay": {
- "title": "Adding Relay"
- },
- "adding-typescript": {
- "title": "Adding TypeScript"
- },
- "advanced-configuration": {
- "title": "Advanced Configuration"
- },
- "alternatives-to-ejecting": {
- "title": "Alternatives to Ejecting"
- },
- "analyzing-the-bundle-size": {
- "title": "Analyzing the Bundle Size",
- "sidebar_label": "Analyzing Bundle Size"
- },
- "available-scripts": {
- "title": "Available Scripts",
- "sidebar_label": "Available Scripts"
- },
- "can-i-use-decorators": {
- "title": "Can I Use Decorators?"
- },
- "code-splitting": {
- "title": "Code Splitting"
- },
- "debugging-tests": {
- "title": "Debugging Tests",
- "sidebar_label": "Debugging Tests"
- },
- "deployment": {
- "title": "Deployment",
- "sidebar_label": "Deployment"
- },
- "developing-components-in-isolation": {
- "title": "Developing Components in Isolation"
- },
- "documentation-intro": {
- "title": "About the Documentation",
- "sidebar_label": "About Docs"
- },
- "fetching-data-with-ajax-requests": {
- "title": "Fetching Data with AJAX Requests",
- "sidebar_label": "Fetching Data"
- },
- "folder-structure": {
- "title": "Folder Structure"
- },
- "getting-started": {
- "title": "Getting Started"
- },
- "importing-a-component": {
- "title": "Importing a Component"
- },
- "installing-a-dependency": {
- "title": "Installing a Dependency"
- },
- "integrating-with-an-api-backend": {
- "title": "Integrating with an API Backend",
- "sidebar_label": "Integrating with an API"
- },
- "loading-graphql-files": {
- "title": "Loading .graphql Files",
- "sidebar_label": "Loading .graphql Files"
- },
- "making-a-progressive-web-app": {
- "title": "Making a Progressive Web App"
- },
- "post-processing-css": {
- "title": "Post-Processing CSS"
- },
- "pre-rendering-into-static-html-files": {
- "title": "Pre-Rendering into Static HTML Files",
- "sidebar_label": "Pre-Rendering Static HTML"
- },
- "production-build": {
- "title": "Creating a Production Build"
- },
- "proxying-api-requests-in-development": {
- "title": "Proxying API Requests in Development",
- "sidebar_label": "Proxying in Development"
- },
- "running-tests": {
- "title": "Running Tests"
- },
- "setting-up-your-editor": {
- "title": "Setting Up Your Editor",
- "sidebar_label": "Editor Setup"
- },
- "supported-browsers-features": {
- "title": "Supported Browsers and Features",
- "sidebar_label": "Supported Browsers and Features"
- },
- "title-and-meta-tags": {
- "title": "Title and Meta Tags",
- "sidebar_label": "Title & Meta Tags"
- },
- "troubleshooting": {
- "title": "Troubleshooting",
- "sidebar_label": "Troubleshooting"
- },
- "updating-to-new-releases": {
- "title": "Updating to New Releases"
- },
- "using-global-variables": {
- "title": "Using Global Variables"
- },
- "using-https-in-development": {
- "title": "Using HTTPS in Development",
- "sidebar_label": "HTTPS in Development"
- },
- "using-the-public-folder": {
- "title": "Using the Public Folder"
- }
- },
- "links": {
- "Docs": "Docs",
- "Help": "Help",
- "GitHub": "GitHub"
- },
- "categories": {
- "Welcome": "Welcome",
- "Getting Started": "Getting Started",
- "Development": "Development",
- "Styles and Assets": "Styles and Assets",
- "Building your App": "Building your App",
- "Testing": "Testing",
- "Back-End Integration": "Back-End Integration",
- "Deployment": "Deployment",
- "Advanced Usage": "Advanced Usage",
- "Support": "Support"
- }
- },
- "pages-strings": {
- "Help Translate|recruit community translators for your project": "Help Translate",
- "Edit this Doc|recruitment message asking to edit the doc source": "Edit",
- "Translate this Doc|recruitment message asking to translate the docs": "Translate"
- }
-}
diff --git a/docusaurus/website/package.json b/docusaurus/website/package.json
index 7d66debef68..337d8ecda69 100644
--- a/docusaurus/website/package.json
+++ b/docusaurus/website/package.json
@@ -1,14 +1,27 @@
{
"scripts": {
- "examples": "docusaurus-examples",
- "start": "docusaurus-start",
- "build": "docusaurus-build",
- "publish-gh-pages": "docusaurus-publish",
- "write-translations": "docusaurus-write-translations",
- "version": "docusaurus-version",
- "rename-version": "docusaurus-rename-version"
+ "start": "docusaurus start",
+ "build": "docusaurus build",
+ "swizzle": "docusaurus swizzle",
+ "deploy": "docusaurus deploy"
},
- "devDependencies": {
- "docusaurus": "^1.7.2"
+ "dependencies": {
+ "@docusaurus/core": "^2.0.0-alpha.30",
+ "@docusaurus/preset-classic": "^2.0.0-alpha.30",
+ "classnames": "^2.2.6",
+ "react": "^16.11.0",
+ "react-dom": "^16.11.0"
+ },
+ "browserslist": {
+ "production": [
+ ">0.2%",
+ "not dead",
+ "not op_mini all"
+ ],
+ "development": [
+ "last 1 chrome version",
+ "last 1 firefox version",
+ "last 1 safari version"
+ ]
}
}
diff --git a/docusaurus/website/pages/en/index.js b/docusaurus/website/pages/en/index.js
deleted file mode 100755
index c7904f73e36..00000000000
--- a/docusaurus/website/pages/en/index.js
+++ /dev/null
@@ -1,187 +0,0 @@
-/**
- * Copyright (c) 2017-present, Facebook, Inc.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-
-const React = require('react');
-
-const CompLibrary = require('../../core/CompLibrary.js');
-
-const Container = CompLibrary.Container;
-const GridBlock = CompLibrary.GridBlock;
-
-const siteConfig = require(`${process.cwd()}/siteConfig.js`);
-
-function imgUrl(img) {
- return `${siteConfig.baseUrl}img/${img}`;
-}
-
-function docUrl(doc, language) {
- return `${siteConfig.baseUrl}docs/${language ? `${language}/` : ''}${doc}`;
-}
-
-class Button extends React.Component {
- render() {
- return (
-
- );
- }
-}
-
-Button.defaultProps = {
- target: '_self',
-};
-
-const SplashContainer = props => (
-
-);
-
-const Logo = props => (
-
-
-
-);
-
-const ProjectTitle = () => (
-
- {siteConfig.title}
- {siteConfig.tagline}
-
-);
-
-const PromoSection = props => (
-
-);
-
-class HomeSplash extends React.Component {
- render() {
- const language = this.props.language || '';
- return (
-
-
-
-
-
-
- Get Started
-
-
-
-
- );
- }
-}
-
-const Block = props => (
-
-
-
-);
-Block.defaultProps = {
- padding: ['bottom', 'top'],
-};
-
-const Features = props => (
-
- {[
- {
- title: 'Less to Learn',
- content:
- "You don't need to learn and configure many build tools. Instant reloads help you focus on development. When it's time to deploy, your bundles are optimized automatically.",
- },
- {
- title: 'Only One Dependency',
- content:
- 'Your app only needs one build dependency. We test Create React App to make sure that all of its underlying pieces work together seamlessly – no complicated version mismatches.',
- },
- {
- title: 'No Lock-In',
- content:
- 'Under the hood, we use Webpack, Babel, ESLint, and other amazing projects to power your app. If you ever want an advanced configuration, you can ”eject” from Create React App and edit their config files directly.',
- },
- ]}
-
-);
-
-const GetStarted = props => (
-
- {[
- {
- title: 'Get started in seconds',
- content: `Whether you’re using React or another library, Create React App lets you **focus on code, not build tools**.
-
-To create a project called \`my-app\`, run this command:
-
-\`\`\`sh
-npx create-react-app my-app
-\`\`\`
-`,
- },
- {
- image:
- 'https://camo.githubusercontent.com/29765c4a32f03bd01d44edef1cd674225e3c906b/68747470733a2f2f63646e2e7261776769742e636f6d2f66616365626f6f6b2f6372656174652d72656163742d6170702f323762343261632f73637265656e636173742e737667',
- imageAlign: 'right',
- },
- ]}
-
-);
-
-const Update = props => (
-
- {[
- {
- image: imgUrl('update.png'),
- imageAlign: 'left',
- },
- {
- title: 'Easy to maintain',
- content: `Updating your build tooling is typically a daunting and time-consuming task. When new versions of Create React App are released, you can upgrade using a single command:
-
-\`\`\`sh
-npm install react-scripts@latest
-\`\`\``,
- },
- ]}
-
-);
-
-class Index extends React.Component {
- render() {
- const language = this.props.language || '';
-
- return (
-
- );
- }
-}
-
-module.exports = Index;
diff --git a/docusaurus/website/siteConfig.js b/docusaurus/website/siteConfig.js
deleted file mode 100644
index b9a2f87206e..00000000000
--- a/docusaurus/website/siteConfig.js
+++ /dev/null
@@ -1,96 +0,0 @@
-/**
- * Copyright (c) 2017-present, Facebook, Inc.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-
-// See https://docusaurus.io/docs/site-config for all the possible
-// site configuration options.
-
-const siteConfig = {
- title: 'Create React App', // Title for your website.
- tagline: 'Set up a modern web app by running one command.',
- // For github.io type URLs, you would set the url and baseUrl like:
- url: 'https://facebook.github.io',
- baseUrl: '/create-react-app/',
- editUrl: 'https://github.com/facebook/create-react-app/edit/master/docusaurus/docs/',
-
- // Used for publishing and more
- projectName: 'create-react-app',
- organizationName: 'facebook',
- // For top-level user or org sites, the organization is still the same.
- // e.g., for the https://JoelMarcey.github.io site, it would be set like...
- // organizationName: 'JoelMarcey'
-
- // For no header links in the top nav bar -> headerLinks: [],
- headerLinks: [
- { doc: 'getting-started', label: 'Docs' },
- { href: 'https://reactjs.org/community/support.html', label: 'Help' },
- {
- href: 'https://www.github.com/facebook/create-react-app',
- label: 'GitHub',
- },
- ],
-
- /* path to images for header/footer */
- headerIcon: 'img/logo.svg',
- footerIcon: 'img/logo.svg',
- favicon: 'img/favicon/favicon.ico',
-
- /* Colors for website */
- colors: {
- primaryColor: '#20232a',
- secondaryColor: '#61dafb',
- },
-
- /* Custom fonts for website */
- /*
- fonts: {
- myFont: [
- "Times New Roman",
- "Serif"
- ],
- myOtherFont: [
- "-apple-system",
- "system-ui"
- ]
- },
- */
-
- // This copyright info is used in /core/Footer.js and blog RSS/Atom feeds.
- copyright: `Copyright © ${new Date().getFullYear()} Facebook Inc.`,
-
- highlight: {
- // Highlight.js theme to use for syntax highlighting in code blocks.
- theme: 'default',
- },
-
- // Add custom scripts here that would be placed in