Skip to content

Use Scratch Foundation's scratch-gui instead of our fork - #1646

Merged
jamiebenstead merged 2 commits into
mainfrom
upgrade-to-public-scratch-gui
Sep 21, 2026
Merged

jamiebenstead merged 2 commits into
mainfrom
upgrade-to-public-scratch-gui

Conversation

@jamiebenstead

Copy link
Copy Markdown
Contributor

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.

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>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 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, but README.md:9-40 and docs/linking-scratch-editor.md:3-5,91-97 still say the app uses the private @RaspberryPiFoundation/scratch-gui, require NPM_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 DNR500 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@jamiebenstead
jamiebenstead merged commit 87a3669 into main Sep 21, 2026
11 checks passed
@jamiebenstead
jamiebenstead deleted the upgrade-to-public-scratch-gui branch September 21, 2026 10:23

This branch was successfully deployed

1 active deployment
previews/1646/merge — 923e4669 Deployed Sep 18, 2026 by jamiebenstead via deploy-branch / build-deploy #6758
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants