Skip to content

Commit 7fcaed7

Browse files
authored
docs: Adds a docusaurus documentation page for relic. (#132)
1 parent 8d5dbd9 commit 7fcaed7

21 files changed

+18191
-0
lines changed

.github/workflows/dart-tests.yaml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,3 +116,33 @@ jobs:
116116
with:
117117
token: ${{ secrets.CODECOV_TOKEN }}
118118
files: coverage/lcov.info
119+
120+
docs-markdown-lint:
121+
name: Markdown lint for docs
122+
runs-on: ubuntu-latest
123+
steps:
124+
- name: Checkout repository
125+
uses: actions/checkout@v4
126+
127+
- name: Run markdownlint on maintained docs
128+
uses: articulate/actions-markdownlint@v1
129+
with:
130+
config: ./doc/site/.markdownlint.yaml
131+
files: ./doc/site/**/*.md
132+
133+
docs-test-build:
134+
name: Test build docs
135+
runs-on: ubuntu-latest
136+
steps:
137+
- uses: actions/checkout@v4
138+
- uses: actions/setup-node@v3
139+
with:
140+
node-version: 20
141+
cache: npm
142+
cache-dependency-path: doc/site/package-lock.json
143+
- name: Install dependencies
144+
run: npm ci
145+
working-directory: ./doc/site
146+
- name: Build
147+
run: npm run build
148+
working-directory: ./doc/site
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# Simple workflow for deploying static content to GitHub Pages
2+
name: Deploy Relic documentation
3+
4+
on:
5+
# Runs on pushes targeting the default branch
6+
push:
7+
branches:
8+
- "main"
9+
paths:
10+
- 'docsite/**'
11+
12+
# Allows you to run this workflow manually from the Actions tab
13+
workflow_dispatch:
14+
15+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
16+
permissions:
17+
contents: read
18+
pages: write
19+
id-token: write
20+
21+
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
22+
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
23+
concurrency:
24+
group: "pages"
25+
cancel-in-progress: false
26+
27+
jobs:
28+
build:
29+
name: Build documentation
30+
runs-on: ubuntu-latest
31+
steps:
32+
- name: Checkout
33+
uses: actions/checkout@v4
34+
- name: Install node
35+
uses: actions/setup-node@v3
36+
with:
37+
node-version: 20
38+
cache: npm
39+
cache-dependency-path: docsite/package-lock.json
40+
- name: Install dependencies
41+
run: npm ci
42+
working-directory: ./docs
43+
- name: Build docs
44+
run: npm run build
45+
working-directory: ./docs
46+
- name: Upload build artifact
47+
uses: actions/upload-pages-artifact@v3
48+
with:
49+
path: './doc/site/build'
50+
51+
deploy:
52+
name: Deploy documentation
53+
needs: build
54+
environment:
55+
name: github-pages
56+
url: ${{ steps.deployment.outputs.page_url }}
57+
runs-on: ubuntu-latest
58+
steps:
59+
# - name: Setup Pages
60+
# uses: actions/configure-pages@v5
61+
- name: Deploy to GitHub Pages
62+
id: deployment
63+
uses: actions/deploy-pages@v4

doc/site/.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+
.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*
21+
settings.json

doc/site/.markdownlint.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
MD001: false
2+
MD013: false
3+
MD014: false
4+
MD024: false

doc/site/.prettierrc

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

doc/site/README.md

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
# Relic documentation website
2+
3+
This is the code for Relic's official documentation. You can view the updated documentation by choosing the _Next_ option in the top menu bar.
4+
5+
### Install
6+
7+
Make sure that you have Node.js installed on your computer.
8+
9+
```bash
10+
brew install node
11+
```
12+
13+
Run `npm install` from the docs directory:
14+
15+
```bash
16+
cd docs
17+
npm install
18+
```
19+
20+
### Local Development
21+
22+
```bash
23+
npm start
24+
```
25+
26+
This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server.
27+
28+
### Add version
29+
30+
Make sure that the documentation is all up-to-date then run:
31+
32+
```bash
33+
npm run docusaurus docs:version X.X.X
34+
```
35+
36+
### Amend the latest version
37+
38+
If you need to make changes to the latest version, you can do so by removing the latest version from `versions.json` and adding it again running the create version command with the same version number.
39+
40+
```bash
41+
npm run docusaurus docs:version X.X.X
42+
```
43+
44+
### Add redirects
45+
46+
To maintain link integrity when relocating or renaming documentation pages, it's recommended to implement redirects. This is facilitated by the `@docusaurus/plugin-client-redirects` plugin. Redirects can be configured in the `docusaurus.config.js` file, within the `redirects` section of the plugin configuration.
47+
48+
### Deploy
49+
50+
Once a PR is merged into the `main` branch of this repository, a GitHub action is triggered that builds and deploys the documentation to Github pages. The documentation is available at `https://miniature-fortnight-wgn2qnl.pages.github.io`.
51+
52+
### Formatting
53+
54+
To ensure consistent formatting, we use markdownlint [(VS Code Extension)](https://marketplace.visualstudio.com/items?itemName=DavidAnson.vscode-markdownlint)
55+
56+
Install the `markdownlint-cli` globally, by running the following command from your terminal:
57+
58+
```bash
59+
$ npm install -g markdownlint-cli
60+
```
61+
62+
Formatting is only enforced in `/doc/site/` directory so therefore you only need to run the markdownlint-cli in this folder with:
63+
64+
```bash
65+
$ markdownlint './doc/site/**/*.md'
66+
```
67+
68+
### Force deploy from branch
69+
70+
This is useful if you want to deploy the branch you are working on to the documentation site but should in general never be used.
71+
72+
Follow these steps to deploy a specific branch:
73+
74+
1. Push your changes to the branch you are working on.
75+
2. In github, go to the settings tab for the `serverpod_cloud` repository.
76+
3. On the left side menu, click on `Environments`.
77+
4. Select `github-pages` from the list`.
78+
5. Add your branch to the list of branches that can deploy to github pages. (Only `main` is allowed by default).
79+
6. Open `.github/workflows/deploy-documentation.yml` and change the branch from `main` to the branch you want to deploy from.
80+
7. Push the changes to the repository.
81+
82+
Once the changes are pushed, the documentation will be deployed to the documentation site.
83+
84+
Once you are done, remember to remove the branch from the list of branches that can deploy to github pages and change the branch in the `deploy-documentation.yml` file back to `main`.

doc/site/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+
};

doc/site/docs/index.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
sidebar_position: -1
3+
---
4+
5+
# Introduction
6+
7+
Relic is a strictly typed HTTP server with incredible performance.

doc/site/docusaurus.config.js

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
// @ts-check
2+
// Note: type annotations allow type checking and IDEs autocompletion
3+
4+
import { themes } from 'prism-react-renderer';
5+
const lightCodeTheme = themes.github;
6+
const darkCodeTheme = themes.dracula;
7+
8+
/** @type {import('@docusaurus/types').Config} */
9+
const config = {
10+
title: 'Relic',
11+
tagline: 'Strictly typed HTTP server with incredible performance.',
12+
url: 'https://docs.relic.dev',
13+
baseUrl: '/',
14+
onBrokenLinks: 'throw',
15+
onBrokenMarkdownLinks: 'warn',
16+
favicon: 'img/favicon.png',
17+
organizationName: 'serverpod', // Usually your GitHub org/user name.
18+
projectName: 'relic', // Usually your repo name.
19+
trailingSlash: false,
20+
presets: [
21+
[
22+
'classic',
23+
/** @type {import('@docusaurus/preset-classic').Options} */
24+
({
25+
docs: {
26+
routeBasePath: '/',
27+
sidebarPath: require.resolve('./sidebars.js'),
28+
// Please change this to your repo.
29+
editUrl:
30+
'https://github.com/serverpod/relic/tree/main/doc/site/',
31+
breadcrumbs: false,
32+
},
33+
blog: false,
34+
theme: {
35+
customCss: require.resolve('./src/css/custom.css'),
36+
},
37+
gtag: {
38+
trackingID: 'G-0EYLJMP04H',
39+
anonymizeIP: true,
40+
},
41+
}),
42+
],
43+
],
44+
45+
themeConfig:
46+
/** @type {import('@docusaurus/preset-classic').ThemeConfig} */
47+
({
48+
colorMode: {
49+
respectPrefersColorScheme: true,
50+
disableSwitch: false,
51+
},
52+
navbar: {
53+
// title: 'My Site',
54+
logo: {
55+
alt: 'Serverpod Logo',
56+
src: 'img/logo-horizontal.svg',
57+
srcDark: 'img/logo-horizontal-dark.svg',
58+
href: 'https://serverpod.dev',
59+
},
60+
items: [
61+
{
62+
type: 'docsVersionDropdown',
63+
position: 'left',
64+
},
65+
{
66+
href: 'https://careers.serverpod.dev/',
67+
label: 'Career',
68+
position: 'right',
69+
},
70+
{
71+
href: 'https://twitter.com/ServerpodDev',
72+
label: 'Twitter',
73+
position: 'right',
74+
},
75+
{
76+
href: 'https://github.com/serverpod/serverpod',
77+
label: 'GitHub',
78+
position: 'right',
79+
},
80+
{
81+
type: 'search',
82+
position: 'right',
83+
},
84+
],
85+
},
86+
footer: {
87+
style: 'dark',
88+
copyright: `Copyright © ${new Date().getFullYear()} Serverpod authors.`,
89+
},
90+
prism: {
91+
theme: lightCodeTheme,
92+
darkTheme: darkCodeTheme,
93+
additionalLanguages: ['dart', 'bash'],
94+
},
95+
}),
96+
plugins: [
97+
[
98+
'@docusaurus/plugin-client-redirects',
99+
{
100+
redirects: [],
101+
},
102+
],
103+
],
104+
};
105+
106+
module.exports = config;

0 commit comments

Comments
 (0)