Skip to content

Commit 9243305

Browse files
endilieyiansu
authored andcommitted
Upgrade to docusaurus 2 (facebook#7785)
* chore: upgrade to docusaurus 2 * address review
1 parent 81c48dc commit 9243305

27 files changed

+6314
-3568
lines changed

docusaurus/docs/adding-bootstrap.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ import 'bootstrap/dist/css/bootstrap.css';
2929

3030
> Note: this feature is available with `react-scripts@2.0.0` and higher.
3131
32-
Sometimes you might need to tweak the visual styles of Bootstrap (or equivalent package).<br>
32+
Sometimes you might need to tweak the visual styles of Bootstrap (or equivalent package).
33+
3334
As of `react-scripts@2.0.0` you can import `.scss` files. This makes it possible to use a package's built-in Sass variables for global style preferences.
3435

3536
To enable `scss` in Create React App you will need to install `node-sass`.

docusaurus/docs/adding-custom-environment-variables.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,8 @@ Files on the left have more priority than files on the right:
136136
- `npm run build`: `.env.production.local`, `.env.production`, `.env.local`, `.env`
137137
- `npm test`: `.env.test.local`, `.env.test`, `.env` (note `.env.local` is missing)
138138

139-
These variables will act as the defaults if the machine does not explicitly set them.<br>
139+
These variables will act as the defaults if the machine does not explicitly set them.
140+
140141
Please refer to the [dotenv documentation](https://github.com/motdotla/dotenv) for more details.
141142

142143
> Note: If you are defining environment variables for development, your CI and/or hosting platform will most likely need

docusaurus/docs/adding-images-fonts-and-files.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ Webpack finds all relative module references in CSS (they start with `./`) and r
3939

4040
Please be advised that this is also a custom feature of Webpack.
4141

42-
**It is not required for React** but many people enjoy it (and React Native uses a similar mechanism for images).<br>
42+
**It is not required for React** but many people enjoy it (and React Native uses a similar mechanism for images).
43+
4344
An alternative way of handling static assets is described in the next section.
4445

4546
## Adding SVGs

docusaurus/docs/can-i-use-decorators.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,15 @@ id: can-i-use-decorators
33
title: Can I Use Decorators?
44
---
55

6-
Some popular libraries use [decorators](https://medium.com/google-developers/exploring-es7-decorators-76ecb65fb841) in their documentation.<br>
6+
Some popular libraries use [decorators](https://medium.com/google-developers/exploring-es7-decorators-76ecb65fb841) in their documentation.
7+
78
Create React App intentionally doesn’t support decorator syntax at the moment because:
89

910
- It is an experimental proposal and is subject to change (in fact, it has already changed once, and will change again).
1011
- Most libraries currently support only the old version of the proposal — which will never be a standard.
1112

12-
However in many cases you can rewrite decorator-based code without decorators just as fine.<br>
13+
However in many cases you can rewrite decorator-based code without decorators just as fine.
14+
1315
Please refer to these two threads for reference:
1416

1517
- [#214](https://github.com/facebook/create-react-app/issues/214)

docusaurus/docs/deployment.md

+9-7
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,8 @@ When users install your app to the homescreen of their device the default config
100100

101101
## Building for Relative Paths
102102

103-
By default, Create React App produces a build assuming your app is hosted at the server root.<br>
103+
By default, Create React App produces a build assuming your app is hosted at the server root.
104+
104105
To override this, specify the `homepage` in your `package.json`, for example:
105106

106107
```js
@@ -109,10 +110,10 @@ To override this, specify the `homepage` in your `package.json`, for example:
109110

110111
This will let Create React App correctly infer the root path to use in the generated HTML file.
111112

112-
**Note**: If you are using `react-router@^4`, you can root `<Link>`s using the `basename` prop on any `<Router>`.<br>
113-
More information [here](https://reacttraining.com/react-router/web/api/BrowserRouter/basename-string).<br>
113+
**Note**: If you are using `react-router@^4`, you can root `<Link>`s using the `basename` prop on any `<Router>`.
114+
115+
More information [here](https://reacttraining.com/react-router/web/api/BrowserRouter/basename-string).
114116

115-
<br>
116117
For example:
117118

118119
```js
@@ -256,7 +257,7 @@ For more information see [Firebase Hosting](https://firebase.google.com/docs/hos
256257
257258
### Step 1: Add `homepage` to `package.json`
258259
259-
**The step below is important!**<br>
260+
**The step below is important!**<br/>
260261
261262
**If you skip it, your app will not deploy correctly.**
262263
@@ -332,7 +333,7 @@ npm run deploy
332333
333334
Finally, make sure **GitHub Pages** option in your GitHub project settings is set to use the `gh-pages` branch:
334335
335-
<img src="https://i.imgur.com/HUjEr9l.png" width="500" alt="gh-pages branch setting">
336+
<img src="https://i.imgur.com/HUjEr9l.png" width="500" alt="gh-pages branch setting" />
336337
337338
### Step 5: Optionally, configure the domain
338339
@@ -371,7 +372,8 @@ If, when deploying, you get `Cannot read property 'email' of null`, try the foll
371372
372373
## [Heroku](https://www.heroku.com/)
373374
374-
Use the [Heroku Buildpack for Create React App](https://github.com/mars/create-react-app-buildpack).<br>
375+
Use the [Heroku Buildpack for Create React App](https://github.com/mars/create-react-app-buildpack).
376+
375377
You can find instructions in [Deploying React with Zero Configuration](https://blog.heroku.com/deploying-react-with-zero-configuration).
376378
377379
### Resolving Heroku Deployment Errors

docusaurus/docs/getting-started.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Then open [http://localhost:3000/](http://localhost:3000/) to see your app.
2323
When you’re ready to deploy to production, create a minified bundle with `npm run build`.
2424

2525
<p align='center'>
26-
<img src='https://cdn.rawgit.com/facebook/create-react-app/27b42ac/screencast.svg' width='600' alt='npm start'>
26+
<img src='https://cdn.rawgit.com/facebook/create-react-app/27b42ac/screencast.svg' width='600' alt='npm start' />
2727
</p>
2828

2929
### Get Started Immediately
@@ -115,7 +115,7 @@ Runs the app in development mode. Open [http://localhost:3000](http://localhost:
115115
The page will automatically reload if you make changes to the code. You will see the build errors and lint warnings in the console.
116116

117117
<p align='center'>
118-
<img src='https://cdn.rawgit.com/marionebl/create-react-app/9f62826/screencast-error.svg' width='600' alt='Build errors'>
118+
<img src='https://cdn.rawgit.com/marionebl/create-react-app/9f62826/screencast-error.svg' width='600' alt='Build errors' />
119119
</p>
120120

121121
### `npm test` or `yarn test`

docusaurus/docs/importing-a-component.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ id: importing-a-component
33
title: Importing a Component
44
---
55

6-
This project setup supports ES6 modules thanks to Webpack.<br>
6+
This project setup supports ES6 modules thanks to Webpack.
7+
78
While you can still use `require()` and `module.exports`, we encourage you to use [`import` and `export`](http://exploringjs.com/es6/ch_modules.html) instead.
89

910
For example:

docusaurus/docs/post-processing-css.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -39,5 +39,6 @@ becomes this:
3939
If you need to disable autoprefixing for some reason, [follow this section](https://github.com/postcss/autoprefixer#disabling).
4040

4141
[CSS Grid Layout](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Grid_Layout) prefixing is disabled by default, but it will **not** strip manual prefixing.
42-
If you'd like to opt-in to CSS Grid prefixing, [first familiarize yourself about its limitations](https://github.com/postcss/autoprefixer#does-autoprefixer-polyfill-grid-layout-for-ie).<br>
42+
If you'd like to opt-in to CSS Grid prefixing, [first familiarize yourself about its limitations](https://github.com/postcss/autoprefixer#does-autoprefixer-polyfill-grid-layout-for-ie).
43+
4344
To enable CSS Grid prefixing, add `/* autoprefixer grid: autoplace */` to the top of your CSS file.

docusaurus/docs/proxying-api-requests-in-development.md

+11-6
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ sidebar_label: Proxying in Development
66

77
> Note: this feature is available with `react-scripts@0.2.3` and higher.
88
9-
People often serve the front-end React app from the same host and port as their backend implementation.<br>
9+
People often serve the front-end React app from the same host and port as their backend implementation.
10+
1011
For example, a production setup might look like this after the app is deployed:
1112

1213
/ - static server returns index.html with React app
@@ -31,7 +32,8 @@ Fetch API cannot load http://localhost:4000/api/todos. No 'Access-Control-Allow-
3132

3233
Keep in mind that `proxy` only has effect in development (with `npm start`), and it is up to you to ensure that URLs like `/api/todos` point to the right thing in production. You don’t have to use the `/api` prefix. Any unrecognized request without a `text/html` accept header will be redirected to the specified `proxy`.
3334

34-
The `proxy` option supports HTTP, HTTPS and WebSocket connections.<br>
35+
The `proxy` option supports HTTP, HTTPS and WebSocket connections.
36+
3537
If the `proxy` option is **not** flexible enough for you, alternatively you can:
3638

3739
- [Configure the proxy yourself](#configuring-the-proxy-manually)
@@ -96,10 +98,13 @@ You can now register proxies as you wish! Here's an example using the above `htt
9698
const proxy = require('http-proxy-middleware');
9799

98100
module.exports = function(app) {
99-
app.use('/api', proxy({
100-
target: 'http://localhost:5000',
101-
changeOrigin: true,
102-
}));
101+
app.use(
102+
'/api',
103+
proxy({
104+
target: 'http://localhost:5000',
105+
changeOrigin: true,
106+
})
107+
);
103108
};
104109
```
105110

docusaurus/docs/running-tests.md

+9-5
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ id: running-tests
33
title: Running Tests
44
---
55

6-
> Note: this feature is available with `react-scripts@0.3.0` and higher.<br>
6+
> Note: this feature is available with `react-scripts@0.3.0` and higher.
77
88
> [Read the migration guide to learn how to enable it in older projects!](https://github.com/facebook/create-react-app/blob/master/CHANGELOG-0.x.md#migrating-from-023-to-030)
99
@@ -60,7 +60,8 @@ it('sums numbers', () => {
6060
});
6161
```
6262

63-
All `expect()` matchers supported by Jest are [extensively documented here](https://jestjs.io/docs/en/expect.html#content).<br>
63+
All `expect()` matchers supported by Jest are [extensively documented here](https://jestjs.io/docs/en/expect.html#content).
64+
6465
You can also use [`jest.fn()` and `expect(fn).toBeCalled()`](https://jestjs.io/docs/en/expect.html#tohavebeencalled) to create “spies” or mock functions.
6566

6667
## Testing Components
@@ -144,7 +145,8 @@ it('renders welcome message', () => {
144145
});
145146
```
146147

147-
All Jest matchers are [extensively documented here](https://jestjs.io/docs/en/expect.html).<br>
148+
All Jest matchers are [extensively documented here](https://jestjs.io/docs/en/expect.html).
149+
148150
Nevertheless you can use a third-party assertion library like [Chai](https://chaijs.com/) if you want to, as described below.
149151

150152
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.
@@ -254,12 +256,14 @@ global.localStorage = localStorageMock;
254256
255257
## Focusing and Excluding Tests
256258
257-
You can replace `it()` with `xit()` to temporarily exclude a test from being executed.<br>
259+
You can replace `it()` with `xit()` to temporarily exclude a test from being executed.
260+
258261
Similarly, `fit()` lets you focus on a specific test without running any other tests.
259262
260263
## Coverage Reporting
261264
262-
Jest has an integrated coverage reporter that works well with ES6 and requires no configuration.<br>
265+
Jest has an integrated coverage reporter that works well with ES6 and requires no configuration.
266+
263267
Run `npm test -- --coverage` (note extra `--` in the middle) to include a coverage report like this:
264268
265269
![coverage report](https://i.imgur.com/5bFhnTS.png)

docusaurus/docs/setting-up-your-editor.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,10 @@ To configure the syntax highlighting in your favorite text editor, head to the [
1212

1313
## Displaying Lint Output in the Editor
1414

15-
> Note: this feature is available with `react-scripts@0.2.0` and higher.<br>
16-
> It works out of the box for newly created projects with `react-scripts@2.0.3` and higher.<br>
15+
> Note: this feature is available with `react-scripts@0.2.0` and higher.
16+
17+
> It works out of the box for newly created projects with `react-scripts@2.0.3` and higher.
18+
1719
> It also only works with npm 3 or higher.
1820
1921
Some editors, including Sublime Text, Atom, and Visual Studio Code, provide plugins for ESLint.

docusaurus/docs/troubleshooting.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ sidebar_label: Troubleshooting
66

77
## `npm start` doesn’t detect changes
88

9-
When you save a file while `npm start` is running, the browser should refresh with the updated code.<br>
9+
When you save a file while `npm start` is running, the browser should refresh with the updated code.
10+
1011
If this doesn’t happen, try one of the following workarounds:
1112

1213
- Check that your file is imported by your entrypoint. TypeScript will show errors on any of your source files, but webpack only reloads your files if they are directly or indirectly imported by one of your entrypoints.
@@ -60,7 +61,8 @@ Please refer to [this section](deployment.md#resolving-heroku-deployment-errors)
6061

6162
If you use a [Moment.js](https://momentjs.com/), you might notice that only the English locale is available by default. This is because the locale files are large, and you probably only need a subset of [all the locales provided by Moment.js](https://momentjs.com/#multiple-locale-support).
6263

63-
To add a specific Moment.js locale to your bundle, you need to import it explicitly.<br>
64+
To add a specific Moment.js locale to your bundle, you need to import it explicitly.
65+
6466
For example:
6567

6668
```js

docusaurus/website/.gitignore

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# dependencies
2+
/node_modules
3+
4+
# production
5+
/build
6+
7+
# generated files
8+
.docusaurus
9+
.cache-loader
10+
11+
# misc
12+
.DS_Store
13+
.env.local
14+
.env.development.local
15+
.env.test.local
16+
.env.production.local
17+
18+
npm-debug.log*
19+
yarn-debug.log*
20+
yarn-error.log*

0 commit comments

Comments
 (0)