Skip to content

Commit d27ff4b

Browse files
authored
Merge branch 'master' into testing-custom-templates
2 parents 4235790 + 720d90b commit d27ff4b

File tree

41 files changed

+2961
-2565
lines changed

Some content is hidden

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

41 files changed

+2961
-2565
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ null ?? 'some other default'; // result: 'some other default'
3535
false ?? true; // result: false
3636
```
3737

38-
**If your're using TypeScript, you will need to upgrade your `typescript` dependency to `3.7.0` or later if you wish to use the new operators.**
38+
**If you're using TypeScript, you will need to upgrade your `typescript` dependency to `3.7.0` or later if you wish to use the new operators.**
3939

4040
**If you're using Visual Studio Code 1.40 (the latest as of this release) or earlier, you will need to configure your editor if you want it to understand the new operators.**
4141

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ npx create-react-app my-app
1616
cd my-app
1717
npm start
1818
```
19+
If you've previously installed `create-react-app` globally via `npm install -g create-react-app`, we recommend you uninstall the package using `npm uninstall -g create-react-app` to ensure that npx always uses the latest version.
1920

2021
_([npx](https://medium.com/@maybekatz/introducing-npx-an-npm-package-runner-55f7d4bd282b) comes with npm 5.2+ and higher, see [instructions for older npm versions](https://gist.github.com/gaearon/4064d3c23a77c74a3614c498a8bb1c5f))_
2122

@@ -61,7 +62,7 @@ _`npm init <initializer>` is available in npm 6+_
6162
yarn create react-app my-app
6263
```
6364

64-
_`yarn create` is available in Yarn 0.25+_
65+
_[`yarn create <starter-kit-package>`](https://yarnpkg.com/lang/en/docs/cli/create/) is available in Yarn 0.25+_
6566

6667
It will create a directory called `my-app` inside the current folder.<br>
6768
Inside that directory, it will generate the initial project structure and install the transitive dependencies:
@@ -196,6 +197,8 @@ We'd love to have your helping hand on `create-react-app`! See [CONTRIBUTING.md]
196197
This project exists thanks to all the people who [contribute](CONTRIBUTING.md).<br>
197198
<a href="https://github.com/facebook/create-react-app/graphs/contributors"><img src="https://opencollective.com/create-react-app/contributors.svg?width=890&button=false" /></a>
198199

200+
Thanks to [Netlify](https://www.netlify.com/) for hosting our documentation.
201+
199202
## Acknowledgements
200203

201204
We are grateful to the authors of existing related projects for their ideas and collaboration:

docusaurus/docs/custom-templates.md

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ Custom Templates enable you to select a template to create your project from, wh
99

1010
You'll notice that Custom Templates are always named in the format `cra-template-[template-name]`, however you only need to provide the `[template-name]` to the creation command.
1111

12+
Scoped templates are also supported, under the name `@[scope-name]/cra-template` or `@[scope-name]/cra-template-[template-name]`, which can be installed via `@[scope]` and `@[scope]/[template-name]` respectively.
13+
1214
```sh
1315
npx create-react-app my-app --template [template-name]
1416
```
@@ -58,18 +60,31 @@ You can add whatever files you want in here, but you must have at least the file
5860

5961
### The `template.json` file
6062

61-
This is where you can define dependencies (only dependencies are supported for now), as well as any custom scripts that your template relies on.
63+
This is the configuration file for your template. As this is a new feature, more options will be added over time. For now, only a `package` key is supported.
64+
65+
The `package` key lets you provide any keys/values that you want added to the new project's `package.json`, such as dependencies (only dependencies are supported for now) and any custom scripts that your template relies on.
66+
67+
Below is an example `template.json` file:
6268

6369
```json
6470
{
65-
"dependencies": {
66-
"serve": "^11.2.0"
67-
},
68-
"scripts": {
69-
"serve": "serve -s build",
70-
"build-and-serve": "npm run build && npm run serve"
71+
"package": {
72+
"dependencies": {
73+
"eslint-plugin-jsx-a11y": "^6.2.3",
74+
"serve": "^11.2.0"
75+
},
76+
"scripts": {
77+
"serve": "serve -s build",
78+
"build-and-serve": "npm run build && npm run serve"
79+
},
80+
"eslintConfig": {
81+
"extends": ["react-app", "plugin:jsx-a11y/recommended"],
82+
"plugins": ["jsx-a11y"]
83+
}
7184
}
7285
}
7386
```
7487

88+
Any values you add for `"dependencies"` and `"scripts"` will be merged with the Create React App defaults. Values for any other keys will be used as-is, replacing any matching Create React App defaults.
89+
7590
For convenience, we always replace `npm run` with `yarn` in your custom `"scripts"`, as well as in your `README` when projects are initialized with yarn.

docusaurus/docs/getting-started.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ The page will automatically reload if you make changes to the code. You will see
147147

148148
Runs the test watcher in an interactive mode. By default, runs tests related to files changed since the last commit.
149149

150-
[Read more about testing](https://facebook.github.io/create-react-app/docs/running-tests).
150+
[Read more about testing](running-tests.md).
151151

152152
### `npm run build` or `yarn build`
153153

docusaurus/docs/making-a-progressive-web-app.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ the build process will generate a service worker file, but it will not be
1010
registered, so it will not take control of your production web app.
1111

1212
In order to opt-in to the offline-first behavior, developers should look for the
13-
following in their [`src/index.js`](https://github.com/facebook/create-react-app/blob/master/packages/react-scripts/template/src/index.js) file:
13+
following in their [`src/index.js`](https://github.com/facebook/create-react-app/blob/master/packages/cra-template/template/src/index.js) file:
1414

1515
```js
1616
// If you want your app to work offline and load faster, you can change
@@ -62,7 +62,7 @@ following into account:
6262
fetched the latest updates that will be available the next time they load the
6363
page (showing a "New content is available once existing tabs are closed." message). Showing
6464
these messages is currently left as an exercise to the developer, but as a
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
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/cra-template/template/src/serviceWorker.js), which
6666
demonstrates which service worker lifecycle events to listen for to detect each
6767
scenario, and which as a default, only logs appropriate messages to the
6868
JavaScript console.
@@ -93,11 +93,11 @@ following into account:
9393
## Progressive Web App Metadata
9494

9595
The default configuration includes a web app manifest located at
96-
[`public/manifest.json`](https://github.com/facebook/create-react-app/blob/master/packages/react-scripts/template/public/manifest.json), that you can customize with
96+
[`public/manifest.json`](https://github.com/facebook/create-react-app/blob/master/packages/cra-template/template/public/manifest.json), that you can customize with
9797
details specific to your web application.
9898

9999
When a user adds a web app to their homescreen using Chrome or Firefox on
100-
Android, the metadata in [`manifest.json`](https://github.com/facebook/create-react-app/blob/master/packages/react-scripts/template/public/manifest.json) determines what
100+
Android, the metadata in [`manifest.json`](https://github.com/facebook/create-react-app/blob/master/packages/cra-template/template/public/manifest.json) determines what
101101
icons, names, and branding colors to use when the web app is displayed.
102102
[The Web App Manifest guide](https://developers.google.com/web/fundamentals/engage-and-retain/web-app-manifest/)
103103
provides more context about what each field means, and how your customizations

docusaurus/docs/supported-browsers-features.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,6 @@ Here is an example `browserslist` that is specified in `package.json`:
5050
}
5151
```
5252

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.
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 you are supporting.
5454
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.
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`. A quick solution is to delete the `node_modules/.cache` folder and try again.

docusaurus/website/docusaurus.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const siteConfig = {
2121
path: '../docs',
2222
sidebarPath: require.resolve('./sidebars.json'),
2323
editUrl:
24-
'https://github.com/facebook/create-react-app/edit/master/docusaurus/docs/',
24+
'https://github.com/facebook/create-react-app/edit/master/docusaurus/website',
2525
showLastUpdateAuthor: true,
2626
showLastUpdateTime: true,
2727
},

docusaurus/website/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66
"deploy": "docusaurus deploy"
77
},
88
"dependencies": {
9-
"@docusaurus/core": "^2.0.0-alpha.30",
10-
"@docusaurus/preset-classic": "^2.0.0-alpha.30",
9+
"@docusaurus/core": "^2.0.0-alpha.39",
10+
"@docusaurus/preset-classic": "^2.0.0-alpha.39",
1111
"classnames": "^2.2.6",
12-
"react": "^16.11.0",
13-
"react-dom": "^16.11.0"
12+
"react": "^16.12.0",
13+
"react-dom": "^16.12.0"
1414
},
1515
"browserslist": {
1616
"production": [

docusaurus/website/src/css/custom.css

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,22 @@
77
--ifm-color-primary-lighter: rgb(83, 224, 197);
88
--ifm-color-primary-lightest: rgb(132, 233, 214);
99
}
10+
11+
@media screen and (max-width: 996px) {
12+
:root {
13+
--ifm-font-size-base: 15px;
14+
}
15+
}
16+
17+
@media screen and (min-width: 997px) {
18+
:root {
19+
--ifm-font-size-base: 17px;
20+
}
21+
}
22+
23+
.docusaurus-highlight-code-line {
24+
background-color: rgb(72, 77, 91);
25+
display: block;
26+
margin: 0 calc(-1 * var(--ifm-pre-padding));
27+
padding: 0 var(--ifm-pre-padding);
28+
}

0 commit comments

Comments
 (0)