chore(playground): add browser-only IDE for writing and exporting a Forge game - #579
Open
stormmuller wants to merge 1 commit into
Open
chore(playground): add browser-only IDE for writing and exporting a Forge game#579stormmuller wants to merge 1 commit into
stormmuller wants to merge 1 commit into
Conversation
…rge game Adds /playground, a standalone Vite + Monaco + @typescript/vfs + esbuild-wasm app for writing a small single-file Forge game in the browser and downloading it as a self-contained index.html + game.js zip, entirely client-side. - Monaco is configured with Forge's real type declarations as extra libs, so autocomplete/hover/inline diagnostics work against Forge's actual API. - @typescript/vfs powers an independent, in-browser TypeScript language service used to type-check the game source before every build. - esbuild-wasm bundles the game through a custom resolver plugin that resolves @forge-game-engine/forge/<subpath> imports (and Forge's internal imports/seedrandom dependency) against Forge's own compiled dist output, embedded into the app bundle via import.meta.glob, so Forge is inlined into the downloaded game rather than referenced externally. - fflate zips the generated index.html and bundled game.js for download. Verified end-to-end via Playwright: typed a game in the editor, clicked Build, and confirmed the downloaded zip's index.html renders and animates correctly in a real browser.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
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.
Summary
Adds
/playground, a bare-bones, browser-only IDE for writing a small Forge game and downloading it as a self-containedindex.html+game.jszip - no backend involved, matching the requested stack (Vite + Monaco +@typescript/vfs+ esbuild-wasm, no React).src/editor/forge-types.ts), so autocomplete, hover, and inline diagnostics work against Forge's actual public API (@forge-game-engine/forge/<subpath>imports).@typescript/vfspowers an independent, in-browser TypeScript language service (src/editor/type-check.ts) that type-checks the game source before every build - esbuild only strips types, it never checks them.src/build/forge-esbuild-plugin.ts) that resolves@forge-game-engine/forge/<subpath>imports - plus Forge's own internal relative imports and its one runtime dependency (seedrandom) - against Forge's compileddistoutput, embedded into the app bundle at build time viaimport.meta.glob. Forge is inlined into the downloaded game rather than referenced externally.index.htmland bundledgame.jsand triggers a browser download./playgroundis a separate npm project (its ownpackage.json/node_modules), the same pattern as/documentation-site, depending on@forge-game-engine/forgevia afile:..link resolved throughdist. Seeplayground/README.mdand the new "Browser Playground" section inAGENTS.mdfor the full architecture and gotchas.Titled
chore(excluded from the changelog requirement) since this adds a repo-internal dev tool with no effect on the published@forge-game-engine/forgepackage's API or behavior.Related issue(s)
N/A
Verification checklist
npm run check-typespasses with 0 errorsnpm testpassesnpm run lintpasses with 0 errorsnpm run cspellpasses with 0 errorsnpm run check-exportspasses/src; not applicable/srcmodule with an existing demo was touchedplayground/verified independently:npm run typecheck(fromplayground/) passes with 0 errors, and the full flow (type-check → bundle → zip → download) was exercised end-to-end via Playwright - typed the default game in the editor, clicked Build, extracted the downloaded zip, and confirmed it renders and animates correctly in a real browser.Changelog
chore) since this change has no effect on the published package.Generated by Claude Code