Skip to content

Commit 36cd392

Browse files
authored
docs: add documentation example (#4)
1 parent 2fdafe0 commit 36cd392

10 files changed

Lines changed: 163 additions & 5 deletions

File tree

examples/documentation/README.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Rspress website
2+
3+
## Setup
4+
5+
Install the dependencies:
6+
7+
```bash
8+
npm install
9+
```
10+
11+
## Get started
12+
13+
Start the dev server:
14+
15+
```bash
16+
npm run dev
17+
```
18+
19+
Build the website for production:
20+
21+
```bash
22+
npm run build
23+
```
24+
25+
Preview the production build locally:
26+
27+
```bash
28+
npm run preview
29+
```
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
[
2+
{
3+
"text": "API",
4+
"link": "/api/",
5+
"activeMatch": "/api/"
6+
},
7+
{
8+
"text": "Document",
9+
"link": "https://rspress.rs/"
10+
}
11+
]
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
["index", "commands"]
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Commands
2+
3+
## dev
4+
5+
## build
6+
7+
## preview
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
title: API Overview
3+
overview: true
4+
---
5+
6+
This is an API Overview page which outlines all the available APIs.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
pageType: home
3+
4+
hero:
5+
name: My Site
6+
text: A cool website!
7+
tagline: This is the tagline
8+
actions:
9+
- theme: brand
10+
text: Quick Start
11+
link: /api/
12+
- theme: alt
13+
text: GitHub
14+
link: https://github.com/web-infra-dev/rspress
15+
image:
16+
src: https://assets.rspack.rs/rspress/rspress-logo.svg
17+
alt: Logo
18+
---
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"name": "@examples/documentation",
3+
"private": true,
4+
"type": "module",
5+
"scripts": {
6+
"build": "rs doc build",
7+
"dev": "rs doc",
8+
"lint": "rs lint",
9+
"preview": "rs doc preview"
10+
},
11+
"dependencies": {
12+
"rstack": "workspace:*"
13+
},
14+
"devDependencies": {
15+
"@types/node": "catalog:",
16+
"@types/react": "catalog:",
17+
"@types/react-dom": "catalog:",
18+
"react": "catalog:",
19+
"react-dom": "catalog:"
20+
}
21+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { define } from 'rstack';
2+
import path from 'node:path';
3+
4+
define.doc({
5+
root: path.join(import.meta.dirname, 'docs'),
6+
title: 'My Site',
7+
});
8+
9+
define.lint(async () => {
10+
const { js, ts, reactPlugin, reactHooksPlugin } = await import('rstack/lint');
11+
return [
12+
js.configs.recommended,
13+
ts.configs.recommended,
14+
reactPlugin.configs.recommended,
15+
reactHooksPlugin.configs.recommended,
16+
];
17+
});
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"compilerOptions": {
3+
"lib": ["DOM", "ES2020"],
4+
"jsx": "react-jsx",
5+
"target": "ES2020",
6+
"noEmit": true,
7+
"skipLibCheck": true,
8+
"types": ["rstack/types", "node"],
9+
"useDefineForClassFields": true,
10+
11+
/* modules */
12+
"moduleDetection": "force",
13+
"moduleResolution": "bundler",
14+
"verbatimModuleSyntax": true,
15+
"resolveJsonModule": true,
16+
"allowImportingTsExtensions": true,
17+
18+
/* type checking */
19+
"noUnusedLocals": true,
20+
"noUnusedParameters": true
21+
},
22+
"include": ["docs", "rstack.config.ts"],
23+
"mdx": {
24+
"checkMdx": true
25+
}
26+
}

pnpm-lock.yaml

Lines changed: 27 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)