Skip to content

Commit 989f17f

Browse files
committed
Draft page for running Scratch Addons locally
1 parent 55dcf56 commit 989f17f

1 file changed

Lines changed: 73 additions & 0 deletions

File tree

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
---
2+
title: Testing on a Pre-Release Version of Scratch
3+
---
4+
5+
This page explains the process of setting up a version of the Scratch editor or website not yet available on scratch.mit.edu to test Scratch Addons with.
6+
7+
## Editor
8+
9+
### Pre-built Branch
10+
11+
The `develop` branch of the Scratch editor is available at https://scratchfoundation.github.io/scratch-editor/scratch-gui. Pre-release versions of Scratch Addons are configured to run on scratchfoundation.github.io by default. Other domains will require patches in Scratch Addons and Scratch Lab is not supported.
12+
13+
### From source
14+
15+
Start by cloning `scratch-editor` and specifying `--branch <branch-name>` if needed. `--depth=1` may be added to speed up the download as the Git history is very large.
16+
17+
```sh
18+
git clone https://github.com/scratchfoundation/scratch-editor.git
19+
```
20+
21+
Then in the freshly cloned repository run `npm ci` to install the dependencies and `npm run build` to build it.
22+
23+
To start the editor run `npm run start` in `scratch-editor/packages/scratch-gui` and open `localhost:8601` in a browser.
24+
25+
## Website
26+
27+
These instructions are for running a local instance of the Scratch 3 pages (`scratch-www`). Scratch 2 pages (`scratchr2`) such as user profiles or the forums are not supported because the code is not open source.
28+
29+
### Building
30+
31+
```sh
32+
git clone https://github.com/scratchfoundation/scratch-www.git
33+
cd scratch-www
34+
npm install
35+
npm run translate
36+
npm run build
37+
```
38+
39+
### Additional setup
40+
41+
Install the [cors-anywhere](https://github.com/Rob--W/cors-anywhere) proxy:
42+
43+
```sh
44+
npm install -D cors-anywhere`
45+
```
46+
47+
Then to fix `/session`:
48+
49+
1. Install the [Redirector](https://einaregilsson.com/redirector/) browser extension.
50+
2. Open its pop-up and click "Edit Redirects"
51+
3. Create a new redirect
52+
4. Set the include pattern set to `http://localhost:8333/session/` where port 8333 is `scratch-www`
53+
5. Set the "redirect to:" field set to `http://localhost:8080/https://scratch.mit.edu/session/` where port 8080 is cors-anywhere
54+
6. Expand the advanced options check "XMLHttpRequests (Ajax)"
55+
7. Click save
56+
57+
### Running
58+
59+
Start cors-anywhere:
60+
61+
```sh
62+
node ./node_modules/cors-anywhere/server.js
63+
```
64+
65+
Then in another terminal point the hosts to it and start `scratch-www`:
66+
67+
```sh
68+
export API_HOST=http://localhost:8080/https://api.scratch.mit.edu
69+
export BACKPACK_HOST=http://localhost:8080/https://backpack.scratch.mit.edu
70+
npm run start
71+
```
72+
73+
Finally open `localhost:8333` in a browser.

0 commit comments

Comments
 (0)