Skip to content

Commit ff91e8c

Browse files
committed
chore: use rspress for docs
1 parent 75a5754 commit ff91e8c

File tree

30 files changed

+1927
-3379
lines changed

30 files changed

+1927
-3379
lines changed

.github/workflows/deploy-docs.yml

Lines changed: 26 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -8,36 +8,43 @@ on:
88
- '.github/workflows/deploy-docs.yml'
99
- 'docs/**'
1010

11+
permissions:
12+
contents: read
13+
pages: write
14+
id-token: write
15+
1116
jobs:
12-
deploy-docs:
17+
build:
1318
runs-on: ubuntu-latest
1419
steps:
1520
- name: Checkout
16-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
21+
uses: actions/checkout@v4
22+
with:
23+
fetch-depth: 0
1724

1825
- name: Setup
1926
uses: ./.github/actions/setup
2027

21-
- name: Cache build
22-
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
23-
with:
24-
path: |
25-
docs/.next/cache
26-
key: ${{ runner.os }}-nextjs-${{ hashFiles('yarn.lock') }}-${{ hashFiles('**/package.json', '!node_modules/**') }}
27-
restore-keys: |
28-
${{ runner.os }}-nextjs-${{ hashFiles('yarn.lock') }}
29-
${{ runner.os }}-nextjs-
28+
- name: Setup Pages
29+
uses: actions/configure-pages@v5
3030

31-
- name: Build docs
31+
- name: Build with Rspress
32+
working-directory: docs
3233
run: |
3334
yarn docs build
34-
touch docs/out/.nojekyll
3535
36-
- name: Deploy to GitHub Pages
37-
uses: JamesIves/github-pages-deploy-action@6c2d9db40f9296374acc17b90404b6e8864128c8 # v4.7.3
36+
- name: Upload artifact
37+
uses: actions/upload-pages-artifact@v3
3838
with:
39-
branch: gh-pages
40-
folder: docs/out
39+
path: docs/doc_build
4140

42-
permissions:
43-
contents: write
41+
deploy:
42+
environment:
43+
name: github-pages
44+
url: ${{ steps.deployment.outputs.page_url }}
45+
needs: build
46+
runs-on: ubuntu-latest
47+
steps:
48+
- name: Deploy to GitHub Pages
49+
id: deployment
50+
uses: actions/deploy-pages@v4

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,3 +84,4 @@ typings/
8484
# generated files
8585
lib/
8686
typescript/
87+
doc_build/

docs/.gitignore

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

docs/assets/favicon.png

10.4 KB
Loading

docs/components/Hero.module.css

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
.container {
2+
margin: 0 auto;
3+
width: calc(100% - 8 * 2px);
4+
display: flex;
5+
flex-direction: column;
6+
justify-content: center;
7+
align-items: flex-start;
8+
position: relative;
9+
overflow: hidden;
10+
padding: calc(var(--rp-content-padding-y) * 1.5) 0 var(--rp-content-padding-y)
11+
0;
12+
}
13+
14+
.heroMain {
15+
display: flex;
16+
flex-direction: column;
17+
text-wrap: balance;
18+
max-width: 55%;
19+
}
20+
21+
.heroName {
22+
color: var(--rp-c-text-1);
23+
font-family: 'Alliance No.2', Arial, sans-serif;
24+
font-size: 64px;
25+
font-style: normal;
26+
font-weight: 400 !important;
27+
line-height: 1.1 !important;
28+
}
29+
30+
.featureList {
31+
display: flex;
32+
flex-wrap: wrap;
33+
align-items: stretch;
34+
display: flex;
35+
gap: 32px;
36+
width: 100%;
37+
margin-top: calc(var(--rp-content-padding-y) * 2);
38+
}
39+
40+
.feature {
41+
display: flex;
42+
flex: 1;
43+
position: relative;
44+
color: var(--rp-c-text-1);
45+
border: 1px dashed var(--rp-c-divider);
46+
border-radius: var(--rp-radius-small);
47+
flex-direction: column;
48+
align-items: flex-start;
49+
gap: 32px;
50+
padding: 32px;
51+
}
52+
53+
.featureTitle {
54+
color: var(--rp-c-text-1);
55+
font-size: 24px;
56+
font-weight: 600;
57+
line-height: 1.2;
58+
}
59+
60+
.featureDescription {
61+
flex: 1;
62+
color: var(--rp-c-text-2);
63+
font-size: 16px;
64+
line-height: 1.5;
65+
}
66+
67+
.codeBlock {
68+
width: 100%;
69+
background-color: var(--rp-code-block-bg);
70+
color: var(--rp-code-block-color);
71+
padding: 12px 0;
72+
}

docs/components/Hero.tsx

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
import styles from './Hero.module.css';
2+
import { Button } from '@callstack/rspress-theme';
3+
import { CodeBlockRuntime } from '@rspress/core/theme';
4+
import { transformerNotationHighlight } from '@shikijs/transformers';
5+
6+
export function Hero() {
7+
return (
8+
<div className="rp-relative">
9+
<div
10+
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
11+
className={`rp-overflow-hidden rp-max-w-6xl ${styles.container}`}
12+
>
13+
<div className={styles.heroMain}>
14+
<h1 className={styles.heroName}>
15+
Create & build React Native libraries
16+
</h1>
17+
</div>
18+
19+
<div className={styles.featureList}>
20+
<div className={styles.feature}>
21+
<h2 className={styles.featureTitle}>Create</h2>
22+
<p className={styles.featureDescription}>
23+
Scaffold a new React Native library with everything
24+
pre-configured. Choose between templates such as Turbo Modules or
25+
Nitro Modules.
26+
</p>
27+
<div className={styles.codeBlock}>
28+
<CodeBlockRuntime
29+
lang="sh"
30+
code={`npx create-react-native-library@latest`}
31+
shikiOptions={{
32+
transformers: [transformerNotationHighlight()],
33+
}}
34+
/>
35+
</div>
36+
<Button href="/create">Learn more</Button>
37+
</div>
38+
39+
<div className={styles.feature}>
40+
<h2 className={styles.featureTitle}>Build</h2>
41+
<p className={styles.featureDescription}>
42+
Compile your React Native library to work with multiple tools.
43+
Support Metro, Webpack, Vite, NodeJS & more with a single build.
44+
</p>
45+
<div className={styles.codeBlock}>
46+
<CodeBlockRuntime
47+
lang="sh"
48+
code={`npx react-native-builder-bob@latest init`}
49+
shikiOptions={{
50+
transformers: [transformerNotationHighlight()],
51+
}}
52+
/>
53+
</div>
54+
<Button href="/build">Learn more</Button>
55+
</div>
56+
</div>
57+
</div>
58+
</div>
59+
);
60+
}

docs/index.d.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
declare module '*.module.css' {
2+
const classes: { [key: string]: string };
3+
export default classes;
4+
}

docs/next-env.d.ts

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

docs/next.config.js

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

docs/package.json

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,14 @@
44
"private": true,
55
"description": "Documentation for react-native-builder-bob",
66
"scripts": {
7-
"dev": "next dev",
8-
"build": "next build"
7+
"build": "rspress build",
8+
"dev": "rspress dev",
9+
"preview": "rspress preview"
910
},
1011
"dependencies": {
11-
"next": "^13.5.3",
12-
"nextra": "^2.13.1",
13-
"nextra-theme-docs": "^2.13.1",
14-
"react": "^18.2.0",
15-
"react-dom": "^18.2.0"
16-
},
17-
"devDependencies": {
18-
"@types/node": "18.11.10"
12+
"@callstack/rspress-preset": "^0.4.3",
13+
"@callstack/rspress-theme": "^0.4.3",
14+
"@rspress/core": "2.0.0-beta.32",
15+
"@shikijs/transformers": "^3.13.0"
1916
}
2017
}

0 commit comments

Comments
 (0)