Skip to content

Commit b3be1a1

Browse files
authored
Move documentation from separate branch to main branch (#156)
* feat: migrate documentation from separate branch to main - Move Docusaurus site from documentation branch to docs/ directory - Separate folder to main library to resolve React 16/18 version conflicts - Add docs:* scripts to root package.json for documentation commands - Update GitHub Actions workflows for main branch deployment - Preserve all existing CI/CD functionality for library packages
1 parent 180b2f8 commit b3be1a1

50 files changed

Lines changed: 14610 additions & 2 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Check Documentation
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- 'docs/**'
9+
pull_request:
10+
types: [opened, synchronize, reopened]
11+
paths:
12+
- 'docs/**'
13+
14+
jobs:
15+
check_docs:
16+
runs-on: ubuntu-latest
17+
name: Typecheck and Build Documentation
18+
steps:
19+
- uses: actions/checkout@v4
20+
with:
21+
submodules: true
22+
- name: Set up Node.js
23+
uses: actions/setup-node@v4
24+
with:
25+
node-version-file: '.nvmrc'
26+
cache: 'yarn'
27+
cache-dependency-path: docs/yarn.lock
28+
- name: Install dependencies
29+
run: cd docs && yarn install --immutable
30+
- name: Build documentation
31+
run: cd docs && CI=true yarn build
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: GitHub Pages Deploy
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- 'docs/**'
9+
workflow_dispatch:
10+
11+
permissions:
12+
contents: read
13+
pages: write
14+
id-token: write
15+
16+
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
17+
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
18+
concurrency:
19+
group: "pages"
20+
cancel-in-progress: false
21+
22+
jobs:
23+
build_and_deploy:
24+
runs-on: ubuntu-latest
25+
name: Build and Deploy Documentation to GitHub Pages
26+
steps:
27+
- uses: actions/checkout@v4
28+
with:
29+
submodules: true
30+
- name: Set up Node.js
31+
uses: actions/setup-node@v4
32+
with:
33+
node-version-file: '.nvmrc'
34+
cache: 'yarn'
35+
cache-dependency-path: docs/yarn.lock
36+
- name: Install dependencies
37+
run: cd docs && yarn install --immutable
38+
- name: Build documentation
39+
run: cd docs && yarn build
40+
- name: Setup Pages
41+
uses: actions/configure-pages@v5
42+
- name: Upload artifact
43+
uses: actions/upload-pages-artifact@v3
44+
with:
45+
path: './docs/build'
46+
- name: Deploy to GitHub Pages
47+
id: deployment
48+
uses: actions/deploy-pages@v4

README.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,15 @@ Ore UI is based on:
2828

2929
We currently only have one package that is open-source, and its documentation is available at https://react-facet.mojang.com/.
3030

31-
The source of the documentation (for contributions) is available at the [documentation branch](https://github.com/Mojang/ore-ui/tree/documentation).
31+
The source of the documentation is available in the [`docs/`](docs/) directory. To contribute to the documentation:
32+
33+
```bash
34+
# Install and start the documentation site
35+
yarn docs:install
36+
yarn docs:start
37+
```
38+
39+
For more details, see the [documentation README](docs/README.md).
3240

3341
## Logo
3442

docs/.eslintrc.js

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
/* eslint-env node */
2+
3+
module.exports = {
4+
env: {
5+
node: true,
6+
es6: true,
7+
},
8+
extends: ['plugin:prettier/recommended'],
9+
plugins: ['prettier'],
10+
rules: {
11+
'prettier/prettier': [
12+
'error',
13+
{
14+
endOfLine: 'auto',
15+
},
16+
],
17+
// Disable the require-in-package rule that's problematic for Docusaurus
18+
'require-in-package/require-in-package': 'off',
19+
},
20+
overrides: [
21+
{
22+
// For React components in the docs (like homepage components)
23+
files: ['src/**/*.{js,jsx}'],
24+
env: {
25+
browser: true,
26+
es6: true,
27+
},
28+
plugins: ['react', 'prettier'],
29+
rules: {
30+
'react/jsx-uses-react': 'error',
31+
'react/jsx-uses-vars': 'error',
32+
'prettier/prettier': [
33+
'error',
34+
{
35+
endOfLine: 'auto',
36+
},
37+
],
38+
// Disable problematic import rules for Docusaurus
39+
'import/no-unresolved': 'off',
40+
'import/no-named-as-default': 'off',
41+
'require-in-package/require-in-package': 'off',
42+
},
43+
},
44+
],
45+
}

docs/.gitignore

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Dependencies
2+
/node_modules
3+
4+
# Production
5+
/build
6+
7+
# Generated files
8+
.yarn
9+
.docusaurus
10+
.cache-loader
11+
12+
# Misc
13+
.DS_Store
14+
.env.local
15+
.env.development.local
16+
.env.test.local
17+
.env.production.local
18+
19+
npm-debug.log*
20+
yarn-debug.log*
21+
yarn-error.log*

docs/.prettierignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
.vscode/
2+
node_modules/
3+
.yarn/
4+
.pnp.*
5+
docs/build
6+
docs/.docusaurus
7+
coverage
8+
**/dist/
9+
build

docs/.prettierrc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"printWidth": 120,
3+
"useTabs": false,
4+
"semi": false,
5+
"singleQuote": true,
6+
"trailingComma": "all",
7+
"endOfLine": "auto"
8+
}

docs/README.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# Documentation
2+
3+
This directory contains the Docusaurus-based documentation website for ore-ui.
4+
5+
This website is built using [Docusaurus 2](https://docusaurus.io/), a modern static website generator.
6+
7+
## Development
8+
9+
### Prerequisites
10+
11+
The documentation site uses React 16 (required by Docusaurus 2.4.3), which is different from the main project's React 18. This is why the documentation is kept as a separate workspace with its own dependencies.
12+
13+
### Getting Started
14+
15+
```console
16+
# From project root
17+
yarn docs:install && yarn docs:start
18+
19+
# Or from docs directory
20+
cd docs && yarn install && yarn start
21+
```
22+
23+
This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server.
24+
25+
### Build
26+
27+
```console
28+
# From project root
29+
yarn docs:build
30+
31+
# Or from docs directory
32+
cd docs && yarn build
33+
```
34+
35+
This command generates static content into the `build` directory and can be served using any static contents hosting service.
36+
37+
### Deployment
38+
39+
The documentation is automatically deployed to GitHub Pages when changes are pushed to the `docs/` directory on the main branch.
40+
41+
### Architecture
42+
43+
- **Framework**: Docusaurus 2.4.3
44+
- **React Version**: 16.9.0 (required by Docusaurus)
45+
- **Deployment**: GitHub Pages
46+
- **Build Output**: `docs/build/`
47+
48+
### Separate Workspace Rationale
49+
50+
The documentation is maintained as a separate workspace (not included in the main yarn workspaces) because:
51+
52+
1. **React Version Conflict**: Main project uses React 18, while Docusaurus requires React 16
53+
2. **Independent Dependencies**: Documentation has different tooling and build requirements
54+
3. **Separate Build Pipeline**: Different CI/CD requirements for documentation vs library packages
55+
4. **Deployment Independence**: Documentation can be deployed separately from library releases

docs/babel.config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports = {
2+
presets: [require.resolve('@docusaurus/core/lib/babel/preset')],
3+
}

docs/blog/2019-05-28-hola.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
slug: hola
3+
title: Hola
4+
author: Gao Wei
5+
author_title: Docusaurus Core Team
6+
author_url: https://github.com/wgao19
7+
author_image_url: https://avatars1.githubusercontent.com/u/2055384?v=4
8+
tags: [hola, docusaurus]
9+
---
10+
11+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet

0 commit comments

Comments
 (0)