Skip to content

Commit 9bb7762

Browse files
committed
fix: switch docs framework to nextra 4
1 parent 022008a commit 9bb7762

File tree

116 files changed

+8399
-31281
lines changed

Some content is hidden

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

116 files changed

+8399
-31281
lines changed

.github/workflows/deploy.yml

Lines changed: 91 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,102 @@
1-
name: Docusaurus Build & Deploy
1+
# Sample workflow for building and deploying a Next.js site to GitHub Pages
2+
#
3+
# To get started with Next.js see: https://nextjs.org/docs/getting-started
4+
#
5+
name: Deploy to GH Pages
26

37
on:
8+
# Runs on pushes targeting the default branch
49
push:
5-
branches:
6-
- docs
7-
# Review gh actions docs if you want to further define triggers, paths, etc
8-
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#on
10+
branches: ["docs"]
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
926

1027
jobs:
11-
deploy:
12-
name: Deploy to GitHub Pages
28+
# Build job
29+
build:
1330
runs-on: ubuntu-latest
1431
steps:
15-
- uses: actions/checkout@v3
16-
- uses: actions/setup-node@v3
32+
- name: Checkout
33+
uses: actions/checkout@v4
34+
- name: Setup pnpm
35+
uses: pnpm/action-setup@v3
1736
with:
18-
node-version: 18
19-
cache: npm
20-
37+
version: 9
38+
- name: Detect package manager
39+
id: detect-package-manager
40+
run: |
41+
if [ -f "${{ github.workspace }}/yarn.lock" ]; then
42+
echo "manager=yarn" >> $GITHUB_OUTPUT
43+
echo "command=install" >> $GITHUB_OUTPUT
44+
echo "runner=yarn" >> $GITHUB_OUTPUT
45+
exit 0
46+
elif [ -f "${{ github.workspace }}/pnpm-lock.yaml" ]; then
47+
echo "manager=pnpm" >> $GITHUB_OUTPUT
48+
echo "command=install --frozen-lockfile" >> $GITHUB_OUTPUT
49+
echo "runner=npx --no-install" >> $GITHUB_OUTPUT
50+
exit 0
51+
elif [ -f "${{ github.workspace }}/package.json" ]; then
52+
echo "manager=npm" >> $GITHUB_OUTPUT
53+
echo "command=ci" >> $GITHUB_OUTPUT
54+
echo "runner=npx --no-install" >> $GITHUB_OUTPUT
55+
exit 0
56+
else
57+
echo "Unable to determine package manager"
58+
exit 1
59+
fi
60+
- name: Setup Node
61+
uses: actions/setup-node@v4
62+
with:
63+
node-version: "22"
64+
cache: ${{ steps.detect-package-manager.outputs.manager }}
65+
- name: Setup Pages
66+
uses: actions/configure-pages@v5
67+
with:
68+
# Automatically inject basePath in your Next.js configuration file and disable
69+
# server side image optimization (https://nextjs.org/docs/api-reference/next/image#unoptimized).
70+
#
71+
# You may remove this line if you want to manage the configuration yourself.
72+
static_site_generator: next
73+
- name: Restore cache
74+
uses: actions/cache@v4
75+
with:
76+
path: |
77+
.next/cache
78+
# Generate a new cache whenever packages or source files change.
79+
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json', '**/yarn.lock', '**/pnpm-lock.yaml') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }}
80+
# If source files changed but packages didn't, rebuild from a prior cache.
81+
restore-keys: |
82+
${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json', '**/yarn.lock', '**/pnpm-lock.yaml') }}-
2183
- name: Install dependencies
22-
run: yarn install --frozen-lockfile
23-
- name: Build website
24-
run: yarn build
84+
run: ${{ steps.detect-package-manager.outputs.manager }} ${{ steps.detect-package-manager.outputs.command }}
85+
- name: Build with Next.js
86+
run: ${{ steps.detect-package-manager.outputs.runner }} next build
87+
- name: Upload artifact
88+
uses: actions/upload-pages-artifact@v3
89+
with:
90+
path: ./out
2591

26-
# Popular action to deploy to GitHub Pages:
27-
# Docs: https://github.com/peaceiris/actions-gh-pages#%EF%B8%8F-docusaurus
92+
# Deployment job
93+
deploy:
94+
environment:
95+
name: github-pages
96+
url: ${{ steps.deployment.outputs.page_url }}
97+
runs-on: ubuntu-latest
98+
needs: build
99+
steps:
28100
- name: Deploy to GitHub Pages
29-
uses: peaceiris/actions-gh-pages@v3
30-
with:
31-
github_token: ${{ secrets.GITHUB_TOKEN }}
32-
# Build output to publish to the `gh-pages` branch:
33-
publish_dir: ./build
34-
# The following lines assign commit authorship to the official
35-
# GH-Actions bot for deploys to `gh-pages` branch:
36-
# https://github.com/actions/checkout/issues/13#issuecomment-724415212
37-
# The GH actions bot is used by default if you didn't specify the two fields.
38-
# You can swap them out with your own user credentials.
39-
user_name: github-actions[bot]
40-
user_email: 41898282+github-actions[bot]@users.noreply.github.com
101+
id: deployment
102+
uses: actions/deploy-pages@v4

.github/workflows/test-deploy.yml

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

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,15 @@
55
/build
66

77
# Generated files
8+
.next
9+
.vscode
810
.docusaurus
911
.cache-loader
12+
_pagefind/
13+
out/
1014

1115
# Misc
16+
.env
1217
.DS_Store
1318
.env.local
1419
.env.development.local

.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
enable-pre-post-scripts=true

README.md

Lines changed: 12 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,19 @@
11
# WebSerial Docs
22

3-
This documentation is built using [Docusaurus 2](https://docusaurus.io/), a modern static website generator.
3+
## Development
44

5-
### Installation
5+
Run the following commands to start the development server:
66

7-
```
8-
$ yarn
9-
```
10-
11-
### Local Development
12-
13-
```
14-
$ yarn start
15-
```
16-
17-
This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server.
18-
19-
### Build
20-
21-
```
22-
$ yarn build
7+
```bash
8+
npm run dev
9+
# or
10+
yarn dev
11+
# or
12+
pnpm dev
13+
# or
14+
bun dev
2315
```
2416

25-
This command generates static content into the `build` directory and can be served using any static contents hosting service.
26-
27-
### Deployment
28-
29-
Using SSH:
30-
31-
```
32-
$ USE_SSH=true yarn deploy
33-
```
34-
35-
Not using SSH:
36-
37-
```
38-
$ GIT_USER=<Your GitHub username> yarn deploy
39-
```
17+
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
4018

41-
If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch.
19+
You can start editing the page by modifying `pages/index.mdx`. The page auto-updates as you edit the file.

babel.config.js

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

blog/authors.yml

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

docs/branding.md

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

docs/callbacks.md

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

docs/custom-title.md

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

0 commit comments

Comments
 (0)