Skip to content

Commit 65d9ac3

Browse files
feat(docs): Replace Hugo with Docusaurus (#22990)
# Docusaurus Updates the website (/docs) to leverage [Docusaurus](https://docusaurus.io/) in place of Hugo as its static site generator. ## Functional changes ### Versioning The existing Hugo-based site only has a partial versioning story. The API docs are versioned, but the rest of the content isn't. This creates a messy story where our hand-written docs likely only discuss topics related to the current version, and we have no place to put docs discussing earlier versions. Or, even worse, we have a mixed bag of documentation for different versions, creating a very unclear user story. This prototype includes an end-to-end versioning story, [automated by Docusaurus](https://docusaurus.io/docs/versioning). Current (v2) docs live under `docs`. Old (v1) docs live under `versioned_docs/version-1`. Most of the documentation has been duplicated between the two versions, but some minor changes have been made to make the docs better line up with the corresponding version of the API. These changes should be reviewed before being merged into main / deploying the new website. ### Search This branch includes an offline implementation of search. An offline solution comes with some downsides (slower build, larger bundle), and probably isn't what we want long term. That said, it is much better than what our current website has (no search whatsoever). We should come back to this after v1 of our new website. --------- Co-authored-by: Wayne Ferrao <wayneferrao@microsoft.com>
1 parent 00e239a commit 65d9ac3

375 files changed

Lines changed: 22078 additions & 17649 deletions

File tree

Some content is hidden

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

.github/workflows/website-validation.yml

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ permissions:
2020

2121
jobs:
2222

23+
# Build the website (including API documentation).
24+
# Publish the build artifact for subsequent jobs to leverage.
2325
build_site:
2426
runs-on: ubuntu-latest
2527
name: Build site
@@ -36,15 +38,16 @@ jobs:
3638
- name: Build site artifact
3739
run: |
3840
pnpm i --frozen-lockfile
39-
npm run ci:build
41+
npm run build
4042
- name: Upload site artifact
4143
# release notes: https://github.com/actions/upload-artifact/releases/tag/v4.4.3
4244
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # ratchet:actions/upload-artifact@v4
4345
with:
4446
name: fluidframework-site
45-
path: docs/public
47+
path: docs/build
4648
retention-days: 3
4749

50+
# Run linter checks against the website content and infrastructure.
4851
lint:
4952
runs-on: ubuntu-latest
5053
name: pnpm lint
@@ -63,6 +66,35 @@ jobs:
6366
pnpm i --frozen-lockfile
6467
pnpm lint
6568
69+
# Run the website's tests.
70+
test:
71+
runs-on: ubuntu-latest
72+
name: 🧪 Website Tests
73+
needs: build_site
74+
steps:
75+
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # ratchet:actions/checkout@v3
76+
with:
77+
submodules: false
78+
- uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # ratchet:pnpm/action-setup@v4
79+
- uses: actions/setup-node@1a4442cacd436585916779262731d5b162bc6ec7 # ratchet:actions/setup-node@v3
80+
with:
81+
node-version: "18"
82+
cache: "pnpm"
83+
cache-dependency-path: docs/pnpm-lock.yaml
84+
85+
- name: Download site artifact
86+
# release notes: https://github.com/actions/download-artifact/releases/tag/v4.1.8
87+
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # ratchet:actions/download-artifact@v4
88+
with:
89+
name: fluidframework-site
90+
path: docs/build
91+
- name: Install dependencies
92+
run: "pnpm i --frozen-lockfile"
93+
- name: Run tests
94+
run: "npm run test"
95+
96+
# Run the link checker against the website.
97+
# Publish the results to the PR as a comment.
6698
broken_link_check:
6799
runs-on: ubuntu-latest
68100
name: 🔗 Broken Link Check
@@ -85,15 +117,15 @@ jobs:
85117
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # ratchet:actions/download-artifact@v4
86118
with:
87119
name: fluidframework-site
88-
path: docs/public
120+
path: docs/build
89121
- name: Install dependencies
90122
run: "pnpm i --frozen-lockfile"
91123
- name: Check for broken links
92124
id: linkcheck
93125
continue-on-error: true
94126
run: |
95127
set -o pipefail
96-
pnpm run ci:linkcheck | tee ./results/linkcheck-output.txt
128+
pnpm run ci:check-links | tee ./results/linkcheck-output.txt
97129
98130
- name: Save PR number
99131
run: echo ${{ github.event.number }} > ./results/pr

.prettierignore

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -80,28 +80,18 @@ packages/framework/data-object-base/es5
8080
# Generated by policy-check
8181
packages/runtime/test-runtime-utils/src/assertionShortCodesMap.ts
8282

83-
# Ignore all HTML files in docs since they're go templates
84-
docs/**/*.html
85-
86-
# Ignore docs markdown files since those are formatted using markdownlint
87-
docs/**/*.md
88-
89-
# Ignore docs markdown files since those are formatted using markdownlint
90-
docs/**/*.yaml
91-
docs/**/*.yml
92-
93-
# This is a generated file
94-
docs/themes/thxvscode/assets/js/bundle.js
95-
96-
# Ignore these scss files
97-
docs/themes/thxvscode/assets/scss/*
83+
# TODO: Remove these *after* merging new site infra into main, to ensure docs diff is intelligable during PR review.
84+
docs/docs/*
85+
docs/versioned_docs/*
9886

9987
# Generated
100-
docs/_doc-models
101-
docs/data/v*
102-
docs/public
103-
docs/resources
104-
docs/static/staticwebapp.config.json
88+
docs/.doc-models
89+
docs/.docusaurus
90+
docs/build
91+
docs/versions.json
92+
93+
# Formatting gets clobbered by swa
94+
docs/swa-cli.config.json
10595

10696
# This is a test file
10797
tools/markdown-magic/test/include.md

.vscode/extensions.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
"dbaeumer.vscode-eslint",
88
"esbenp.prettier-vscode",
99
"ms-azure-devops.azure-pipelines",
10+
"xyc.vscode-mdx-preview",
11+
"unifiedjs.vscode-mdx",
1012
],
1113
// List of extensions recommended by VS Code that should not be recommended for users of this workspace.
1214
"unwantedRecommendations": [],

docs/.env.template

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# `.env` file template.
2+
# Copy these contents into a local `.env` file in this directoy and fill in the values as needed.
3+
# `.env` is configured to be git-ignored. Please do not override this behavior.
4+
5+
# Flag that determines whether or not repo-local API documentation should be generated and included in the site build.
6+
# Only used in local development.
7+
LOCAL_API_DOCS=<boolean>

docs/.eslintrc.cjs

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
/*!
2+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3+
* Licensed under the MIT License.
4+
*/
5+
6+
module.exports = {
7+
extends: [require.resolve("@fluidframework/eslint-config-fluid"), "prettier"],
8+
parserOptions: {
9+
project: ["./tsconfig.json"],
10+
},
11+
settings: {
12+
react: {
13+
version: "detect",
14+
},
15+
},
16+
rules: {
17+
// Required by Docusaurus for certain component exports.
18+
"import/no-default-export": "off",
19+
20+
"import/no-unassigned-import": [
21+
"error",
22+
{
23+
// Allow unassigned imports of css files.
24+
allow: ["**/*.css"],
25+
},
26+
],
27+
28+
"import/no-internal-modules": [
29+
"error",
30+
{
31+
allow: ["@docusaurus/**", "@site/**", "@theme/**"],
32+
},
33+
],
34+
35+
"import/no-unresolved": [
36+
"error",
37+
{
38+
ignore: ["^@docusaurus/", "^@theme/", "^@theme-original/"],
39+
},
40+
],
41+
42+
"import/no-extraneous-dependencies": [
43+
"error",
44+
{
45+
devDependencies: ["test/**"],
46+
},
47+
],
48+
49+
// Unfortunately, some of the import aliases supported by Docusaurus are not recognized by TSC / the eslint parser.
50+
// So we have to disable some rules that enforce strong typing.
51+
// Could be worth investigating if there's a way to make TSC aware of how the aliases are resolved, but until then,
52+
// these rules are disabled.
53+
"@typescript-eslint/no-unsafe-argument": "off",
54+
"@typescript-eslint/no-unsafe-assignment": "off",
55+
"@typescript-eslint/no-unsafe-call": "off",
56+
"@typescript-eslint/no-unsafe-member-access": "off",
57+
},
58+
overrides: [
59+
{
60+
// Test files
61+
files: ["test/**/*"],
62+
parserOptions: {
63+
project: ["./test/tsconfig.json"],
64+
},
65+
},
66+
{
67+
// Config files
68+
files: ["docusaurus.config.ts", "playwright.config.ts", "infra/**/*"],
69+
rules: {
70+
// Dev dependencies and internal modules may be used in config files
71+
"import/no-extraneous-dependencies": [
72+
"error",
73+
{
74+
devDependencies: true,
75+
},
76+
],
77+
"import/no-internal-modules": "off",
78+
},
79+
},
80+
],
81+
};

docs/.gitignore

Lines changed: 30 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,34 @@
1-
.hugo_build.lock
2-
assets/doc-models/*.json
3-
bin/
4-
content/docs/api
5-
node_modules/
6-
public/
7-
scripts/api-documenter/temp
8-
themes/thxvscode/assets/js/node_modules/
1+
.env
92

10-
# Temp directory used to store download API-Extractor-generated doc models
11-
_doc-models
3+
# Dependencies
4+
/node_modules
125

13-
# Generated by build-api-nav during docs build.
14-
data/v*
15-
data/local
6+
# Production
7+
/build
168

17-
# Windows ADS files in docs.
18-
**/*:Zone.Identifier
9+
# Generated files
10+
.docusaurus
11+
.cache-loader
12+
.doc-models
13+
versions.json
1914

20-
# Copy of versions json from data dir to redirect azure function
21-
api/fallback/versions.json
15+
# Generated API docs.
16+
# Note: keep `mdx` files that are handwritten
17+
docs/api/*
18+
!docs/api/**/*.mdx
19+
versioned_docs/*/api/*
20+
!versioned_docs/*/api/**/*.mdx
21+
22+
# Test
23+
test-results
24+
25+
# Misc
26+
.DS_Store
27+
.env.local
28+
.env.development.local
29+
.env.test.local
30+
.env.production.local
31+
32+
npm-debug.log*
33+
yarn-debug.log*
34+
yarn-error.log*

0 commit comments

Comments
 (0)