Repository navigation
Trim the web build and serve it the way a host would - #1
Merged
Merged
Conversation
Everything here is small next to the ~10MB CPython runtime the page pulls from the pygbag CDN, but it removes files nothing reads and the debug chrome that does not belong in an embed on a portfolio page. Output goes from 77KB to 34KB. - Drop the .apk. pygbag emits both an .apk and a .tar.gz holding the same files, and the loader only reads the .apk when the page is hosted on itch.io. Every other host takes the .tar.gz. - Drop pygbag's favicon and its link tag, which mean nothing inside an iframe, and the browserfs.min.js script tag, which pygbag emits with a doubled slash so the CDN 404s it on every load. - Turn off the xterm.js debug console and the audio shim via data-os. The console is ~90KB over the wire and this game has no sound. Python output still reaches the browser console. - Make the page transparent behind the canvas. pygbag paints it flat grey, once in CSS and again from JS after boot, which would sit as a grey box inside a themed page. Also stop passing --serve through to pygbag. Its test server rewrites the CDN URLs to proxy through itself, so what you were testing was not what a real host serves. The build now always produces the trimmed output and --serve hands it to a plain static server afterwards. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Lint, tests and the web build run on every pull request. On a push to main the built bundle goes to the portfolio site as a pull request, so each build is reviewed on its Vercel preview before it ships. The demo on the site is an iframe served from the site's own public/ folder so that it is same-origin, so the built files have to live in that repo. GITHUB_TOKEN cannot reach another repository, so publishing uses a fine-grained PAT and a machine-owned branch that is rebuilt and force-pushed each run, keeping one pull request open instead of a pile. The tests drive the state machine a frame at a time rather than running Game.run, which loops until the window closes, and run headless under SDL's dummy driver. They lean towards the bugs the README calls out, including the two pygbag traps that only surface in a browser. build_web.py grows a --strict flag. A pygbag upgrade can change the markup the trims rewrite; without it the build would still succeed and ship an embed with a grey box around it. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.
No description provided.