Use Scratch Foundation's scratch-gui instead of our fork - #1646
Conversation
Upstream v15 added GUIStorage.getLibraryAssetUrl, which does what our fork's libraryAssetUrlTemplate prop did, so the fork no longer carries any code we need. Depend on @scratch/scratch-gui 15.1.1 from public npm and supply getLibraryAssetUrl from scratch-frame instead. Also serve the Scratch chunks from both /chunks/ and /scratch-gui/chunks/. Workers such as scratch-storage's fetch-worker resolve against the server root, while lazy-loaded chunks such as v15's new paper-source resolve against the bundle's publicPath. 13.7.3 had no paper-source, so one base was enough; with v15 a missing fetch-worker leaves project loading hanging with no error at all. Leaves .yarnrc.yml and NPM_AUTH_TOKEN in place. Removing the GitHub Packages config is deliberately a follow-up, so reverting to the fork stays easy until this is proven in production. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
🔵 Needs a closer look
The migration spans dependencies, asset URLs, and chunk loading, while setup documentation still references the private package.
Pull request overview
Switches Scratch Frame from the private Scratch GUI fork to upstream @scratch/scratch-gui 15.1.1 and updates asset and chunk handling.
Changes:
- Configures library asset URLs through
scratch-frame. - Serves Scratch chunks from both required paths.
- Updates dependencies, lockfile, and related tests.
File summaries
| File | Description |
|---|---|
yarn.lock |
Updates dependency resolution. |
apps/scratch-frame/vite.config.js |
Serves chunks from both paths. |
apps/scratch-frame/src/WrappedScratchGui.test.jsx |
Tests GUI storage configuration. |
apps/scratch-frame/src/WrappedScratchGui.jsx |
Configures library asset URLs. |
apps/scratch-frame/src/utils/libraryAssetUrl.test.js |
Tests URL generation. |
apps/scratch-frame/src/utils/libraryAssetUrl.js |
Builds library asset URLs. |
apps/scratch-frame/src/ScratchEditor.test.jsx |
Updates related expectations. |
apps/scratch-frame/src/ScratchEditor.jsx |
Removes fork-specific configuration. |
apps/scratch-frame/package.json |
Switches to upstream Scratch GUI. |
Review details
Suppressed comments (1)
apps/scratch-frame/package.json:5
- This switches the workspace to the public
@scratch/scratch-gui, butREADME.md:9-40anddocs/linking-scratch-editor.md:3-5,91-97still say the app uses the private@RaspberryPiFoundation/scratch-gui, requireNPM_AUTH_TOKEN, and restore that old package pin. Those instructions are now incorrect for a normal install; please update the dependency/setup documentation along with this change.
"@scratch/scratch-gui": "15.1.1",
- Files reviewed: 8/9 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
DNR500
left a comment
There was a problem hiding this comment.
Nice one. Looks good to me. I checked the actual new Scratch package and the pieces it needs (the asset URL setting, the file-serving change) all line up correctly, so this should work as intended.
One small thing: the setup instructions in the README still talk about the old private package and won't match what's actually needed anymore. Not urgent and doesn't affect how the app runs - just needs updating at some point so it doesn't confuse anyone setting up the project fresh. Maybe this can be included on the clean up ticket.
Approving.
closes https://github.com/RaspberryPiFoundation/digital-editor-issues/issues/1772
Upstream v15 added GUIStorage.getLibraryAssetUrl, which does what our fork's libraryAssetUrlTemplate prop did, so the fork no longer carries any code we need. Depend on @scratch/scratch-gui 15.1.1 from public npm and supply getLibraryAssetUrl from scratch-frame instead.
Also serve the Scratch chunks from both /chunks/ and /scratch-gui/chunks/. Workers such as scratch-storage's fetch-worker resolve against the server root, while lazy-loaded chunks such as v15's new paper-source resolve against the bundle's publicPath. 13.7.3 had no paper-source, so one base was enough; with v15 a missing fetch-worker leaves project loading hanging with no error at all.
Leaves .yarnrc.yml and NPM_AUTH_TOKEN in place. Removing the GitHub Packages config is deliberately a follow-up, so reverting to the fork stays easy until this is proven in production.