fix(cloudflare): relocate wrangler.jsonc into apps/registry/#107
Merged
Conversation
The ask-docs Cloudflare Pages build was failing with: Error: Output directory "apps/registry/dist" not found. Root cause: Pages auto-discovers wrangler config from the Root directory. Because ask-docs pointed its Root at the repo root, it picked up the registry-specific wrangler.jsonc (pages_build_output_dir: apps/registry/dist) and looked for output the docs build never produces. Fix: move wrangler.jsonc from the repo root into apps/registry/ so each Pages project has its own wrangler config next to its own source. Adjust pages_build_output_dir from apps/registry/dist to dist (now relative to apps/registry/) and the $schema path accordingly. Drop --config ../../wrangler.jsonc from the preview:cf script since wrangler auto-detects the config in the same folder. Requires paired Cloudflare Pages dashboard changes (see PR body): - ask-registry: Root directory / -> apps/registry, build output dist - ask-docs: Root directory / -> apps/docs
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Contributor
There was a problem hiding this comment.
No issues found across 2 files
Architecture diagram
sequenceDiagram
participant Git as GitHub / Git
participant Pages as Cloudflare Pages
participant Registry as apps/registry
participant Docs as apps/docs
participant Turbo as Turborepo
participant Schema as @pleaseai/ask-schema
Note over Git,Schema: Deploy Flow after PR
Git->>Pages: Push / Merge to branch
Pages->>Pages: Trigger both Pages projects
par ask-registry deploy
Pages->>Registry: NEW: Root directory = apps/registry
Pages->>Registry: NEW: Build command = cd ../.. && bun install && bun run build -- --filter=@pleaseai/ask-registry
Registry->>Turbo: CHANGED: Resolve wrangler.jsonc from apps/registry/
Turbo->>Schema: Build dependency (^build)
Schema-->>Turbo: dist/ outputs
Turbo->>Registry: Build Nuxt app
Registry->>Registry: Output to apps/registry/dist/
Pages->>Registry: NEW: Read output from dist/ (relative to Root)
Pages-->>Git: Preview deployment URL
and ask-docs deploy
Pages->>Docs: NEW: Root directory = apps/docs
Pages->>Docs: NEW: Build command = cd ../.. && bun install && bun run --cwd apps/docs build
Docs->>Docs: CHANGED: No longer picks up wrangler.jsonc from repo root
Docs->>Docs: Build docs app
Pages->>Docs: Read output from dist/ (relative to Root)
Pages-->>Git: Preview deployment URL
end
Note over Pages: Both projects now have isolated wrangler.jsonc configs
alt Any preview fails
Pages-->>Git: Block merge
Note over Git: Do not merge - revert dashboard settings
else Both previews succeed
Git->>Pages: Promote to production
end
Auto-approved: This PR relocates the wrangler.jsonc configuration into the apps/registry directory and adjusts relative paths to fix a Cloudflare Pages build conflict, with no changes to business logic, data, or security.
Re-trigger cubic
Deploying ask with
|
| Latest commit: |
034d87d
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://ca89258c.ask-6im.pages.dev |
| Branch Preview URL: | https://fix-cloudflare-pages-wrangle.ask-6im.pages.dev |
Deploying ask-registry with
|
| Latest commit: |
034d87d
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://8badaee9.ask-registry.pages.dev |
| Branch Preview URL: | https://fix-cloudflare-pages-wrangle.ask-registry.pages.dev |
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.
What
wrangler.jsoncfrom the repo root intoapps/registry/wrangler.jsoncpages_build_output_dir:apps/registry/dist→dist(now resolved under the new Root directory)$schemapath:apps/registry/node_modules/wrangler/config-schema.json→node_modules/wrangler/config-schema.json--config ../../wrangler.jsoncfromapps/registry'spreview:cfscript (same-folder auto-detection)Why
The previous
ask-docsCloudflare Pages build failed withError: Output directory "apps/registry/dist" not found.because Pages auto-detected the rootwrangler.jsonc(registry-scoped) while the build command targetedapps/docs. With each project's wrangler file living next to its own project, the cross-project leak disappears.This PR will not unblock the deploy on its own. After merge, update both Pages projects:
ask-registryRoot directory:
/→apps/registryBuild command (one of):
cd ../.. && bun install && bun run build -- --filter=@pleaseai/ask-registrycd ../.. && bun install && turbo run build --filter=@pleaseai/ask-registry(turbo's
dependsOn: ["^build"]ensures@pleaseai/ask-schemabuilds first — required because the registry imports itsdist/exports viaworkspace:*.)Build output directory:
distask-docsRoot directory:
/→apps/docs(uses the existingapps/docs/wrangler.jsonc)Build command:
cd ../.. && bun install && bun run --cwd apps/docs build(Still routes through the repo-root
bun installso the hoistednode_modules, rootpostinstallh3 cleanup, anddocs-pleasepatch all apply.)Verification plan
Why option 2 over option 1 (kept ask-docs Root = repo root)
Option 1 (only changing ask-docs Root directory) would have fixed the immediate failure with no code changes, but it left the asymmetry — registry config at repo root, docs config inside its app folder. Option 2 makes both projects symmetric (each has its own
apps/<name>/wrangler.jsonc) at the cost of also moving the registry's Cloudflare Pages Root, which requires a non-trivial Build command change to preserve the schema workspace dep build order. The trade-off was discussed and option 2 was chosen for the cleaner long-term shape.Summary by cubic
Moved the Cloudflare Pages
wrangler.jsoncintoapps/registry/and updated paths to stopask-docsfrom picking up registry config. This fixes the “output directory not found” error and simplifies localwranglerpreview.cd ../.. && bun install && bun run build -- --filter=@pleaseai/ask-registry; Output=distcd ../.. && bun install && bun run --cwd apps/docs buildWritten for commit 034d87d. Summary will update on new commits.