Skip to content

Commit 46cf3fc

Browse files
authored
Update CONTRIBUTING.md
1 parent 080cacd commit 46cf3fc

File tree

1 file changed

+47
-11
lines changed

1 file changed

+47
-11
lines changed

CONTRIBUTING.md

Lines changed: 47 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,53 @@
1-
# Contributing to `create-react-app`
1+
# Contributing to Create React App
22

3-
`create-react-app` and want to get involved? Thanks! There are plenty of ways you can help!
3+
Loving Create React App and want to get involved? Thanks! There are plenty of ways you can help.
44

55
Please take a moment to review this document in order to make the contribution process easy and effective for everyone involved.
66

77
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.
88

9-
## Core ideas
9+
## Core Ideas
1010

11-
We do not want any flags or configuration, that would defeat the purpose of this tool. We want to find good defaults and actively find ways to improve the developer experience.
11+
As much as possible, we try to avoid adding configuration and flags. The purpose of this tool is to provide the best experience for people getting started with React, and this will always be our first priority. This means that sometimes we [sacrifice additional functionality](https://gettingreal.37signals.com/ch05_Half_Not_Half_Assed.php) (such as server rendering) because it is too hard to solve it in a way that wouldn’t require any configuration.
1212

13-
We try not to make any controversial choices. If the community is split between different tools, we won't just pick the least controversial or most popular, the tool itself should be agnostic between them.
13+
We prefer **convention, heuristics, or interactivity** over configuration.
14+
Here’s a few examples of how them in action.
1415

15-
*These ideas are subject to change at any time*
16+
### Convention
17+
18+
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+
20+
### Heuristics
21+
22+
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 server 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+
24+
Another example of this is how `npm test` normally launches the watcher, but if `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+
26+
### Interactivity
27+
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.
29+
30+
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+
32+
### Breaking the Rules
33+
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.
1635

1736
## Submitting a Pull Request
1837

19-
Good pull requests - patches, improvements, new features - are a fantastic help. They should remain focused in scope and avoid containing unrelated commits.
38+
Good pull requests, such as patches, improvements, and new features, are a fantastic help. They should remain focused in scope and avoid containing unrelated commits.
2039

21-
Please **ask first** if somebody else is already working on this or the core developers think your feature is in-scope for `create-react-app`. Generally always have a related issue with discussions for whatever you are including.
40+
Please **ask first** if somebody else is already working on this or the core developers think your feature is in-scope for Create React App. Generally always have a related issue with discussions for whatever you are including.
2241

23-
Please also provide a **test plan**, i.e. specify how you verified what you added works.
42+
Please also provide a **test plan**, i.e. specify how you verified that your addition works.
2443

25-
## Setting up a local copy of the repository
44+
## Setting Up a Local Copy
2645

2746
1. Clone the repo with `git clone https://github.com/facebookincubator/create-react-app`
2847

2948
2. Run `npm install` in the root `create-react-app` folder **and** the `create-react-app/global-cli` folder
3049

31-
Once it is done, you can modify any file locally and run `npm start` or `npm run build` just like in a generated project.
50+
Once it is done, you can modify any file locally and run `npm start`, `npm test` or `npm run build` just like in a generated project.
3251

3352
If you want to try out the end-to-end flow with the global CLI, you can do this too:
3453

@@ -39,4 +58,21 @@ cd my-app
3958

4059
and then run `npm start` or `npm run build`.
4160

61+
## Cutting a Release
62+
63+
1. Tag all merged PRs that go into the release with the relevant milestone.
64+
2. Close the milestone.
65+
3. In most releases, only `react-scripts` needs to be released. If you don’t have any changes to the `global-cli` folder, you don’t need to bump its version or publish it.
66+
4. Note that files in `global-cli` should be modified with extreme caution. Since it’s a global CLI, any version of `create-react-app` (global CLI) including very old ones should work with the latest version of `react-scripts`.
67+
5. Add an entry to `CHANGELOG.md` detailing what has changed with links to PRs and their authors. Use previous entries for inspiration. Group changes to `react-scripts` and `create-react-app` separately in the notes, for example like in `0.2.0` release notes.
68+
6. Make sure to include “Migrating from ...” instructions for the previous release. Often you can copy and paste them.
69+
7. After merging the changelog update, create a GitHub Release with the same text. See previous Releases for inspiration.
70+
8. If you are releasing updates to the `create-react-app` CLI (likely not), go to `global-cli`, bump the version in `package.json` and run `npm publish` in that folder.
71+
9. If you are releasing updates to `react-scripts` (most likely!), bump the version in `package.json`. **Do not run `npm publish`. Instead, run `sh tasks/release.sh`.**
72+
10. Wait for a long time, and it will get published. Don’t worry that it’s stuck. It will bundle dependencies into a single tarball before publishing for faster installs.
73+
74+
Make sure to test the released version! If you want to be extra careful, you can publish a prerelease by running `sh tasks/release.sh --tag next` instead of `sh tasks/release.sh`.
75+
76+
------------
77+
4278
*Many thanks to [h5bp](https://github.com/h5bp/html5-boilerplate/blob/master/CONTRIBUTING.md) for the inspiration with this contributing guide*

0 commit comments

Comments
 (0)