Skip to content

Commit 58055d8

Browse files
cross19xxthymikee
andauthored
docs: migrate to Docusaurus v2 (#299)
* Migration to Docusaurus v2.0.0 * update lock file * add algolia search * update GH Pages deploy * make sidebar non-collapsible for now * update theme colors * ignore docusaurus-specific import aliases, remove home-container class Co-authored-by: Michał Pierzchała <thymikee@gmail.com>
1 parent 16718c3 commit 58055d8

27 files changed

+4929
-2553
lines changed

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ jobs:
6464
git config --global user.email "thymikee@users.noreply.github.com"
6565
git config --global user.name "Michał Pierzchała"
6666
echo "machine github.com login thymikee password $GITHUB_TOKEN" > ~/.netrc
67-
cd website && yarn install && GIT_USER=thymikee yarn run publish-gh-pages
67+
cd website && yarn install && GIT_USER=thymikee yarn deploy
6868
6969
workflows:
7070
version: 2

.eslintrc

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@
44
"flowtype/no-weak-types": 0,
55
"react-native/no-raw-text": 0,
66
"no-console": 1,
7-
"react/no-multi-comp": 0
7+
"react/no-multi-comp": 0,
8+
// Ignore certain webpack alias because it can't be resolved
9+
"import/no-unresolved": [
10+
2,
11+
{ "ignore": ["^@theme", "^@docusaurus", "^@generated"] }
12+
]
813
}
914
}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ build
77

88
# Ignore lock files in examples for now
99
examples/**/yarn.lock
10+
.docusaurus

website/.gitignore

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,20 @@
1-
.DS_Store
1+
# Dependencies
2+
/node_modules
3+
4+
# Production
5+
/build
26

3-
node_modules
7+
# Generated files
8+
.docusaurus
9+
.cache-loader
410

5-
lib/core/metadata.js
6-
lib/core/MetadataBlog.js
11+
# Misc
12+
.DS_Store
13+
.env.local
14+
.env.development.local
15+
.env.test.local
16+
.env.production.local
717

8-
website/translated_docs
9-
website/build/
10-
website/yarn.lock
11-
website/node_modules
12-
website/i18n/*
18+
npm-debug.log*
19+
yarn-debug.log*
20+
yarn-error.log*

website/README.md

Lines changed: 13 additions & 173 deletions
Original file line numberDiff line numberDiff line change
@@ -1,193 +1,33 @@
1-
This website was created with [Docusaurus](https://docusaurus.io/).
1+
# Website
22

3-
# What's In This Document
3+
This website is built using [Docusaurus 2](https://v2.docusaurus.io/), a modern static website generator.
44

5-
* [Get Started in 5 Minutes](#get-started-in-5-minutes)
6-
* [Directory Structure](#directory-structure)
7-
* [Editing Content](#editing-content)
8-
* [Adding Content](#adding-content)
9-
* [Full Documentation](#full-documentation)
5+
### Installation
106

11-
# Get Started in 5 Minutes
12-
13-
1. Make sure all the dependencies for the website are installed:
14-
15-
```sh
16-
# Install dependencies
17-
$ yarn
18-
```
19-
2. Run your dev server:
20-
21-
```sh
22-
# Start the site
23-
$ yarn start
24-
```
25-
26-
## Directory Structure
27-
28-
Your project file structure should look something like this
29-
30-
```
31-
my-docusaurus/
32-
docs/
33-
doc-1.md
34-
doc-2.md
35-
doc-3.md
36-
website/
37-
blog/
38-
2016-3-11-oldest-post.md
39-
2017-10-24-newest-post.md
40-
core/
41-
node_modules/
42-
pages/
43-
static/
44-
css/
45-
img/
46-
package.json
47-
sidebar.json
48-
siteConfig.js
497
```
50-
51-
# Editing Content
52-
53-
## Editing an existing docs page
54-
55-
Edit docs by navigating to `docs/` and editing the corresponding document:
56-
57-
`docs/doc-to-be-edited.md`
58-
59-
```markdown
60-
---
61-
id: page-needs-edit
62-
title: This Doc Needs To Be Edited
63-
---
64-
65-
Edit me...
66-
```
67-
68-
For more information about docs, click [here](https://docusaurus.io/docs/en/navigation)
69-
70-
## Editing an existing blog post
71-
72-
Edit blog posts by navigating to `website/blog` and editing the corresponding post:
73-
74-
`website/blog/post-to-be-edited.md`
75-
```markdown
76-
---
77-
id: post-needs-edit
78-
title: This Blog Post Needs To Be Edited
79-
---
80-
81-
Edit me...
8+
$ yarn
829
```
8310

84-
For more information about blog posts, click [here](https://docusaurus.io/docs/en/adding-blog)
85-
86-
# Adding Content
87-
88-
## Adding a new docs page to an existing sidebar
89-
90-
1. Create the doc as a new markdown file in `/docs`, example `docs/newly-created-doc.md`:
91-
92-
```md
93-
---
94-
id: newly-created-doc
95-
title: This Doc Needs To Be Edited
96-
---
11+
### Local Development
9712

98-
My new content here..
9913
```
100-
101-
1. Refer to that doc's ID in an existing sidebar in `website/sidebar.json`:
102-
103-
```javascript
104-
// Add newly-created-doc to the Getting Started category of docs
105-
{
106-
"docs": {
107-
"Getting Started": [
108-
"quick-start",
109-
"newly-created-doc" // new doc here
110-
],
111-
...
112-
},
113-
...
114-
}
14+
$ yarn start
11515
```
11616

117-
For more information about adding new docs, click [here](https://docusaurus.io/docs/en/navigation)
17+
This command starts a local development server and open up a browser window. Most changes are reflected live without having to restart the server.
11818

119-
## Adding a new blog post
19+
### Build
12020

121-
1. Make sure there is a header link to your blog in `website/siteConfig.js`:
122-
123-
`website/siteConfig.js`
124-
```javascript
125-
headerLinks: [
126-
...
127-
{ blog: true, label: 'Blog' },
128-
...
129-
]
13021
```
131-
132-
2. Create the blog post with the format `YYYY-MM-DD-My-Blog-Post-Title.md` in `website/blog`:
133-
134-
`website/blog/2018-05-21-New-Blog-Post.md`
135-
136-
```markdown
137-
---
138-
author: Frank Li
139-
authorURL: https://twitter.com/foobarbaz
140-
authorFBID: 503283835
141-
title: New Blog Post
142-
---
143-
144-
Lorem Ipsum...
22+
$ yarn build
14523
```
14624

147-
For more information about blog posts, click [here](https://docusaurus.io/docs/en/adding-blog)
25+
This command generates static content into the `build` directory and can be served using any static contents hosting service.
14826

149-
## Adding items to your site's top navigation bar
27+
### Deployment
15028

151-
1. Add links to docs, custom pages or external links by editing the headerLinks field of `website/siteConfig.js`:
152-
153-
`website/siteConfig.js`
154-
```javascript
155-
{
156-
headerLinks: [
157-
...
158-
/* you can add docs */
159-
{ doc: 'my-examples', label: 'Examples' },
160-
/* you can add custom pages */
161-
{ page: 'help', label: 'Help' },
162-
/* you can add external links */
163-
{ href: 'https://github.com/facebook/Docusaurus', label: 'GitHub' },
164-
...
165-
],
166-
...
167-
}
16829
```
169-
170-
For more information about the navigation bar, click [here](https://docusaurus.io/docs/en/navigation)
171-
172-
## Adding custom pages
173-
174-
1. Docusaurus uses React components to build pages. The components are saved as .js files in `website/pages/en`:
175-
1. If you want your page to show up in your navigation header, you will need to update `website/siteConfig.js` to add to the `headerLinks` element:
176-
177-
`website/siteConfig.js`
178-
```javascript
179-
{
180-
headerLinks: [
181-
...
182-
{ page: 'my-new-custom-page', label: 'My New Custom Page' },
183-
...
184-
],
185-
...
186-
}
30+
$ GIT_USER=<Your GitHub username> USE_SSH=true yarn deploy
18731
```
18832

189-
For more information about custom pages, click [here](https://docusaurus.io/docs/en/custom-pages).
190-
191-
# Full Documentation
192-
193-
Full documentation can be found on the [website](https://docusaurus.io/).
33+
If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch.

website/core/Footer.js

Lines changed: 0 additions & 79 deletions
This file was deleted.

website/docker/.dockerignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
*/node_modules
22
*.log
3+
.docusaurus

website/docker/Dockerfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ FROM node:8.11.4
33
WORKDIR /app/website
44

55
EXPOSE 3000 35729
6-
COPY ./docs /app/docs
76
COPY ./website /app/website
87
RUN yarn install
98

website/docker/docker-compose.yml

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version: "3"
1+
version: '3'
22

33
services:
44
docusaurus:
@@ -7,12 +7,5 @@ services:
77
- 3000:3000
88
- 35729:35729
99
volumes:
10-
- ./docs:/app/docs
11-
- ./website/blog:/app/website/blog
12-
- ./website/core:/app/website/core
13-
- ./website/i18n:/app/website/i18n
14-
- ./website/pages:/app/website/pages
15-
- ./website/static:/app/website/static
16-
- ./website/sidebars.json:/app/website/sidebars.json
17-
- ./website/siteConfig.js:/app/website/siteConfig.js
10+
- ./website:/app/website
1811
working_dir: /app/website
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)