Repository navigation
ci: deploy to Cloudflare Workers - #32
Merged
Merged
Conversation
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.
|
Preview: https://pr-32-walnut-docs.walnuthq.workers.dev Built from 10baa9a. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.devas a custom domain, pluswalnut-docs.walnuthq.workers.dev(workers_dev: true).html_handling: drop-trailing-slashmatchestrailingSlash: false; unknown paths get Docusaurus's404.html.Workflows copied from walnut-landingpage:
deploy-cloudflare.yml: pushes tomaindeploy to production.preview-cloudflare.yml: each PR is uploaded as a preview version athttps://pr-<number>-walnut-docs.walnuthq.workers.dev, and the URL is commented on the PR. Production is untouched.Both use the
CLOUDFLARE_API_TOKENandCLOUDFLARE_ACCOUNT_IDrepo secrets, which are set.npm → pnpm 12.14.0
Same setup as walnut-landingpage.
pnpm-lock.yamlwas imported frompackage-lock.jsonto keep the versions that were working. Two things pnpm's strictnode_modulessurfaced:@docusaurus/theme-common,lunr,hogan.js,autocomplete.js,mark.js) are now direct dependencies..npmrc(ignore-scripts=true) is replaced byallowBuildsinpnpm-workspace.yaml: onlyesbuildandworkerdrun build scripts.Dependency upgrades
Everything is on its latest version, one commit per major upgrade:
onBrokenMarkdownLinksmoved tomarkdown.hooks(deprecated since Docusaurus 3.9).baseUrlis unset intsconfig.json, since TS 7 removed it and@docusaurus/tsconfigstill sets it.Scripts
deploy/upload/previewrun wrangler, replacingdocusaurus deploy(GitHub Pages).write-translations(English only) andclean-api(build already deletesapi-docs).startandbuildsharegen-api, which regeneratesapi-docsfrom scratch.Testing
starknetApion: the 4 API pages generate andpostprocess-api.mjsapplies.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.jsonwas unreachable.