Skip to content

Commit 33c2b40

Browse files
SchahinRohaniaaronmondal
authored andcommitted
Migrate docs buildsystem from pnpm to bun
Fixes TraceMachina#1082
1 parent 0933c1a commit 33c2b40

26 files changed

+630
-7077
lines changed

.github/styles/config/vocabularies/TraceMachina/accept.txt

+2
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,5 @@ quantiles
5353
Config
5454
Grafana
5555
GitHub
56+
Deno
57+
shipstorm

.github/workflows/docs.yaml

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
---
2+
name: Deploy NativeLink Docs
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
permissions: read-all
10+
11+
jobs:
12+
deploy:
13+
name: Docs Deployment
14+
runs-on: ubuntu-24.04
15+
16+
steps:
17+
- name: Checkout
18+
uses: >- # v4.1.1
19+
actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
20+
21+
- name: Install Nix
22+
uses: >- # v10
23+
DeterminateSystems/nix-installer-action@de22e16c4711fca50c816cc9081563429d1cf563
24+
25+
- name: Cache Nix derivations
26+
uses: >- # v4
27+
DeterminateSystems/magic-nix-cache-action@fc6aaceb40b9845a02b91e059ec147e78d1b4e41
28+
29+
- name: Test deployment
30+
working-directory: docs
31+
run: |
32+
nix develop --impure --command bash -c "
33+
bun staging --project=nativelink-docs --org=nativelink
34+
"
35+
if: github.event_name == 'pull_request'
36+
37+
- name: Production deployment
38+
working-directory: docs
39+
run: |
40+
nix develop --impure --command bash -c "
41+
bun prod --project=nativelink-docs --org=nativelink
42+
"
43+
if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request'

docs/.gitignore

+8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# build output
22
dist/
3+
34
# generated types
45
.astro/
56

@@ -11,7 +12,11 @@ npm-debug.log*
1112
yarn-debug.log*
1213
yarn-error.log*
1314
pnpm-debug.log*
15+
bun-debug.log*
16+
bun-error.log*
1417

18+
# tests
19+
test-results
1520

1621
# environment variables
1722
.env
@@ -26,6 +31,9 @@ pnpm-debug.log*
2631
# Generated during the build and only intended to debug bundle size.
2732
stats.html
2833

34+
# Deno Deploy file
35+
deno.json
36+
2937
# Generated files
3038
src/content/docs/contribute/docs.mdx
3139
src/content/docs/contribute/guidelines.mdx

docs/.nvmrc

-1
This file was deleted.

docs/README.md

+23-27
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,10 @@ The NativeLink documentation gets deployed to <https://docs.nativelink.com>.
55
> [!CAUTION]
66
> Setup for working on these docs differs between Linux and Mac.
77
>
8-
> For Linux: Use the Nix flake and run `pnpm i`.
8+
> For Linux: Use the Nix flake and run `bun install`.
99
>
1010
> For Mac: If you're in the Nix flake, exit it, for instance with `direnv
11-
> revoke`. Then manually install `pnpm`, run `pnpm i` and run `pnpm exec
12-
> playwright install`.
11+
> revoke`. Then manually install `bun`, run `bun install` and run `bun preview`
1312
>
1413
> It's a long term goal to add the automated setup to Mac.
1514
@@ -20,58 +19,55 @@ stack. Getting a bunch of bleeding-edge tools to work well together can be
2019
challenging. Feel free to copy-paste it into your own projects.
2120

2221
- [Diátaxis](https://diataxis.fr/) as overarching documentation philosophy.
23-
- [Pnpm](https://github.com/pnpm/pnpm) as production bundler.
24-
- [Bun](https://github.com/oven-sh/bun) as build-time TypeScript interpreter.
22+
- [Bun](https://github.com/oven-sh/bun) as production bundler.
2523
- [Biome](https://biomejs.dev/) as linting toolchain.
2624
- [Astro](https://astro.build/) as meta-framework.
2725
- [Starlight](https://starlight.astro.build/de/) as documentation framework.
2826
- [TailwindCSS 4.0-alpha](https://tailwindcss.com/blog/tailwindcss-v4-alpha) for
2927
component styling which makes use of [LightningCSS](https://lightningcss.dev/)
3028
for faster CSS processing.
31-
- [Cloudflare Pages/Workers](https://pages.cloudflare.com/) for deployments.
29+
- [Deno Deploy](https://deno.com/deploy) for deployments.
3230

3331
## 🚀 Common workflows
3432

3533
See [`docs/package.json`](https://github.com/TraceMachina/nativelink/blob/main/docs/package.json)
3634
for build scripts.
3735

38-
This project requires `pnpm`. The nix flake ships a compatible version.
36+
This project requires `bun`. The nix flake ships a compatible version.
3937

4038
```bash
41-
# Install dependencies with pnpm. Don't install with bun.
42-
pnpm install
39+
# Install dependencies with bun.
40+
bun install
4341

44-
# Rebuild the API reference.
45-
pnpm metaphase
42+
# Rebuild the docs reference.
43+
bun run docs.build
4644

47-
# Rebuild the simple parts of the autogenerated docs.
48-
pnpm transform
45+
# Generate the simple parts of the autogenerated docs.
46+
bun run docs.generate
4947

5048
# Rebuild everything. Make sure to remove the `dist` directory beforehand.
51-
pnpm build
49+
bun run build
50+
51+
# Serve the dist directory with deno
52+
bun serve
5253

5354
# Run a development server. Doesn't rebuild the autogenerated parts of the docs.
54-
pnpm dev
55+
bun dev
5556

5657
# Run formatter and linter checks.
57-
pnpm check
58+
bun check
5859

5960
# Apply formatter and linter fixes.
60-
pnpm fix
61+
bun fix
6162

62-
# Test cloudflare deployments locally. Useful when debugging SSR. Rebuilds the
63+
# Test Deno deployments locally. Useful when debugging SSR. Rebuilds the
6364
# autogenerated parts of the docs.
64-
pnpm preview
65+
bun preview
6566
```
6667

67-
When deploying to Cloudflare, make sure to set the `PNPM_VERSION` to `8.15.5` to
68-
stay in sync with the flake. Also, use `pnpm exec playwright install && pnpm
69-
build` on the Cloudflare worker. This sets up headless Chromium which to
70-
generate mermaid diagrams during the build. You don't need to set playwright up
71-
locally as it's already configured in the flake.
7268

7369
## 🐛 Known issues
7470

75-
- The build process uses Bun as internal TypeScript processor, but can't use it
76-
as bundler yet.
77-
- `"@playform/compress": "=0.0.12"` because `0.0.13` doesn't compress CSS.
71+
- `bun run docs.build` doesn't work on MacOS with the nix version of Bazel.
72+
As a workaround install Bun and Bazel on your host and build the docs outside the flake.
73+
- `bun dev` doesn't reload the changes in the starlight.conf.ts

0 commit comments

Comments
 (0)