Host the example on Cloudflare Pages: embed mode, CI route checks - #3
Merged
Merged
Conversation
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.
Prepares the example to run as a hosted demo on Cloudflare Pages and to be embedded in documentation pages.
Changes
?embed=1. Set once insrc/App.tsx: the layout route reads the query string, drops the navigation and adds anembedclass that hides the route heading. Works on every route.BrowserRouter), and Pages already servesindex.htmlfor any path that is not a file when the build has no top level404.html. Apublic/_redirectswith/* /index.html 200was tried and dropped: Wrangler rejects it as an infinite loop rule and ignores it. Build commandnpm run build, output directorydist,VITE_variables set as build variables. Documented in a new "Hosting on Cloudflare" README section at the end.DEMO_EVENT_KEYandDEMO_PUBLIC_KEYrepository secrets exist (optionalDEMO_SEASON_KEY), it serves the build withnpm run previewand runsscripts/check-routes.mjs, which loads every route with and without?embed=1in Chromium and fails on an HTTP error, an uncaught exception, a console error, or a visible navigation in embed mode. Forks without the secrets only build.VITE_SEATLAYER_EVENT_KEY_2/_3(as in a copied.env.example) now falls back to the main key instead of producing an empty key.Verification
npm ci && npm run build.vite previewwithout keys:scripts/check-routes.mjspasses on all 12 route and embed combinations (setup notices, no console errors, navigation hidden with?embed=1).wrangler pages dev dist:/,/seat-picker,/events?embed=1,/control-roomand an unknown path all returnindex.htmlwith 200, and the route check passes against it.Nothing was deployed.
Held: merge when the hosted demo is ready.