diff --git a/.github/workflows/ci-cd.yml b/.github/workflows/ci-cd.yml index d06e4e120..94ac87e8b 100644 --- a/.github/workflows/ci-cd.yml +++ b/.github/workflows/ci-cd.yml @@ -17,9 +17,6 @@ permissions: jobs: lint: runs-on: ubuntu-latest - env: - NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - NPM_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} steps: - name: Checkout uses: actions/checkout@v4 @@ -40,9 +37,6 @@ jobs: with: node-version-file: .tool-versions cache: "yarn" - registry-url: "https://npm.pkg.github.com" - # Defaults to the user or organization that owns the workflow file - scope: "@RaspberryPiFoundation" - name: Install code run: yarn install --immutable @@ -56,9 +50,6 @@ jobs: test: runs-on: ubuntu-latest - env: - NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - NPM_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} steps: - name: Checkout uses: actions/checkout@v1 @@ -68,9 +59,6 @@ jobs: with: node-version-file: .tool-versions cache: "yarn" - registry-url: "https://npm.pkg.github.com" - # Defaults to the user or organization that owns the workflow file - scope: "@RaspberryPiFoundation" - name: Install code run: yarn install --immutable @@ -86,8 +74,6 @@ jobs: test-cypress: runs-on: ubuntu-latest env: - NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - NPM_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} REACT_APP_API_ENDPOINT: "https://test-editor-api.raspberrypi.org" PUBLIC_URL: "http://localhost:3011" ASSETS_URL: "http://localhost:3011" @@ -103,9 +89,6 @@ jobs: with: node-version-file: .tool-versions cache: "yarn" - registry-url: "https://npm.pkg.github.com" - # Defaults to the user or organization that owns the workflow file - scope: "@RaspberryPiFoundation" - name: Install code run: yarn install --immutable diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index dfab957d6..499bb0b6f 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -114,8 +114,6 @@ jobs: url: ${{ needs.setup-environment.outputs.public_url }} env: HAS_CLOUDFLARE_SECRETS: ${{ secrets.CLOUDFLARE_ZONE_ID != '' && secrets.CLOUDFLARE_API_TOKEN != '' }} - NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - NPM_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} steps: - name: Check deployment path run: | @@ -132,9 +130,6 @@ jobs: with: node-version-file: .tool-versions cache: "yarn" - registry-url: "https://npm.pkg.github.com" - # Defaults to the user or organization that owns the workflow file - scope: "@RaspberryPiFoundation" - name: Install code run: yarn install --immutable diff --git a/.npmrc b/.npmrc deleted file mode 100644 index 5cac20b35..000000000 --- a/.npmrc +++ /dev/null @@ -1,2 +0,0 @@ -@RaspberryPiFoundation:registry=https://npm.pkg.github.com -//npm.pkg.github.com/:_authToken=${NPM_AUTH_TOKEN} diff --git a/.yarnrc.yml b/.yarnrc.yml index 7ee9a5b14..93d3a1dc6 100644 --- a/.yarnrc.yml +++ b/.yarnrc.yml @@ -8,15 +8,9 @@ nodeLinker: node-modules yarnPath: .yarn/releases/yarn-4.12.0.cjs -npmScopes: - RaspberryPiFoundation: - npmRegistryServer: "https://npm.pkg.github.com" - npmAuthToken: "${NPM_AUTH_TOKEN:-}" - npmMinimalAgeGate: 7d npmPreapprovedPackages: - "@raspberrypifoundation/design-system-react" - "@raspberrypifoundation/design-system-core" - - "@RaspberryPiFoundation/scratch-gui" - "@raspberrypifoundation/python-friendly-error-messages" \ No newline at end of file diff --git a/README.md b/README.md index a0053ef27..e91b825e4 100644 --- a/README.md +++ b/README.md @@ -6,42 +6,8 @@ This project provides a web component containing the Raspberry Pi Code Editor fo This repository uses Yarn (see `package.json` → `packageManager`). -The scratch-frame project depends on `@RaspberryPiFoundation/scratch-gui` which is installed from [GitHub Packages](https://github.com/RaspberryPiFoundation/scratch-editor/pkgs/npm/scratch-gui). Complete the steps below, then run `yarn install`. - -Or skip installing scratch-frame dependencies run: `yarn workspaces focus @raspberrypifoundation/editor-ui` - -### Set a personal access token - -If you don't already have this set up you will need it to access deps in the RPF private registry - -1. On GitHub, create a **classic** personal access token: [Settings → Developer settings → Personal access tokens](https://github.com/settings/tokens). Enable **`read:packages`** and **`repo`**. For packages tied to private repositories, `read:packages` alone can cause `yarn install` to fail with `401`/`403`. -2. If your organisation uses SAML SSO, open the token on GitHub and **Authorize** it for **RaspberryPiFoundation** (Configure SSO). -3. Add the token to your shell profile (for example `~/.zshrc` on macOS): - - ```bash - export GITHUB_TOKEN=ghp_your_token_here - export NPM_AUTH_TOKEN=$GITHUB_TOKEN - ``` - - Replace `ghp_your_token_here` with your token. - -4. Load the profile in any terminal you are currently using for this project: - - ```bash - source ~/.zshrc - ``` - -5. Confirm GitHub Packages is reachable from this directory: - - ```bash - yarn npm info @RaspberryPiFoundation/scratch-gui version - ``` - - You should see the version pinned in `package.json` (for example `13.7.3-code-classroom.20260522151700`), not an authentication error. If you see `unauthenticated` or `401`, run `source ~/.zshrc` again or check the token scopes and SSO authorisation. - -6. When you use Docker, run `docker compose up` from a shell where `NPM_AUTH_TOKEN` is set. Compose passes it from the host into the container so `yarn install` can run there too. - -Then install dependencies: +All dependencies come from the public npm registry, so no authentication is +needed. Install with: ``` yarn install @@ -319,10 +285,6 @@ Python code snippets are styled and syntax-highlighted using the `language-pytho print('hello world') ``` -### Linking a local scratch-editor (Scratch GUI) - -See [docs/linking-scratch-editor.md](./docs/linking-scratch-editor.md) for local scratch-editor linking instructions. - ## Deployment Deployment is managed through Github actions. The UI is deployed to staging and production environments through an S3 bucket, managed via Cloudflare. This requires the following environment variables to be set diff --git a/docker-compose.yml b/docker-compose.yml index 2ac75a5f2..11ea88703 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,8 +1,6 @@ x-app: &x-app build: context: . - environment: - NPM_AUTH_TOKEN: ${NPM_AUTH_TOKEN} volumes: - .:/app - node_modules:/app/node_modules diff --git a/docs/linking-scratch-editor.md b/docs/linking-scratch-editor.md deleted file mode 100644 index c457a18e8..000000000 --- a/docs/linking-scratch-editor.md +++ /dev/null @@ -1,101 +0,0 @@ -# Linking a local scratch-editor (Scratch GUI) - -When you are working on the [Raspberry Pi Foundation scratch-editor](https://github.com/RaspberryPiFoundation/scratch-editor) fork (for example changes to `scratch-gui`), you may want editor-ui to load that build instead of the `@RaspberryPiFoundation/scratch-gui` version from GitHub Packages. - -**Use the `code-classroom` branch** in scratch-editor as your base for editor-ui work. That branch is the integration line for this editor (RPF packaging, publish, and GUI props such as `libraryAssetUrlTemplate`). Check it out before you link or build: - -```bash -cd ../scratch-editor -git fetch origin -git checkout code-classroom -``` - -Feature work should branch from `code-classroom`, not from upstream `main` or `code-classroom-base`. - -editor-ui does not bundle Scratch GUI into the main Vite build. `apps/scratch-frame`'s own Vite config copies a prebuilt `dist/scratch-gui.js` (and static assets) from `node_modules` into its dev server / build output via `vite-plugin-static-copy`. Pointing the dependency at your local clone is enough to test GUI changes in the Scratch iframe. - -**Do not commit these linking changes.** They are temporary for local development only. These changes to `package.json`, `yarn.lock`, and `docker-compose.yml` are for local development only. - -## Repository layout - -Clone both repositories as siblings: - -```text -Development/ - editor-ui/ - scratch-editor/ ← github.com/RaspberryPiFoundation/scratch-editor -``` - -## Temporary changes in editor-ui - -**1. `apps/scratch-frame/package.json`** — replace the GitHub Packages dependency with a file link (the name must match the package in scratch-editor): - -```json -"@RaspberryPiFoundation/scratch-gui": "file:../../../scratch-editor/packages/scratch-gui" -``` - -**2. `docker-compose.yml`** — mount the scratch-editor repo into the container (read-only): - -```yaml -volumes: - - .:/app - - ../scratch-editor:/scratch-editor:ro - - node_modules:/app/node_modules -``` - -From `/app` in the container, `file:../scratch-editor/packages/scratch-gui` resolves to `/scratch-editor/packages/scratch-gui` on the mounted volume. - -**3. `yarn.lock`** — run `yarn install` inside Docker (see below) and commit nothing; the lockfile will change while the link is active. Revert it when you restore the GitHub Packages version in `package.json`. - -## Build scratch-gui - -Build on your machine (the `scratch-editor` mount is read-only inside the editor-ui container): - -```bash -cd ../scratch-editor -nvm install -nvm use -NODE_ENV=development npm ci -npm run build -``` - -After every scratch-gui code change, run the build again, then restart the editor-ui container so Vite copies the new `dist/scratch-gui.js`. - -## Run with Docker - -**editor-api** (Scratch projects and assets API): - -```bash -cd ../editor-api -docker compose up -``` - -**editor-ui**: - -```bash -cd ../editor-ui -docker compose up -``` - -The container runs `yarn install` then `yarn start` on each start. The first start after switching to the file link may take longer while dependencies are linked. - -## Verify in the browser - -- Web component test page: open a **Scratch** sample, e.g. - `http://localhost:3011/web-component.html` - then choose **cool-scratch**. -- **editor-standalone** (port **3012**): also loads the web component from `http://localhost:3011`; open a Scratch project under `/en-US/projects/…` with editor-ui and editor-api running. - -## Revert when finished - -1. Restore the GitHub Packages pin in `apps/scratch-frame/package.json`, for example: - - ```json - "@RaspberryPiFoundation/scratch-gui": "13.7.3-code-classroom.20260522151700" - ``` - - Use the version your branch pins (see [scratch-gui on GitHub Packages](https://github.com/RaspberryPiFoundation/scratch-editor/pkgs/npm/scratch-gui)). -2. Remove the `../scratch-editor:/scratch-editor:ro` volume from `docker-compose.yml`. -3. Revert `yarn.lock` (e.g. `git checkout -- yarn.lock`) or run `yarn install` again after restoring `package.json`. -4. Restart `docker compose up` in editor-ui. - diff --git a/src/components/Menus/Sidebar/InfoPanel/InfoPanel.jsx b/src/components/Menus/Sidebar/InfoPanel/InfoPanel.jsx index fcd7299a5..28e775406 100644 --- a/src/components/Menus/Sidebar/InfoPanel/InfoPanel.jsx +++ b/src/components/Menus/Sidebar/InfoPanel/InfoPanel.jsx @@ -110,7 +110,6 @@ const InfoPanel = ({ feedbackFormUrl = CODE_EDITOR_FEEDBACK_URL }) => {

Scratch Editor

Copyright (C) Scratch Foundation

-

Modified 2026 by the Raspberry Pi Foundation

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License @@ -146,17 +145,6 @@ const InfoPanel = ({ feedbackFormUrl = CODE_EDITOR_FEEDBACK_URL }) => { .

-

- See modified source code and full licence at{" "} - - https://github.com/RaspberryPiFoundation/scratch-editor/tree/code-classroom - - . -

Scratch Frame