Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Spike adding Scratch project type #1159

Draft
wants to merge 13 commits into
base: main
Choose a base branch
from

Conversation

floehopper
Copy link
Contributor

No description provided.

@floehopper floehopper temporarily deployed to previews/1159/merge January 8, 2025 16:52 — with GitHub Actions Inactive
@floehopper floehopper force-pushed the spike-add-scratch-project-type branch from 42321ff to 847c7aa Compare January 8, 2025 17:00
@floehopper floehopper temporarily deployed to previews/1159/merge January 8, 2025 17:00 — with GitHub Actions Inactive
@floehopper floehopper force-pushed the spike-add-scratch-project-type branch from 847c7aa to cdb854a Compare January 8, 2025 17:06
@floehopper floehopper temporarily deployed to previews/1159/merge January 8, 2025 17:08 — with GitHub Actions Inactive
@floehopper floehopper force-pushed the spike-add-scratch-project-type branch from cdb854a to dcc327a Compare January 8, 2025 17:20
@floehopper floehopper temporarily deployed to previews/1159/merge January 8, 2025 17:20 — with GitHub Actions Inactive
NOTE that the Scratch GUI is rendering but with many errors and without
the assets that are currently missing.

Add ./scratch folder that attempts to generate the JS we need to embed
the Scratch editor in the iframe that renders scratch-component.html.

./scratch/src/index.jsx is a modified copy of both:

- https://github.com/scratchfoundation/scratch-gui/blob/141427d43db9e4471f8b628daa9f7c0c2c6d795f/src/playground/index.jsx
- https://github.com/scratchfoundation/scratch-gui/blob/141427d43db9e4471f8b628daa9f7c0c2c6d795f/src/playground/render-gui.jsx

Use `yarn start` to use webpacker dev server to make the editor
available at localhost:3011.

Use `yarn build` to generate the scratch/dist/main.js file that's then
copied by Webpack and required in scratch-component.html.
@chrisroos chrisroos temporarily deployed to previews/1159/merge January 9, 2025 14:59 — with GitHub Actions Inactive
@floehopper floehopper force-pushed the spike-add-scratch-project-type branch from a0153b1 to dcc327a Compare January 9, 2025 16:09
@floehopper floehopper temporarily deployed to previews/1159/merge January 9, 2025 16:09 — with GitHub Actions Inactive
* Use the CCW fork of the scratch-gui project so that we can set the
  `menuBarHidden` property to hide the menu bar.

* Don't set `backpackVisible` or `backpackHost` properties, because we
  probably don't want to display this. TODO: Check whether CS First
  displays it.

* Don't set `canEditTitle`, `showComingSoon` or `onClickLogo`
  properties, because they all relate to things that are displayed in
  the menu bar.

* Remove the code relating to `simulateScratchDesktop` - I don't think
  we need it! TODO: Check this!

* Copy the relevant assets from the scratch-gui package so that they are
  made available at the expected URLs. Note that the location of the
  assets has changed in newer versions of the scratch-gui package.

* Remove files in the `scratch/dist` directory from the git repo and
  ignore files in that directory.
now that we are compiling from ccw/scratch-gui fork
Although `yarn build` worked locally it appears that this is only
because of the availability of installed packages in the parent
directory. Running `yarn build` on GitHub CI fails because these
packages aren't yet available.

We've specified the versions of the packages that we need by copying the
versions from package.json in the RPI fork of scratch-gui[1]. This is
because our scratch/src/index.jsx file is essentially a modified version
of a combination of scratch-gui/src/playground/index.jsx and
render-gui.jsx so we think it makes sense to use the same versions of
the third party libraries. We change the babel react preset for the same
reason.

[1]: https://github.com/RaspberryPiFoundation/scratch-gui/blob/code-club-world/package.json
@chrisroos chrisroos temporarily deployed to previews/1159/merge January 13, 2025 11:21 — with GitHub Actions Inactive
now that we are using rpf fork
@chrisroos chrisroos temporarily deployed to previews/1159/merge January 13, 2025 11:24 — with GitHub Actions Inactive
we are seeing syntax errors in prod but can't see where they're coming
from. this should help.
@chrisroos chrisroos temporarily deployed to previews/1159/merge January 13, 2025 11:41 — with GitHub Actions Inactive
@chrisroos chrisroos temporarily deployed to previews/1159/merge January 13, 2025 11:58 — with GitHub Actions Inactive
@chrisroos chrisroos temporarily deployed to previews/1159/merge January 13, 2025 12:02 — with GitHub Actions Inactive
@chrisroos chrisroos temporarily deployed to previews/1159/merge January 13, 2025 12:37 — with GitHub Actions Inactive
@chrisroos chrisroos temporarily deployed to previews/1159/merge January 13, 2025 14:19 — with GitHub Actions Inactive
while we are focussed on getting deployment working
Using the html webpack copy plugin meant that our scratch-component.html
page ended up with script tags loading both web-component.js and
PyodideWorker.js (corresponding to `entry` keys in webpack.config.js).
We don't need those in scratch-component.html and we want to rule out
whether their presence is causing the errors we're currently seeing when
deploying editor-ui using github actions.
@floehopper floehopper force-pushed the spike-add-scratch-project-type branch from 2f1a8ab to b422e06 Compare January 13, 2025 16:17
@floehopper floehopper temporarily deployed to previews/1159/merge January 13, 2025 16:17 — with GitHub Actions Inactive
The scratch directory webpack config now dynamically injects a script
tag and includes a content hash in the scratch.js filename, e.g.
scratch.dc000fc4af51426aea0c.js. We're hoping that this will bust the
Cloudflare cache whenever the source, `scratch/src/index.jsx`, changes.
@floehopper floehopper temporarily deployed to previews/1159/merge January 13, 2025 17:01 — with GitHub Actions Inactive
And change page title to something more sensible.
@floehopper floehopper temporarily deployed to previews/1159/merge January 13, 2025 17:20 — with GitHub Actions Inactive
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.

2 participants