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
0 commit comments