Skip to content

Commit a465fa8

Browse files
authored
Merge pull request #315 from facebook/main
merging upstream master
2 parents b4ffc8f + 9673858 commit a465fa8

File tree

123 files changed

+47031
-22933
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

123 files changed

+47031
-22933
lines changed

.eslintrc.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
"browser": true,
55
"commonjs": true,
66
"node": true,
7-
"es6": true
7+
"es6": true,
8+
"jest": true
89
},
910
"parserOptions": {
1011
"ecmaVersion": 2018

.github/CODEOWNERS

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
packages/ @ianschmitz @iansu @mrmckeb @petetnt
2-
docusaurus/ @ianschmitz @iansu @mrmckeb
1+
packages/ @iansu @mrmckeb
2+
docusaurus/ @iansu @mrmckeb

.github/ISSUE_TEMPLATE/bug_report.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ labels: 'issue: bug report, needs triage'
3232
* yarn.lock
3333
3434
Then you need to decide which package manager you prefer to use.
35-
We support both npm (https://npmjs.com) and yarn (http://yarnpkg.com/).
35+
We support both npm (https://npmjs.com) and yarn (https://yarnpkg.com/).
3636
However, **they can't be used together in one project** so you need to pick one.
3737
3838
If you decided to use npm, run this in your project directory:

.github/workflows/build.yml

+9-3
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,14 @@ jobs:
66
build:
77
runs-on: ubuntu-latest
88
steps:
9-
- uses: actions/checkout@v1
9+
- uses: actions/checkout@v2
10+
- uses: actions/setup-node@v2
11+
with:
12+
node-version: '14'
13+
cache: 'npm'
14+
- name: Install npm@8
15+
run: npm i -g npm@8
1016
- name: Install
11-
run: yarn --no-progress --non-interactive --no-lockfile
17+
run: npm ci --prefer-offline
1218
- name: Build
13-
run: yarn build
19+
run: npm run build

.github/workflows/integration.yml

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Integration Tests
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
jobs:
12+
job:
13+
runs-on: ${{ matrix.os }}
14+
strategy:
15+
matrix:
16+
os: ['ubuntu-latest', 'macos-latest', 'windows-latest']
17+
node: ['14', '16']
18+
steps:
19+
- uses: actions/checkout@v2
20+
- name: Setup node
21+
uses: actions/setup-node@v2
22+
with:
23+
node-version: ${{ matrix.node }}
24+
cache: 'npm'
25+
- name: Install npm@8
26+
run: npm i -g npm@8
27+
- name: Install yarn
28+
run: npm i -g yarn
29+
- name: Install packages
30+
run: npm ci --prefer-offline
31+
- name: Run integration tests
32+
run: npm run test:integration

.github/workflows/lint.yml

+9-3
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,14 @@ jobs:
66
lint:
77
runs-on: ubuntu-latest
88
steps:
9-
- uses: actions/checkout@v1
9+
- uses: actions/checkout@v2
10+
- uses: actions/setup-node@v2
11+
with:
12+
node-version: '14'
13+
cache: 'npm'
14+
- name: Install npm@8
15+
run: npm i -g npm@8
1016
- name: Install
11-
run: yarn --no-progress --non-interactive --no-lockfile
17+
run: npm ci --prefer-offline
1218
- name: Alex
13-
run: yarn alex
19+
run: npm run alex

.gitignore

-1
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,3 @@ yarn-debug.log*
1212
yarn-error.log*
1313
/.changelog
1414
.npm/
15-
yarn.lock

CHANGELOG-0.x.md

+19-19
Large diffs are not rendered by default.

CHANGELOG-1.x.md

+4-6
Original file line numberDiff line numberDiff line change
@@ -1365,7 +1365,7 @@ or
13651365
yarn add --dev --exact [email protected]
13661366
```
13671367

1368-
If you previously had issues with an `Invalid Host Header` error, [follow these new instructions](https://github.com/facebook/create-react-app/blob/master/packages/react-scripts/template/README.md#invalid-host-header-errors-after-configuring-proxy) to fix it.
1368+
If you previously had issues with an `Invalid Host Header` error, [follow these new instructions](https://github.com/facebook/create-react-app/blob/main/packages/react-scripts/template/README.md#invalid-host-header-errors-after-configuring-proxy) to fix it.
13691369

13701370
## 1.0.1 (May 19, 2017)
13711371

@@ -1547,7 +1547,7 @@ You can automatically convert your project to fix them by running the [correspon
15471547

15481548
#### How do I make my tests work with Jest 20?
15491549

1550-
Please refer to the [Jest 19](https://facebook.github.io/jest/blog/2017/02/21/jest-19-immersive-watch-mode-test-platform-improvements.html#breaking-changes) and [Jest 20](http://facebook.github.io/jest/blog/2017/05/06/jest-20-delightful-testing-multi-project-runner.html#breaking-changes) breaking changes for migration instructions.
1550+
Please refer to the [Jest 19](https://facebook.github.io/jest/blog/2017/02/21/jest-19-immersive-watch-mode-test-platform-improvements.html#breaking-changes) and [Jest 20](https://facebook.github.io/jest/blog/2017/05/06/jest-20-delightful-testing-multi-project-runner.html#breaking-changes) breaking changes for migration instructions.
15511551

15521552
If you use snapshots, you will likely need to update them once because of the change in format.
15531553

@@ -1572,7 +1572,7 @@ If you still have the problem please file an issue.
15721572

15731573
Unhandled Promise rejections will now crash tests. You can fix them by explicitly catching the errors you don???t care about.
15741574

1575-
#### How to turn my app into a [Progressive Web App](https://github.com/facebook/create-react-app/blob/master/packages/react-scripts/template/README.md#making-a-progressive-web-app)?
1575+
#### How to turn my app into a [Progressive Web App](https://github.com/facebook/create-react-app/blob/main/packages/react-scripts/template/README.md#making-a-progressive-web-app)?
15761576

15771577
After the regular update procedure above, add these line to `<head>` in `public/index.html`:
15781578

@@ -1588,9 +1588,7 @@ After the regular update procedure above, add these line to `<head>` in `public/
15881588
Add `<noscript>` to `<body>` in `public/index.html`:
15891589

15901590
```html
1591-
<noscript>
1592-
You need to enable JavaScript to run this app.
1593-
</noscript>
1591+
<noscript> You need to enable JavaScript to run this app. </noscript>
15941592
```
15951593

15961594
Then create a file called `public/manifest.json` that looks like this:

CHANGELOG-2.x.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -823,7 +823,7 @@ import 'react-app-polyfill/ie9'; // For IE 9-11 support
823823
import 'react-app-polyfill/ie11'; // For IE 11 support
824824
```
825825

826-
You can read more about [these polyfills here](https://github.com/facebook/create-react-app/tree/master/packages/react-app-polyfill).
826+
You can read more about [these polyfills here](https://github.com/facebook/create-react-app/tree/main/packages/react-app-polyfill).
827827

828828
### Dynamic `import()` of a CommonJS module now has a `.default` property
829829

@@ -845,7 +845,7 @@ We previously allowed code splitting with a webpack-specific directive, `require
845845
**Single Module**
846846

847847
```js
848-
require.ensure(['module-a'], function() {
848+
require.ensure(['module-a'], function () {
849849
var a = require('module-a');
850850
// ...
851851
});
@@ -859,7 +859,7 @@ import('module-a').then(a => {
859859
**Multiple Module**
860860

861861
```js
862-
require.ensure(['module-a', 'module-b'], function() {
862+
require.ensure(['module-a', 'module-b'], function () {
863863
var a = require('module-a');
864864
var b = require('module-b');
865865
// ...
@@ -913,7 +913,7 @@ Next, create `src/setupProxy.js` and place the following contents in it:
913913
```js
914914
const proxy = require('http-proxy-middleware');
915915

916-
module.exports = function(app) {
916+
module.exports = function (app) {
917917
// ...
918918
};
919919
```
@@ -936,7 +936,7 @@ Place entries into `src/setupProxy.js` like so:
936936
```js
937937
const proxy = require('http-proxy-middleware');
938938

939-
module.exports = function(app) {
939+
module.exports = function (app) {
940940
app.use(proxy('/api', { target: 'http://localhost:5000/' }));
941941
app.use(proxy('/*.svg', { target: 'http://localhost:5000/' }));
942942
};

CHANGELOG-3.x.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ v3.3.0 is a minor release that adds new features, including custom templates and
330330

331331
You can now create a new app using custom templates.
332332

333-
We've published our existing templates as [`cra-template`](https://github.com/facebook/create-react-app/tree/master/packages/cra-template) and [`cra-template-typescript`](https://github.com/facebook/create-react-app/tree/master/packages/cra-template-typescript), but we expect to see many great templates from the community over the coming weeks.
333+
We've published our existing templates as [`cra-template`](https://github.com/facebook/create-react-app/tree/main/packages/cra-template) and [`cra-template-typescript`](https://github.com/facebook/create-react-app/tree/main/packages/cra-template-typescript), but we expect to see many great templates from the community over the coming weeks.
334334

335335
The below command shows how you can create a new app with `cra-template-typescript`.
336336

CONTRIBUTING.md

+25-16
Original file line numberDiff line numberDiff line change
@@ -48,66 +48,74 @@ Please also provide a **test plan**, i.e. specify how you verified that your add
4848
## Folder Structure of Create React App
4949

5050
`create-react-app` is a monorepo, meaning it is divided into independent sub-packages.<br>
51-
These packages can be found in the [`packages/`](https://github.com/facebook/create-react-app/tree/master/packages) directory.
51+
These packages can be found in the [`packages/`](https://github.com/facebook/create-react-app/tree/main/packages) directory.
5252

5353
### Overview of directory structure
5454

5555
```
5656
packages/
57+
babel-plugin-named-asset-import/
5758
babel-preset-react-app/
59+
confusing-browser-globals/
60+
cra-template/
61+
cra-template-typescript/
5862
create-react-app/
5963
eslint-config-react-app/
64+
react-app-polyfill/
6065
react-dev-utils/
66+
react-error-overlay/
6167
react-scripts/
6268
```
6369

6470
### Package Descriptions
6571

66-
#### [babel-preset-react-app](https://github.com/facebook/create-react-app/tree/master/packages/babel-preset-react-app)
72+
#### [babel-preset-react-app](https://github.com/facebook/create-react-app/tree/main/packages/babel-preset-react-app)
6773

6874
This package is a babel preset intended to be used with `react-scripts`.<br>
6975
It targets platforms that React is designed to support (IE 11+) and enables experimental features used heavily at Facebook.<br>
7076
This package is enabled by default for all `create-react-app` scaffolded applications.
7177

72-
#### [create-react-app](https://github.com/facebook/create-react-app/tree/master/packages/create-react-app)
78+
#### [create-react-app](https://github.com/facebook/create-react-app/tree/main/packages/create-react-app)
7379

7480
The global CLI command code can be found in this directory, and shouldn't often be changed. It should run on Node 0.10+.
7581

76-
#### [eslint-config-react-app](https://github.com/facebook/create-react-app/tree/master/packages/eslint-config-react-app)
82+
#### [eslint-config-react-app](https://github.com/facebook/create-react-app/tree/main/packages/eslint-config-react-app)
7783

7884
This package contains a conservative set of rules focused on making errors apparent and enforces no style rules.<br>
7985
This package is enabled by default for all `create-react-app` scaffolded applications.
8086

81-
#### [react-dev-utils](https://github.com/facebook/create-react-app/tree/master/packages/react-dev-utils)
87+
#### [react-dev-utils](https://github.com/facebook/create-react-app/tree/main/packages/react-dev-utils)
8288

8389
This package contains utilities used for `react-scripts` and sibling packages.<br>
8490
Its main purpose is to conceal code which the user shouldn't be burdened with upon ejecting.
8591

86-
#### [react-scripts](https://github.com/facebook/create-react-app/tree/master/packages/react-scripts)
92+
#### [react-scripts](https://github.com/facebook/create-react-app/tree/main/packages/react-scripts)
8793

8894
This package is the heart of the project, which contains the scripts for setting up the development server, building production builds, configuring all software used, etc.<br>
8995
All functionality must be retained (and configuration given to the user) if they choose to eject.
9096

9197
## Setting Up a Local Copy
9298

99+
You will need `npm@7` and `yarn@1` in order to bootstrap and test a local copy of this repo.
100+
93101
1. Clone the repo with `git clone https://github.com/facebook/create-react-app`
94102

95-
2. Run `yarn` in the root `create-react-app` folder.
103+
2. Run `npm install` in the root `create-react-app` folder.
96104

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. It will serve the application from the files located in `packages/cra-template/template`.
105+
Once it is done, you can modify any file locally and run `npm start`, `npm test` or `npm run build` like you can in a generated project. It will serve the application from the files located in `packages/cra-template/template`.
98106

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

101109
```sh
102-
yarn create-react-app my-app
110+
npx create-react-app my-app
103111
cd my-app
104112
```
105113

106-
and then run `yarn start` or `yarn build`.
114+
and then run `npm start` or `npm run build`.
107115

108116
## Contributing to E2E (end to end) tests
109117

110-
**TL;DR** use the command `yarn e2e:docker` to run unit and e2e tests.
118+
**TL;DR** use the command `npm run e2e:docker` to run unit and e2e tests.
111119

112120
More detailed information are in the dedicated [README](/test/README.md).
113121

@@ -143,11 +151,11 @@ By default git would use `CRLF` line endings which would cause the scripts to fa
143151
2. Close the milestone and create a new one for the next release.
144152
3. In most releases, only `react-scripts` needs to be released. If you don’t have any changes to the `packages/create-react-app` folder, you don’t need to bump its version or publish it (the publish script will publish only changed packages).
145153
4. Note that files in `packages/create-react-app` should be modified with extreme caution. Since it’s a global CLI, any version of `create-react-app` (global CLI) including very old ones should work with the latest version of `react-scripts`.
146-
5. Run `yarn compile:lockfile`. The command will generate an updated lockfile in `packages/create-react-app` that should be committed.
154+
5. Pull the latest changes from GitHub, run `npm ci`.
147155
6. Create a change log entry for the release:
148156

149157
- You'll need an [access token for the GitHub API](https://help.github.com/articles/creating-an-access-token-for-command-line-use/). Save it to this environment variable: `export GITHUB_AUTH="..."`
150-
- Run `yarn changelog`. The command will find all the labeled pull requests merged since the last release and group them by the label and affected packages, and create a change log entry with all the changes and links to PRs and their authors. Copy and paste it to `CHANGELOG.md`.
158+
- Run `npm run changelog`. The command will find all the labeled pull requests merged since the last release and group them by the label and affected packages, and create a change log entry with all the changes and links to PRs and their authors. Copy and paste it to `CHANGELOG.md`.
151159
- Add a four-space indented paragraph after each non-trivial list item, explaining what changed and why. For each breaking change also write who it affects and instructions for migrating existing code.
152160
- 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.
153161

@@ -161,9 +169,10 @@ Make sure to test the released version! If you want to be extra careful, you can
161169
## Releasing the Docs
162170

163171
1. Go to the `docusaurus/website` directory
164-
2. Run `yarn build`
165-
3. You'll need an [access token for the GitHub API](https://help.github.com/articles/creating-an-access-token-for-command-line-use/). Save it to this environment variable: `export GITHUB_AUTH="..."`
166-
4. Run `GIT_USER=<GITHUB_USERNAME> CURRENT_BRANCH=master USE_SSH=true yarn deploy`
172+
2. Run `npm ci`
173+
3. Run `npm run build`
174+
4. You'll need an [access token for the GitHub API](https://help.github.com/articles/creating-an-access-token-for-command-line-use/). Save it to this environment variable: `export GITHUB_AUTH="..."`
175+
5. Run `GIT_USER=<GITHUB_USERNAME> CURRENT_BRANCH=main USE_SSH=true npm run deploy`
167176

168177
---
169178

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Create React App [![Build Status](https://dev.azure.com/facebook/create-react-app/_apis/build/status/facebook.create-react-app?branchName=master)](https://dev.azure.com/facebook/create-react-app/_build/latest?definitionId=1&branchName=master) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-green.svg)](https://github.com/facebook/create-react-app/blob/master/CONTRIBUTING.md)
1+
# Create React App [![Build Status](https://dev.azure.com/facebook/create-react-app/_apis/build/status/facebook.create-react-app?branchName=main)](https://dev.azure.com/facebook/create-react-app/_build/latest?definitionId=1&branchName=main) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-green.svg)](https://github.com/facebook/create-react-app/blob/main/CONTRIBUTING.md)
22

33
<img alt="Logo" align="right" src="https://create-react-app.dev/img/logo.svg" width="20%" />
44

@@ -39,7 +39,7 @@ Create a project, and you’re good to go.
3939

4040
## Creating an App
4141

42-
**You’ll need to have Node 10.16.0 or later version on your local development machine** (but it’s not required on the server). We recommend using the latest LTS version. 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.
42+
**You’ll need to have Node 14.0.0 or later version on your local development machine** (but it’s not required on the server). We recommend using the latest LTS version. 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.
4343

4444
To create a new app, you may choose one of the following methods:
4545

@@ -217,4 +217,4 @@ We are grateful to the authors of existing related projects for their ideas and
217217

218218
## License
219219

220-
Create React App is open source software [licensed as MIT](https://github.com/facebook/create-react-app/blob/master/LICENSE). The Create React App logo is licensed under a [Creative Commons Attribution 4.0 International license](https://creativecommons.org/licenses/by/4.0/).
220+
Create React App is open source software [licensed as MIT](https://github.com/facebook/create-react-app/blob/main/LICENSE). The Create React App logo is licensed under a [Creative Commons Attribution 4.0 International license](https://creativecommons.org/licenses/by/4.0/).

azure-pipelines-test-job.yml

+7-4
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ parameters:
66
name: ''
77
testScript: ''
88
configurations:
9-
LinuxNode10: { vmImage: 'ubuntu-16.04', nodeVersion: 10.x }
10-
LinuxNode12: { vmImage: 'ubuntu-16.04', nodeVersion: 12.x }
9+
LinuxNode14: { vmImage: 'ubuntu-latest', nodeVersion: 14.x }
10+
LinuxNode16: { vmImage: 'ubuntu-latest', nodeVersion: 16.x }
1111

1212
jobs:
1313
- job: ${{ parameters.name }}
@@ -31,8 +31,11 @@ jobs:
3131
versionSpec: $(nodeVersion)
3232
displayName: 'Install Node.js'
3333

34-
- script: yarn --frozen-lockfile
35-
displayName: 'Run yarn'
34+
- script: npm i -g npm@8
35+
displayName: 'Update npm to v8'
36+
37+
- script: npm ci
38+
displayName: 'Run npm ci'
3639

3740
- bash: ${{ parameters.testScript }}
3841
displayName: 'Run tests'

azure-pipelines.yml

+16-16
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#
44

55
trigger:
6-
- master
6+
- main
77

88
variables:
99
CI: true
@@ -42,25 +42,25 @@ jobs:
4242
# ******************************************************************************
4343
# Kitchensink Eject test suite
4444
# ******************************************************************************
45-
- template: azure-pipelines-test-job.yml
46-
parameters:
47-
name: KitchensinkEject
48-
testScript: tasks/e2e-kitchensink-eject.sh
45+
# - template: azure-pipelines-test-job.yml
46+
# parameters:
47+
# name: KitchensinkEject
48+
# testScript: tasks/e2e-kitchensink-eject.sh
4949

5050
# ******************************************************************************
5151
# Behavior test suite
5252
# ******************************************************************************
53-
- template: azure-pipelines-test-job.yml
54-
parameters:
55-
name: Behavior
56-
testScript: tasks/e2e-behavior.sh
57-
configurations:
58-
LinuxNode10: { vmImage: 'ubuntu-16.04', nodeVersion: 10.x }
59-
LinuxNode12: { vmImage: 'ubuntu-16.04', nodeVersion: 12.x }
60-
WindowsNode10: { vmImage: 'windows-2019', nodeVersion: 10.x }
61-
WindowsNode12: { vmImage: 'windows-2019', nodeVersion: 12.x }
62-
MacNode10: { vmImage: 'macOS-10.15', nodeVersion: 10.x }
63-
MacNode12: { vmImage: 'macOS-10.15', nodeVersion: 12.x }
53+
# - template: azure-pipelines-test-job.yml
54+
# parameters:
55+
# name: Behavior
56+
# testScript: tasks/e2e-behavior.sh
57+
# configurations:
58+
# LinuxNode14: { vmImage: 'ubuntu-latest', nodeVersion: 14.x }
59+
# LinuxNode16: { vmImage: 'ubuntu-latest', nodeVersion: 16.x }
60+
# WindowsNode14: { vmImage: 'windows-2019', nodeVersion: 14.x }
61+
# WindowsNode16: { vmImage: 'windows-2019', nodeVersion: 16.x }
62+
# MacNode14: { vmImage: 'macOS-10.15', nodeVersion: 14.x }
63+
# MacNode16: { vmImage: 'macOS-10.15', nodeVersion: 16.x }
6464

6565
# ******************************************************************************
6666
# Old Node test suite

0 commit comments

Comments
 (0)