You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: CONTRIBUTING.md
+11-7
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
3
3
Loving Create React App and want to get involved? Thanks! There are plenty of ways you can help.
4
4
5
-
Please take a moment to review this document in order to make the contribution process easy and effective for everyone involved.
5
+
Please take a moment to review this document in order to make the contribution process straightforward and effective for everyone involved.
6
6
7
7
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.
8
8
@@ -15,23 +15,27 @@ Here are a few examples of them in action.
15
15
16
16
### Convention
17
17
18
+
<!--alex disable easy-->
19
+
18
20
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.
19
21
20
22
### Heuristics
21
23
22
24
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.
23
25
26
+
<!--alex disable just-->
27
+
24
28
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.
25
29
26
30
### Interactivity
27
31
28
-
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.
32
+
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.
29
33
30
34
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.
31
35
32
36
### Breaking the Rules
33
37
34
-
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.
38
+
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.
35
39
36
40
## Submitting a Pull Request
37
41
@@ -76,7 +80,7 @@ This package is enabled by default for all `create-react-app` scaffolded applica
@@ -90,7 +94,7 @@ All functionality must be retained (and configuration given to the user) if they
90
94
91
95
2. Run `yarn` in the root `create-react-app` folder.
92
96
93
-
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.
97
+
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.
94
98
95
99
If you want to try out the end-to-end flow with the global CLI, you can do this too:
96
100
@@ -113,7 +117,7 @@ More detailed information are in the dedicated [README](/packages/react-scripts/
113
117
114
118
#### Customizing E2E registry configuration
115
119
116
-
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`.
120
+
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`.
117
121
118
122
For more information about the configuration check out the [Verdaccio documentation](https://verdaccio.org/docs/en/configuration).
119
123
@@ -148,7 +152,7 @@ By default git would use `CRLF` line endings which would cause the scripts to fa
148
152
- 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.
149
153
150
154
7. Make sure to include “Migrating from ...” instructions for the previous release. Often you can copy and paste them.
151
-
8. Run `npm run publish`. (It has to be `npm run publish` exactly, not just `npm publish` or `yarn publish`.)
155
+
8. Run `npm run publish`. (It has to be `npm run publish` exactly, not `npm publish` or `yarn publish`.)
152
156
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.
153
157
10. After publishing, create a GitHub Release with the same text as the changelog entry. See previous Releases for inspiration.
Copy file name to clipboardexpand all lines: README.md
+5-5
Original file line number
Diff line number
Diff line change
@@ -31,11 +31,11 @@ When you’re ready to deploy to production, create a minified bundle with `npm
31
31
You **don’t** need to install or configure tools like Webpack or Babel.<br>
32
32
They are preconfigured and hidden so that you can focus on the code.
33
33
34
-
Just create a project, and you’re good to go.
34
+
Create a project, and you’re good to go.
35
35
36
36
## Creating an App
37
37
38
-
**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 easily switch Node versions between different projects.
38
+
**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.
39
39
40
40
To create a new app, you may choose one of the following methods:
41
41
@@ -86,7 +86,7 @@ my-app
86
86
└── serviceWorker.js
87
87
```
88
88
89
-
No configuration or complicated folder structures, just the files you need to build your app.<br>
89
+
No configuration or complicated folder structures, only the files you need to build your app.<br>
90
90
Once the installation is done, you can open your project folder:
91
91
92
92
```sh
@@ -133,7 +133,7 @@ Please refer to the [User Guide](https://facebook.github.io/create-react-app/doc
133
133
134
134
## Philosophy
135
135
136
-
-**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.
136
+
-**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.
137
137
138
138
-**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.
139
139
@@ -172,7 +172,7 @@ Here are a few common cases where you might want to try something else:
172
172
173
173
- 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/).
174
174
175
-
- 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.
175
+
- 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.
176
176
177
177
- 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.
Copy file name to clipboardexpand all lines: docusaurus/docs/adding-custom-environment-variables.md
+2-2
Original file line number
Diff line number
Diff line change
@@ -12,13 +12,13 @@ Your project can consume variables declared in your environment as if they were
12
12
>
13
13
> Environment variables are embedded into the build, meaning anyone can view them by inspecting your app's files.
14
14
15
-
**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.
15
+
**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.
16
16
17
17
> 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.
18
18
19
19
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`.
20
20
21
-
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.
21
+
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.
22
22
23
23
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.
Copy file name to clipboardexpand all lines: docusaurus/docs/adding-images-fonts-and-files.md
+2-2
Original file line number
Diff line number
Diff line change
@@ -35,7 +35,7 @@ This works in CSS too:
35
35
}
36
36
```
37
37
38
-
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.
38
+
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.
39
39
40
40
Please be advised that this is also a custom feature of Webpack.
41
41
@@ -59,6 +59,6 @@ const App = () => (
59
59
);
60
60
```
61
61
62
-
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.
62
+
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.
63
63
64
64
> **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.
Copy file name to clipboardexpand all lines: docusaurus/docs/adding-relay.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -3,7 +3,7 @@ id: adding-relay
3
3
title: Adding Relay
4
4
---
5
5
6
-
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.
6
+
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.
Copy file name to clipboardexpand all lines: docusaurus/docs/alternatives-to-ejecting.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -3,4 +3,4 @@ id: alternatives-to-ejecting
3
3
title: Alternatives to Ejecting
4
4
---
5
5
6
-
[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).
6
+
[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).
Copy file name to clipboardexpand all lines: docusaurus/docs/debugging-tests.md
+2-7
Original file line number
Diff line number
Diff line change
@@ -32,7 +32,7 @@ Open the following in Chrome
32
32
about:inspect
33
33
```
34
34
35
-
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.
35
+
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.
36
36
37
37
> 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.
38
38
@@ -51,12 +51,7 @@ Use the following [`launch.json`](https://code.visualstudio.com/docs/editor/debu
Copy file name to clipboardexpand all lines: docusaurus/docs/deployment.md
+5-5
Original file line number
Diff line number
Diff line change
@@ -29,7 +29,7 @@ serve -h
29
29
30
30
## Other Solutions
31
31
32
-
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.
32
+
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.
33
33
34
34
Here’s a programmatic example using [Node](https://nodejs.org/) and [Express](https://expressjs.com/):
35
35
@@ -163,7 +163,7 @@ Variables in `.env.production` will be used as fallback because `NODE_ENV` will
163
163
164
164
## [AWS Amplify](http://console.amplify.aws)
165
165
166
-
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.
166
+
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.
167
167
168
168
1. Login to the Amplify Console [here](https://console.aws.amazon.com/amplify/home).
169
169
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.
@@ -189,7 +189,7 @@ Then run the `firebase init` command from your project’s root. You need to cho
189
189
190
190
First, let's associate this project directory with a Firebase project.
191
191
You can create multiple project aliases by running firebase use --add,
192
-
but for now we'll just set up a default project.
192
+
but for now we'll set up a default project.
193
193
194
194
? What Firebase project do you want to associate as default? Example app (example-app-fd690)
195
195
@@ -350,7 +350,7 @@ mywebsite.com
350
350
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:
351
351
352
352
- You could switch from using HTML5 history API to routing with hashes. If you use React Router, you can switch to `hashHistory`forthis 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 implementationsin React Router.
353
-
- 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).
353
+
- 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).
354
354
355
355
### Troubleshooting
356
356
@@ -472,7 +472,7 @@ Out of the box, you are preconfigured for client-side routing compatibility and
472
472
473
473
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.
474
474
475
-
Deploy your app injust a few minutes by following the [Create React App deployment guide](https://render.com/docs/deploy-create-react-app).
475
+
Deploy your app inonly a few minutes by following the [Create React App deployment guide](https://render.com/docs/deploy-create-react-app).
476
476
477
477
Use invite code `cra` to sign up or use [this link](https://render.com/i/cra).
Copy file name to clipboardexpand all lines: docusaurus/docs/developing-components-in-isolation.md
+2-2
Original file line number
Diff line number
Diff line change
@@ -4,15 +4,15 @@ title: Developing Components in Isolation
4
4
---
5
5
6
6
Usually, in an app, you have a lot of UI components, and each of them has many different states.
7
-
For an example, a simple button component could have the following states:
7
+
For an example, a basic button component could have the following states:
8
8
9
9
- In a regular state, with a text label.
10
10
- In the disabled mode.
11
11
- In a loading state.
12
12
13
13
Usually, it’s hard to see these states without running a sample app or some examples.
14
14
15
-
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**.
15
+
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**.
16
16
17
17

Copy file name to clipboardexpand all lines: docusaurus/docs/fetching-data-with-ajax-requests.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -6,7 +6,7 @@ sidebar_label: Fetching Data
6
6
7
7
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.
8
8
9
-
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).
9
+
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).
10
10
11
11
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.
Copy file name to clipboardexpand all lines: docusaurus/docs/getting-started.md
+3-3
Original file line number
Diff line number
Diff line change
@@ -30,11 +30,11 @@ When you’re ready to deploy to production, create a minified bundle with `npm
30
30
31
31
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.
32
32
33
-
Just create a project, and you’re good to go.
33
+
Create a project, and you’re good to go.
34
34
35
35
## Creating an App
36
36
37
-
**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.
37
+
**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.
38
38
39
39
To create a new app, you may choose one of the following methods:
40
40
@@ -101,7 +101,7 @@ my-app
101
101
└── serviceWorker.js
102
102
```
103
103
104
-
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:
104
+
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:
Copy file name to clipboardexpand all lines: docusaurus/docs/making-a-progressive-web-app.md
+2-2
Original file line number
Diff line number
Diff line change
@@ -64,7 +64,7 @@ following into account:
64
64
these messages is currently left as an exercise to the developer, but as a
65
65
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
66
66
demonstrates which service worker lifecycle events to listen for to detect each
67
-
scenario, and which as a default, just logs appropriate messages to the
67
+
scenario, and which as a default, only logs appropriate messages to the
68
68
JavaScript console.
69
69
70
70
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:
80
80
changes you've made locally.
81
81
82
82
1. If you _need_ to test your offline-first service worker locally, build
83
-
the application (using `npm run build`) and run a simple http server from your
83
+
the application (using `npm run build`) and run a standard http server from your
84
84
build directory. After running the build script, `create-react-app` will give
85
85
instructions for one way to test your production build locally and the [deployment instructions](deployment.md) have
86
86
instructions for using other methods. _Be sure to always use an
Copy file name to clipboardexpand all lines: docusaurus/docs/running-tests.md
+6-6
Original file line number
Diff line number
Diff line change
@@ -25,11 +25,11 @@ Jest will look for test files with any of the following popular naming conventio
25
25
26
26
The `.test.js` / `.spec.js` files (or the `__tests__` folders) can be located at any depth under the `src` top level folder.
27
27
28
-
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.
28
+
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.
29
29
30
30
## Command Line Interface
31
31
32
-
When you run `npm test`, Jest will launch in watch mode<sup>\*</sup>. Every time you save a file, it will re-run the tests, just like `npm start` recompiles the code.
32
+
When you run `npm test`, Jest will launch in watch mode<sup>\*</sup>. Every time you save a file, it will re-run the tests, like how`npm start` recompiles the code.
33
33
34
34
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:
35
35
@@ -68,7 +68,7 @@ You can also use [`jest.fn()` and `expect(fn).toBeCalled()`](https://jestjs.io/d
68
68
69
69
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.
70
70
71
-
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:
71
+
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:
72
72
73
73
```js
74
74
importReactfrom'react';
@@ -149,7 +149,7 @@ All Jest matchers are [extensively documented here](https://jestjs.io/docs/en/ex
149
149
150
150
Nevertheless you can use a third-party assertion library like [Chai](https://chaijs.com/) if you want to, as described below.
151
151
152
-
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.
152
+
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.
153
153
154
154
```js
155
155
expect(wrapper).toContainReact(welcome);
@@ -229,7 +229,7 @@ and then use them in your tests like you normally do.
229
229
230
230
> Note: this feature is available with `react-scripts@0.4.0` and higher.
231
231
232
-
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.
232
+
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.
233
233
234
234
For example:
235
235
@@ -387,7 +387,7 @@ CI=true npm run build
387
387
388
388
The test command will force Jest to run in CI-mode, and tests will only run once instead of launching the watcher.
389
389
390
-
For non-CI environments, you can simply pass the `--watchAll=false` flag to disable test-watching.
390
+
For non-CI environments, you can pass the `--watchAll=false` flag to disable test-watching.
391
391
392
392
The build command will check for linter warnings and fail if any are found.
Copy file name to clipboardexpand all lines: docusaurus/docs/setting-up-your-editor.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -142,7 +142,7 @@ Alternatively you may use `yarn`:
142
142
yarn add husky lint-staged prettier
143
143
```
144
144
145
-
-`husky` makes it easy to use githooks as if they are npm scripts.
145
+
-`husky` makes it possible to use githooks as if they are npm scripts.
146
146
-`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).
147
147
-`prettier` is the JavaScript formatter we will run before commits.
Copy file name to clipboardexpand all lines: docusaurus/docs/supported-browsers-features.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -52,4 +52,4 @@ Here is an example `browserslist` that is specified in `package.json`:
52
52
53
53
> 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.
54
54
55
-
> 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.
55
+
> 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.
Copy file name to clipboardexpand all lines: docusaurus/docs/title-and-meta-tags.md
+7-5
Original file line number
Diff line number
Diff line change
@@ -19,16 +19,18 @@ If you use a custom server for your app in production and want to modify the tit
19
19
Since Create React App doesn’t support server rendering, you might be wondering how to make `<meta>` tags dynamic and reflect the current URL. To solve this, we recommend to add placeholders into the HTML, like this:
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!
31
+
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!
30
32
31
-
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.
33
+
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.
Copy file name to clipboardexpand all lines: docusaurus/docs/using-the-public-folder.md
+2-2
Original file line number
Diff line number
Diff line change
@@ -24,12 +24,12 @@ This mechanism provides a number of benefits:
24
24
25
25
However there is an **escape hatch** that you can use to add an asset outside of the module system.
26
26
27
-
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`.
27
+
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`.
28
28
29
29
Inside `index.html`, you can use it like this:
30
30
31
31
```html
32
-
<linkrel="icon"href="%PUBLIC_URL%/favicon.ico">
32
+
<linkrel="icon"href="%PUBLIC_URL%/favicon.ico" />
33
33
```
34
34
35
35
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.
Copy file name to clipboardexpand all lines: packages/react-scripts/fixtures/kitchensink/README.md
+7-7
Original file line number
Diff line number
Diff line change
@@ -4,11 +4,11 @@ This is an end to end kitchensink test suite, but has multiple usages in it.
4
4
5
5
## Running the test suite
6
6
7
-
Tests are automatically run by the CI tools.
7
+
Tests are automatically run by the CI tools.
8
8
In order to run them locally, without having to manually install and configure everything, the `yarn e2e:docker` CLI command can be used.
9
9
10
-
This is a simple script that runs a **Docker** container, where the node version, git branch to clone, test suite, and whether to run it with `yarn` or `npm` can be chosen.
11
-
Simply run`yarn e2e:docker --help` to get additional info.
10
+
This is a script that runs a **Docker** container, where the node version, git branch to clone, test suite, and whether to run it with `yarn` or `npm` can be chosen.
11
+
Run`yarn e2e:docker --help` to get additional info.
12
12
13
13
If you need guidance installing **Docker**, you should follow their [official docs](https://docs.docker.com/engine/installation/).
14
14
@@ -28,20 +28,20 @@ Features are categorized by their scope:
28
28
29
29
In it's most basic for this serve as a collection of unit tests on a single functionality.
30
30
31
-
Unit tests are written in a `src/features/**/*.test.js` file located in the same folder as the feature they test, and usually consist of a simple `ReactDOM.render` call.
31
+
Unit tests are written in a `src/features/**/*.test.js` file located in the same folder as the feature they test, and usually consist of a `ReactDOM.render` call.
32
32
33
33
These tests are run by **jest** and the environment is `test`, so that it resembles how a **Create React App** application is tested.
34
34
35
35
### Using it as Integration Tests
36
36
37
-
This suite tests how the single features as before behave while development and in production.
37
+
This suite tests how the single features as before behave while development and in production.
38
38
A local HTTP server is started, then every single feature is loaded, one by one, to be tested.
39
39
40
40
Test are written in `integration/{env|syntax|webpack}.test.js`, depending on their scope.
41
41
42
-
For every test case added there is just a little chore to do:
42
+
For every test case added there is only a little chore to do:
43
43
44
-
- a `case` statement must be added in `src/App.js`, which simply perform a dynamic `import()` of the feature
44
+
- a `case` statement must be added in `src/App.js`, which performs a dynamic `import()` of the feature
45
45
46
46
- add a test case in the appropriate integration test file, which calls and awaits `initDOM` with the previous `SwitchCase` string
0 commit comments