Skip to content

Commit 7019472

Browse files
feat(docs): replace Mintlify with a Nextra site + Cloudflare Pages deploy
1 parent 50d6cf7 commit 7019472

44 files changed

Lines changed: 5534 additions & 128 deletions

Some content is hidden

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

.github/workflows/README.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,21 @@ check -> wasm -> runtime -> demo
1515
| `cli.yml` | Standalone (not part of the pipeline above): builds and tests `cli/`; on `main` pushes also publishes the release binary + `cli/setup/` scripts (`install.sh`, `uninstall.sh`) to GitHub Pages |
1616
| `host.yml` | Standalone: deno-lints and tests each host capability (`dom`, `network`, `storage`, `time`) in headless Chromium; on `main` pushes also deploys their ESM sources to Cloudflare Pages (`edge-python-host`) |
1717
| `std.yml` | Standalone: clippy + build + optimize + test each stdpkg (`json`, `re`, `math` as wasm; `test` is pure Edge Python, so its steps skip the wasm build and only run the corpus); on `main` pushes also deploys the per-package `.wasm` to Cloudflare Pages (`edge-python-std`) |
18+
| `docs.yml` | Standalone (triggered only by `docs/**` changes): `npm ci` + `next build` static export of the Nextra docs (`docs/out`, sitemap via `postbuild`); PRs build only, `main` pushes also deploy to Cloudflare Pages (`edge-python-docs`) |
1819

1920
## Cloudflare Pages
2021

21-
Four **Direct Upload** projects, Actions pushes prebuilt directories via `wrangler pages deploy`; Cloudflare doesn't clone or build.
22+
Five **Direct Upload** projects, Actions pushes prebuilt directories via `wrangler pages deploy`; Cloudflare doesn't clone or build.
2223

2324
| Project | Source | Production URL |
2425
|---------|--------|----------------|
2526
| `edge-python-demo` | `demo/` (wasm hashed for `version.json`, not bundled) | `https://edge-python-demo.pages.dev` |
2627
| `edge-python-runtime` | `runtime/` + bundled `compiler_lib.wasm` | `https://edge-python-runtime.pages.dev` |
2728
| `edge-python-host` | `host/<cap>/src/` for each capability, flattened to `<cap>/` | `https://edge-python-host.pages.dev` |
2829
| `edge-python-std` | per-package optimized `.wasm` from `std/<pkg>/` | `https://edge-python-std.pages.dev` |
30+
| `edge-python-docs` | `docs/out` (Nextra static export) | `https://edgepython.com` (custom domain; also `https://edge-python-docs.pages.dev`) |
2931

30-
All four deploys run **only on pushes to `main`** and are pinned to the production `main` branch in the matching workflow (`_runtime.yml` / `_demo.yml` / `host.yml` / `std.yml`). PRs and tags never deploy; the next `main` push refreshes the projects.
32+
All five deploys run **only on pushes to `main`** and are pinned to the production `main` branch in the matching workflow (`_runtime.yml` / `_demo.yml` / `host.yml` / `std.yml` / `docs.yml`). PRs and tags never deploy; the next `main` push refreshes the projects.
3133

3234
### Cloudflare and GitHub setup
3335

@@ -36,8 +38,11 @@ All four deploys run **only on pushes to `main`** and are pinned to the producti
3638
npx wrangler login
3739
npx wrangler pages project create edge-python-demo --production-branch=main
3840
npx wrangler pages project create edge-python-runtime --production-branch=main
41+
npx wrangler pages project create edge-python-docs --production-branch=main
3942
```
4043

44+
`edge-python-docs` serves `edgepython.com` (replacing the old Mintlify docs): after the first deploy, add `edgepython.com` as a custom domain on the project (Pages -> Custom domains) and remove it from Mintlify.
45+
4146
Repo secrets (*Settings -> Secrets and variables -> Actions*):
4247

4348
- `CLOUDFLARE_API_TOKEN`, `Account -> Cloudflare Pages -> Edit`. Create via dashboard: <https://dash.cloudflare.com/profile/api-tokens>.

.github/workflows/docs.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Docs
2+
3+
on:
4+
push:
5+
branches: [main]
6+
paths: ["docs/**", ".github/workflows/docs.yml"]
7+
pull_request:
8+
branches: [main]
9+
paths: ["docs/**", ".github/workflows/docs.yml"]
10+
11+
permissions:
12+
contents: read
13+
14+
concurrency:
15+
group: ${{ github.workflow }}-${{ github.ref }}
16+
cancel-in-progress: true
17+
18+
jobs:
19+
# Build the docs static export and deploy it to Cloudflare Pages.
20+
deploy:
21+
name: Cloudflare Pages
22+
runs-on: ubuntu-latest
23+
24+
steps:
25+
- uses: actions/checkout@v6
26+
27+
- uses: actions/setup-node@v6
28+
with:
29+
node-version: "22"
30+
cache: npm
31+
cache-dependency-path: docs/package-lock.json
32+
33+
# Reproducible install from the committed lockfile.
34+
- name: Install
35+
working-directory: docs
36+
run: npm ci
37+
38+
# `output: 'export'` makes `next build` emit a fully static site to docs/out.
39+
- name: Build
40+
working-directory: docs
41+
run: npm run build
42+
43+
# Deploy only on main pushes; PRs stop after a successful build.
44+
- name: Deploy to Cloudflare Pages
45+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
46+
uses: cloudflare/wrangler-action@v4
47+
with:
48+
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
49+
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
50+
# Pin to the Pages production branch (job is already gated to main).
51+
command: pages deploy docs/out --project-name=edge-python-docs --branch=main

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,12 @@ node_modules/
2222
dist/
2323
*.log
2424

25+
# Next.js / Nextra (docs)
26+
.next/
27+
**/.next/
28+
out/
29+
**/out/
30+
2531
# WASM
2632
pkg/
2733
**/pkg/

docs/README.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Edge Python Docs
2+
3+
## Local Development
4+
Install dependencies
5+
6+
```sh
7+
npm install
8+
```
9+
10+
To run locally:
11+
12+
```sh
13+
npm run dev
14+
```
15+
16+
Submit a PR to Edge Python.
17+
18+
## Note on dev speed
19+
20+
In dev (`npm run dev`), the first visit to each page takes a few seconds because
21+
Next.js compiles routes **on demand** (slower here since the repo lives on the
22+
Windows drive mounted in WSL, `/mnt/c`). Once a page is compiled, navigation is
23+
instant.
24+
25+
This does **not** happen in production: `npm run build` pre-renders every page at
26+
build time (Nextra is static/SSG), so the deployed site serves pre-built HTML and all
27+
navigation is instant.
28+

docs/docs.json

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

docs/globals.css

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/* Centers nav links on x-axis; logo stays left, search/icons right. */
2+
3+
.nextra-nav-container nav {
4+
position: relative;
5+
}
6+
7+
.nextra-nav-container nav > div.nextra-scrollbar {
8+
position: absolute;
9+
left: 50%;
10+
top: 50%;
11+
transform: translate(-50%, -50%);
12+
}

docs/icon.svg

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

docs/next.config.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import nextra from 'nextra'
2+
3+
const withNextra = nextra({
4+
theme: 'nextra-theme-docs',
5+
themeConfig: './theme.config.jsx',
6+
})
7+
8+
export default withNextra({
9+
// Static export for Cloudflare Pages Direct Upload (-> out/).
10+
output: 'export',
11+
images: { unoptimized: true },
12+
// Dev convenience only: redirect the root to the first page. `output: 'export'` ignores this (Cloudflare serves the redirect via public/_redirects in prod).
13+
async redirects() {
14+
return [
15+
{
16+
source: '/',
17+
destination: '/getting-started/quickstart',
18+
permanent: false,
19+
},
20+
]
21+
},
22+
})

0 commit comments

Comments
 (0)