5238 set up basic docs structure (#5245)

* Add a temporary README file

This commit adds a temporary readme file that points users to the
main README file or the User Guide.

* Add a "getting started" doc

This commit adds a page for getting started, copying the
"Get started now" from the current `README.md`.

* Add link to the get started page from the index page

* Add the getting started doc to the site header

* Add footer link to getting started info

* Add getting started to the sidebar

* Add placeholder for the user guide page

* Add links to the user-guide page as well

* Add auto-generated i18n file

* Move all docusaurus related files into own folder
This commit is contained in:
Kristofer Selbekk
2018-10-04 00:09:14 +02:00
committed by Dan Abramov
parent 2655b42c6b
commit 4bda8f7350
17 changed files with 160 additions and 24 deletions

View File

@@ -0,0 +1,3 @@
# Nothing to see here right now
Please refer to the [Readme](https://github.com/facebook/create-react-app/blob/master/README.md) or the [User Guide](https://github.com/facebook/create-react-app/blob/master/packages/react-scripts/template/README.md).

View File

@@ -0,0 +1,119 @@
---
id: getting-started
title: Getting started
sidebar_label: Getting started
---
## Quick Overview
```sh
npx create-react-app my-app
cd my-app
npm start
```
_([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))_
Then open [http://localhost:3000/](http://localhost:3000/) to see your app.<br>
When youre ready to deploy to production, create a minified bundle with `npm run build`.
<p align='center'>
<img src='https://cdn.rawgit.com/facebook/create-react-app/27b42ac/screencast.svg' width='600' alt='npm start'>
</p>
### Get Started Immediately
You **dont** need to install or configure tools like Webpack or Babel.<br>
They are preconfigured and hidden so that you can focus on the code.
Just create a project, and youre good to go.
## Creating an App
**Youll need to have Node >= 6 on your local development machine** (but its 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.
To create a new app, you may choose one of the following methods:
### npx
```sh
npx create-react-app my-app
```
_([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))_
### npm
```sh
npm init react-app my-app
```
_`npm init <initializer>` is available in npm 6+_
### Yarn
```sh
yarn create react-app my-app
```
_`yarn create` is available in Yarn 0.25+_
It will create a directory called `my-app` inside the current folder.<br>
Inside that directory, it will generate the initial project structure and install the transitive dependencies:
```
my-app
├── README.md
├── node_modules
├── package.json
├── .gitignore
├── public
│ ├── favicon.ico
│ ├── index.html
│ └── manifest.json
└── src
├── App.css
├── App.js
├── App.test.js
├── index.css
├── index.js
├── logo.svg
└── registerServiceWorker.js
```
No configuration or complicated folder structures, just the files you need to build your app.<br>
Once the installation is done, you can open your project folder:
```sh
cd my-app
```
Inside the newly created project, you can run some built-in commands:
### `npm start` or `yarn start`
Runs the app in development mode.<br>
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
The page will automatically reload if you make changes to the code.<br>
You will see the build errors and lint warnings in the console.
<p align='center'>
<img src='https://cdn.rawgit.com/marionebl/create-react-app/9f62826/screencast-error.svg' width='600' alt='Build errors'>
</p>
### `npm test` or `yarn test`
Runs the test watcher in an interactive mode.<br>
By default, runs tests related to files changed since the last commit.
[Read more about testing.](https://github.com/facebook/create-react-app/blob/master/packages/react-scripts/template/README.md#running-tests)
### `npm run build` or `yarn build`
Builds the app for production to the `build` folder.<br>
It correctly bundles React in production mode and optimizes the build for the best performance.
The build is minified and the filenames include the hashes.<br>
Your app is ready to be deployed.

View File

@@ -0,0 +1,7 @@
---
id: user-guide
title: User guide
sidebar_label: User guide
---
The user guide can be found on [GitHub](https://github.com/facebook/create-react-app/blob/master/packages/react-scripts/template/README.md) for now.

View File

@@ -34,11 +34,11 @@ class Footer extends React.Component {
</a>
<div>
<h5>Docs</h5>
<a href={this.docUrl('doc1.html', this.props.language)}>
Getting Started (or other categories)
<a href={this.docUrl('getting-started', this.props.language)}>
Getting Started
</a>
<a href={this.docUrl('doc2.html', this.props.language)}>
Guides (or other categories)
<a href={this.docUrl('user-guide', this.props.language)}>
User Guide
</a>
<a href={this.docUrl('doc3.html', this.props.language)}>
API Reference (or other categories)

View File

@@ -4,16 +4,26 @@
"next": "Next",
"previous": "Previous",
"tagline": "Create React apps with no build configuration.",
"docs": {},
"docs": {
"getting-started": {
"title": "Getting started",
"sidebar_label": "Getting started"
},
"README": {
"title": "README"
},
"user-guide": {
"title": "User guide",
"sidebar_label": "User guide"
}
},
"links": {
"Docs": "Docs",
"API": "API",
"Getting started": "Getting started",
"Help": "Help"
},
"categories": {
"Docusaurus": "Docusaurus",
"First Category": "First Category",
"Second Category": "Second Category"
"Getting Started": "Getting Started",
"User Guide": "User Guide"
}
},
"pages-strings": {

View File

@@ -82,8 +82,10 @@ class HomeSplash extends React.Component {
<ProjectTitle />
<PromoSection>
<Button href="#try">Try It Out</Button>
<Button href={docUrl('doc1.html', language)}>Example Link</Button>
<Button href={docUrl('doc2.html', language)}>Example Link 2</Button>
<Button href={docUrl('getting-started', language)}>
Get started
</Button>
<Button href={docUrl('user-guide', language)}>User guide</Button>
</PromoSection>
</div>
</SplashContainer>

View File

@@ -0,0 +1,6 @@
{
"docs": {
"Getting Started": ["getting-started"],
"User Guide": ["user-guide"]
}
}

View File

@@ -26,8 +26,7 @@ const siteConfig = {
// For no header links in the top nav bar -> headerLinks: [],
headerLinks: [
{ doc: 'doc1', label: 'Docs' },
{ doc: 'doc4', label: 'API' },
{ doc: 'getting-started', label: 'Getting started' },
{ href: 'https://reactjs.org/community/support.html', label: 'Help' },
],

View File

Before

Width:  |  Height:  |  Size: 76 KiB

After

Width:  |  Height:  |  Size: 76 KiB

View File

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 24 KiB

View File

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

View File

Before

Width:  |  Height:  |  Size: 4.3 KiB

After

Width:  |  Height:  |  Size: 4.3 KiB

View File

@@ -1,10 +0,0 @@
{
"docs": {
"Docusaurus": ["doc1"],
"First Category": ["doc2"],
"Second Category": ["doc3"]
},
"docs-other": {
"First Category": ["doc4", "doc5"]
}
}