Skip to content

ci: deploy to Cloudflare Workers - #32

Merged
saimeunt merged 8 commits into
mainfrom
workers-deploy
Oct 21, 2026
Merged

saimeunt merged 8 commits into
mainfrom
workers-deploy

Conversation

@saimeunt

@saimeunt saimeunt commented Oct 20, 2026 •

Copy link
Copy Markdown
Member

Cloudflare Workers

The Docusaurus build is fully static, so it's served as a Workers static assets deployment with no Worker script (wrangler.jsonc):

  • docs.walnut.dev as a custom domain, plus walnut-docs.walnuthq.workers.dev (workers_dev: true).
  • html_handling: drop-trailing-slash matches trailingSlash: false; unknown paths get Docusaurus's 404.html.

Workflows copied from walnut-landingpage:

  • deploy-cloudflare.yml: pushes to main deploy to production.
  • preview-cloudflare.yml: each PR is uploaded as a preview version at https://pr-<number>-walnut-docs.walnuthq.workers.dev, and the URL is commented on the PR. Production is untouched.

Both use the CLOUDFLARE_API_TOKEN and CLOUDFLARE_ACCOUNT_ID repo secrets, which are set.

npm → pnpm 12.14.0

Same setup as walnut-landingpage. pnpm-lock.yaml was imported from package-lock.json to keep the versions that were working. Two things pnpm's strict node_modules surfaced:

  • Packages imported without being declared (@docusaurus/theme-common, lunr, hogan.js, autocomplete.js, mark.js) are now direct dependencies.
  • The old .npmrc (ignore-scripts=true) is replaced by allowBuilds in pnpm-workspace.yaml: only esbuild and workerd run build scripts.

Dependency upgrades

Everything is on its latest version, one commit per major upgrade:

  • Docusaurus 3.7.0 → 3.10.2, React 19.0 → 19.3. onBrokenMarkdownLinks moved to markdown.hooks (deprecated since Docusaurus 3.9).
  • openapi-docs plugin and theme 4 → 5. Clears the React 19 peer dependency warnings.
  • TypeScript 5.6 → 7.0. baseUrl is unset in tsconfig.json, since TS 7 removed it and @docusaurus/tsconfig still sets it.
  • dotenv 17 → 18, autocomplete.js 0.37 → 0.38.

Scripts

  • deploy / upload / preview run wrangler, replacing docusaurus deploy (GitHub Pages).
  • Removed write-translations (English only) and clean-api (build already deletes api-docs).
  • start and build share gen-api, which regenerates api-docs from scratch.

Testing

  • Frozen install, typecheck and build pass after every upgrade step.
  • Also built with starknetApi on: the 4 API pages generate and postprocess-api.mjs applies.
  • Checked in a browser under wrangler dev: pages, search, the how-to guides index and the 404 page work, with no console errors.

Not tested: the EVM API section, because https://evm.walnut.dev/api/openapi.json was unreachable.

Serve the static Docusaurus build as a Workers static assets deployment on
docs.walnut.dev and walnut-docs.walnuthq.workers.dev. Pushes to main deploy
to production; pull requests are uploaded as preview versions at
pr-<number>-walnut-docs.walnuthq.workers.dev.

Switch from npm to pnpm 12.14.0, as in walnut-landingpage. The lockfile is
imported from package-lock.json to keep the same versions, and packages that
were imported without being declared are now direct dependencies.
Docusaurus 3.10.2, React 19.3.1, TypeScript 5.9.3, wrangler 4.151.2 and
@mdx-js/react 3.1.1. Moves onBrokenMarkdownLinks to markdown.hooks, where
Docusaurus 3.9 deprecated the top-level option.
Requires Docusaurus 3.10 and drops the redux dependencies whose peer ranges
excluded React 19.
TypeScript 7 removed baseUrl, which @docusaurus/tsconfig still sets, so it is
unset here and the @site/* path is redeclared relative to this tsconfig.
Drop write-translations (the site is English only) and clean-api (build
already deletes api-docs, and pnpm docusaurus clean-api-docs all still works).
start and build now share gen-api, which recreates api-docs from scratch, so
start no longer serves API pages left over from a disabled section.
pnpm forwards the -- as-is, and wrangler then treats --preview-alias as a
positional argument and ignores it.
@github-actions

Copy link
Copy Markdown

Preview: https://pr-32-walnut-docs.walnuthq.workers.dev

Built from 10baa9a.

@marijamijailovic marijamijailovic left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! LGTM!

Base automatically changed from dpm-trace-docs to main October 21, 2026 07:59
@saimeunt
saimeunt merged commit 73e49a0 into main Oct 21, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants