Skip to content

Commit

Permalink
Feat/cra update (#163)
Browse files Browse the repository at this point in the history
* Publish

 - [email protected]
 - [email protected]
 - [email protected]
 - [email protected]
 - [email protected]
 - [email protected]
 - [email protected]
 - [email protected]
 - [email protected]

* Update runtime chunk name separator in docs (facebook#7705)

* Remove 'shortcut' link type before 'icon' (facebook#7707)

* Guard polyfills against window possibly being undefined (facebook#7205)

* Enable .eslintignore with extend flag (facebook#7562)

* Add "entrypoints" key to asset manifest (facebook#7721)

* Update adding flow documentation (facebook#7731)

* set output.globalObject to 'this' (facebook#7742)

Closes facebook#7741

* Update logic and log errors for EXTEND_ESLINT (facebook#7530)

* update list of supported jest config overrides (facebook#7601)

* Upgrade Webpack version (facebook#7740)

* Close br tags in template README files (facebook#7668)

* Fix variable name casing in fileTransform (facebook#7752)

* Documentation typo fix (facebook#7757)

* Fix linting error when using rest props (facebook#7754)

* Add TSC_COMPILE_ON_ERROR setting (facebook#6931)

* Remove switch case (facebook#7729)

* docs: note that v2 to v3 migration may require deletion of node_modules (facebook#7302)

* Stop hiding the column number of ESLint errors (facebook#6980)

* Support setting baseUrl to root directory (facebook#7755)

* Use installing package manager in README (facebook#7687)

* Support production profiling with React Developer Tools (facebook#7737)

* Added the alias for profiling and output change to keep the classNames and functionNames for human readbility

* defined isEnvProductionProfile with other isEnv checks

* moved the keep_classnames and keep_fnames to terserOptions scope

* resolve merge conflict for yarn.lock.cache

* revert yarn.lock.cache to master yarn.lock.cache
- git checkout origin/master -- packages/create-react-app/yarn.lock.cached

* Comment and Boolean Check
- I clarified the comment and specified the use case
- Changed the environment check to check for the specific true rather than
the assumed primitive value as before.

* Replaced env with flag
- Per suggestion --profile flag used instead of env variable PROFILE_APP

* documentation in available scripts section with suggested information

* resolved a local git issue. Fixed documentation error.

* moved documentation to suggested file
- Added a brief summary of profiling in available scripts section.
The summary references the production-build document. Which is the
file I moved the new documentation into under a new Header for production support.

* Update production-build.md


Co-authored-by: Ian Sutherland <[email protected]>

* Prepare 3.2.0 release

* Publish

 - [email protected]
 - [email protected]
 - [email protected]
 - [email protected]
 - [email protected]

* Temporarily disable Windows in CI (facebook#7773)

* Add babel runtime version to transform-runtime plugin to reduce… (facebook#7726)

* Add Babel sourcemap to resolve VSCode debugging issues (facebook#7022)

* Fix process type in TypeScript template (facebook#7796)

* Account for browserslist environment variables (facebook#7764)

* Clarify dynamic import stage in docs (facebook#7813)

* Update adding-typescript.md (facebook#7815)

* Document how to use the .env file to enforce HTTPS (facebook#7821)

* Fix absolute paths issue in Jest (facebook#7822)

* Document correct default behavior for HOST var (facebook#7823)

* Fix grammar error in troubleshooting.md (facebook#7824)

* Upgrade to docusaurus 2 (facebook#7785)

* chore: upgrade to docusaurus 2

* address review

* Update doc publishing instructions

* Revert logo in templates (facebook#7830)

* feat: add additional Jest keys to whitelist (facebook#7832)

* Link to React documentation for code splitting (facebook#7686)

The official documentation offers a simpler way of achieving route based code splitting.

* Add a note about .eslingignore files being respected (facebook#7809)

* added check for typescript template and unsupported node version (facebook#7839)

* added check for typescript template and unsupported node version

* addressed code review feedback regarding syntax and spelling mistakes

* Update getting-started.md (facebook#7841)

Update the initial project structure generated by create-react-app.

* Link to ASP.NET Core docs (facebook#7840)

* Update readme gif links (facebook#7849)

* Update adding-bootstrap.md (facebook#7853)

typo fix

* Move unused eslint webpack import into @remove-on-eject block (facebook#7856)

* 📖 DOC: Improvement (facebook#7819)

* Upgrade terser & enable parallel minification in wsl (facebook#7857)

* Add a GitHub Action that runs the build script (facebook#7861)

* Edit InterpolateHtmlPlugin hook (facebook#6448) (facebook#6449)

* Fix notations of loopback addresses (facebook#7474)

* Add Service-Worker header to checkValidServiceWorker (facebook#6753)

* Add header to checkValidServiceWorker (ts)

* Add header to checkValidServiceWorker

* Add additional information for postcss errors (facebook#6282) (facebook#6352)

* Add additional information for postcss errors

* Add additional information for postcss errors (simplify)

* Remove chunkname from postCSS compile error

* Remove line number from postCSS compile error

* Fix eslint complaints in build.js (facebook#7870)

* Add Alex to lint documentation (facebook#7852)

* Add Alex to lint documentation

* Attempt to trigger GitHub Action

* Configure Alex and update docs

* More docs updates

* Bump docusaurus 🦖 (facebook#7874)

* Dark scheme overlay (facebook#7052)

* Bump react (facebook#7875)

* Bump styling related loaders (facebook#7876)

* Remove alex precommit check (facebook#7878)

* Add template support (facebook#7716)

* Add template support

* Update templates version check

* Update TypeScript template README

* Prepare 3.3.0 beta

* If template name already starts with cra-template leave it alone (facebook#7880)

* Update prerelease publishing instructions

* Upgrade packages and tweak config to adapt to new config format (facebook#7814)

Rebased again now with smaller changes in this one which will make it easier to revert in case of eventual regressions.

* refactor: remove double coerce (facebook#7882)

* Add yarn.lock to .gitignore (facebook#7789)

* chore: Fix broken link for CRA deployment (facebook#7897)

* chore: Fix broken link for e2e README (facebook#7896)

* Add @testing-library to the default templates (facebook#7881)

* Add numeric separator support (facebook#7817)

* Update open (facebook#7910)

* Mark TypeScript as an optional peer dependency (facebook#7860)

* Add restoreMocks to supported jest config keys (facebook#7921)

* fix seperators typo (facebook#7932)

Its the little things that makes the big difference!  😁

Thanks

* No spinning React logo if `prefers-reduced-motion` (facebook#7931)

* Made PRs welcome badge point to contributors guide (facebook#7792)

* Make JavaScript and TypeScript templates consistent (facebook#7944)

* Fix CI (facebook#7951)

* Add optional chaining and nullish coalescing operators support (facebook#7438)

* Add tests for optional chaining and null coalescing (facebook#7952)

* Upgrade jest-watch-typeahead (facebook#7956)

* Fix light background in docusaurus night mode (facebook#7936)

* Fix light background in docusaurus night mode

Closes facebook#7930

* Rename lightBackground to gettingStartedSection

* Add placeholders where old template READMEs used to be (facebook#7972)

* Temporarily disable GitHub Actions (facebook#7978)

* Prepare 3.3.0 beta

* Bump dependencies (facebook#7986)

* Support scoped templates (facebook#7991)

* Add contributors section to readme (facebook#7995)

* added e2e test for checking typescript template with unsupported node (facebook#7844)

* Unpin dependencies in react-app-polyfill (facebook#7999)

* Add scripts support to templates (facebook#7989)

* Override no-unused-expressions with the typescript-eslint version (facebook#8003)

Fixes issues with optional chaining

* Prefix apple-touch-icon links with PUBLIC_URL. (facebook#8005)

* Bump webpack-dev-server (facebook#7988)

* Bump dependencies (facebook#8024)

* Re-enable GitHub Actions (facebook#8029)

* Update CHANGELOG

* Update CODEOWNERS

* Remove no-unexpected-multiline rule (facebook#8039)

* Add TypeScript peer dependency to react-scripts (facebook#8038)

* Update template docs (facebook#8050)

* Update template docs

* Update custom-templates.md

* Update custom-templates.md


Co-authored-by: Ian Sutherland <[email protected]>

* Prepare 3.3.0 release

* Update CHANGELOG

* Publish

 - [email protected]
 - [email protected]
 - [email protected]
 - [email protected]
 - [email protected]
 - [email protected]
 - [email protected]
 - [email protected]
 - [email protected]
 - [email protected]

* webpackHotDev now uses wss when https is used (facebook#8079)

* Add custom-templates to docs sidebar (facebook#8077)

* Fix typo in CHANGELOG.md (facebook#8080)

* fix Manifest entries

* update react-scripts dependencies

* add typesript-eslint to eslint-config peer depndencies

Co-authored-by: Ian Sutherland <[email protected]>
Co-authored-by: Samuel Meuli <[email protected]>
Co-authored-by: Lewis Llobera <[email protected]>
Co-authored-by: Jake Moxey <[email protected]>
Co-authored-by: Iguchi Tomokatsu <[email protected]>
Co-authored-by: Federico Zivolo <[email protected]>
Co-authored-by: Kent C. Dodds <[email protected]>
Co-authored-by: Laurin Quast <[email protected]>
Co-authored-by: neilbryson <[email protected]>
Co-authored-by: Reece Dunham <[email protected]>
Co-authored-by: Rakan Nimer <[email protected]>
Co-authored-by: Tomer Cohen <[email protected]>
Co-authored-by: Alexandr Tovmach <[email protected]>
Co-authored-by: Kyle Bebak <[email protected]>
Co-authored-by: André Lins <[email protected]>
Co-authored-by: Kim Persson <[email protected]>
Co-authored-by: Justin Grant <[email protected]>
Co-authored-by: Robert van Steen <[email protected]>
Co-authored-by: Ashrith Reddy <[email protected]>
Co-authored-by: Jacob M-G Evans <[email protected]>
Co-authored-by: Ian Schmitz <[email protected]>
Co-authored-by: Damian Senn <[email protected]>
Co-authored-by: Róbert FUSZENECKER <[email protected]>
Co-authored-by: May <[email protected]>
Co-authored-by: Orta <[email protected]>
Co-authored-by: Tomáš Hübelbauer <[email protected]>
Co-authored-by: Jesse Jackson <[email protected]>
Co-authored-by: Jake Boone <[email protected]>
Co-authored-by: Endi <[email protected]>
Co-authored-by: Brody McKee <[email protected]>
Co-authored-by: Hugo David-Boyet <[email protected]>
Co-authored-by: Sean Lafferty <[email protected]>
Co-authored-by: Ali Waseem <[email protected]>
Co-authored-by: reactjser <[email protected]>
Co-authored-by: Daniel Lo Nigro <[email protected]>
Co-authored-by: Chun <[email protected]>
Co-authored-by: Xuhao <[email protected]>
Co-authored-by: Sean Baines <[email protected]>
Co-authored-by: Abdul Wahab ⚡️ <[email protected]>
Co-authored-by: Guillaume Hertault <[email protected]>
Co-authored-by: Wataru Ashihara <[email protected]>
Co-authored-by: darthmaim <[email protected]>
Co-authored-by: Joshua Robinson <[email protected]>
Co-authored-by: Andreas Cederström <[email protected]>
Co-authored-by: Fabiano Brito <[email protected]>
Co-authored-by: Kanitkorn Sujautra <[email protected]>
Co-authored-by: Havit Rovik <[email protected]>
Co-authored-by: Tharun Rajendran <[email protected]>
Co-authored-by: Dylan Staley <[email protected]>
Co-authored-by: Donavon West <[email protected]>
Co-authored-by: James George <[email protected]>
Co-authored-by: RJ <[email protected]>
Co-authored-by: Renato Augusto Gama dos Santos <[email protected]>
Co-authored-by: Mateusz Burzyński <[email protected]>
Co-authored-by: Alex Guerra <[email protected]>
Co-authored-by: Klas Björkqvist <[email protected]>
Co-authored-by: Max Davidson <[email protected]>
Co-authored-by: Ben Blank <[email protected]>
Co-authored-by: Mike Caulley <[email protected]>
Co-authored-by: Trontor <[email protected]>
  • Loading branch information
Show file tree
Hide file tree
Showing 289 changed files with 12,248 additions and 10,439 deletions.
4 changes: 4 additions & 0 deletions .alexignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
build

CHANGELOG*
CODE_OF_CONDUCT.md
18 changes: 18 additions & 0 deletions .alexrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"allow": [
"attacks",
"colors",
"conservative",
"crashes",
"executed",
"executes",
"execution",
"failed",
"hook",
"host-hostess",
"hostesses-hosts",
"invalid",
"remain",
"watchman-watchwoman"
]
}
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
packages/ @bugzpodder @ianschmitz @iansu @mrmckeb @petetnt
packages/ @ianschmitz @iansu @mrmckeb @petetnt
docusaurus/ @amyrlam @iansu
13 changes: 13 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -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
13 changes: 13 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ yarn-debug.log*
yarn-error.log*
/.changelog
.npm/
yarn.lock
12 changes: 6 additions & 6 deletions CHANGELOG-1.x.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 `<head>` in `public/index.html`:

```html
<meta name="theme-color" content="#000000">
<!--
<meta name="theme-color" content="#000000" />
<!--
manifest.json provides metadata used when your web app is added to the
homescreen on Android. See https://developers.google.com/web/fundamentals/engage-and-retain/web-app-manifest/
-->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json">
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
```

Add `<noscript>` to `<body>` in `public/index.html`:

```html
<noscript>
You need to enable JavaScript to run this app.
</noscript>
<noscript>
You need to enable JavaScript to run this app.
</noscript>
```

Then create a file called `public/manifest.json` that looks like this:
Expand Down
54 changes: 27 additions & 27 deletions azure-pipelines-test-job.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 "[email protected]"
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 "[email protected]"
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'
120 changes: 67 additions & 53 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#

trigger:
- master
- master

variables:
CI: true
Expand All @@ -14,65 +14,79 @@ variables:
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
- 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
# ******************************************************************************
# 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 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
# ******************************************************************************
# 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 }
# ******************************************************************************
# 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'
# ******************************************************************************
# 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'
# ******************************************************************************
# Unsupported Node with TypeScript flag
# ******************************************************************************
- job: UnsupportedNodeWithTypeScript
pool:
vmImage: ubuntu-16.04
steps:
- task: NodeTool@0
inputs:
versionSpec: 8.9.x
displayName: 'Install Node.js 8.9.x'
- bash: tasks/e2e-typescript-unsupported-node.sh
displayName: 'Run unsupported TypeScript test'
5 changes: 3 additions & 2 deletions docusaurus/docs/adding-bootstrap.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ import 'bootstrap/dist/css/bootstrap.css';

> Note: this feature is available with `[email protected]` and higher.
Sometimes you might need to tweak the visual styles of Bootstrap (or equivalent package).<br>
Sometimes you might need to tweak the visual styles of Bootstrap (or equivalent package).

As of `[email protected]` 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`.
Expand All @@ -38,7 +39,7 @@ To enable `scss` in Create React App you will need to install `node-sass`.
npm install --save node-sass
```

Alternatively you may use `yarn`::
Alternatively you may use `yarn`:

```sh
yarn add node-sass
Expand Down
7 changes: 4 additions & 3 deletions docusaurus/docs/adding-custom-environment-variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down Expand Up @@ -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.<br>
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
Expand Down
2 changes: 1 addition & 1 deletion docusaurus/docs/adding-flow.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ make sure to add the following line to your `.flowconfig` to make Flow aware of

```diff
[options]
+ module.name_mapper='^\(.*\)$' -> '<PROJECT_ROOT>/src/\1'
+ module.name_mapper='^\([^\.].*\)$' -> '<PROJECT_ROOT>/src/\1'
```

To learn more about Flow, check out [its documentation](https://flow.org/).
9 changes: 5 additions & 4 deletions docusaurus/docs/adding-images-fonts-and-files.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).<br>
**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
Expand All @@ -58,6 +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 accessbile title to your svg component.
> **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.
2 changes: 1 addition & 1 deletion docusaurus/docs/adding-relay.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down
Loading

0 comments on commit 71e6f92

Please sign in to comment.