Skip to content

Commit 065fcf8

Browse files
authored
feat: build scratch to assets folder (#5)
* fix: update wsServerURL to use dynamic protocol and hostname * add assets * refactor: standardize task command structure in Taskfile.yaml * docs: update README for clarity and add getting started instructions feat: enhance app upload task in Taskfile.yaml with additional files * docs: improve README instructions and add local development section refactor: streamline Taskfile tasks and commands fix: update wsServerURL to use dynamic protocol and hostname * docs: update README and Taskfile for clarity and improved local development instructions
1 parent 0ed6487 commit 065fcf8

File tree

5 files changed

+470753
-23
lines changed

5 files changed

+470753
-23
lines changed

README.md

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,20 @@
1-
# Scratch extension for Arduino UnoQ board
1+
# Scratch for Arduino Uno Q
2+
3+
Getting started:
4+
1. Connect the Arduino Uno Q board
5+
2. Upload the `scratch-arduino-app` into the board:
6+
``` sh
7+
task app:upload
8+
```
9+
3. Start the App
10+
- via the ArduinoAppLab
11+
- via command line `arduino-app-cli app start user:scratch-arduino-app`
12+
13+
4. Open the `<IP_OR_BOARD_NAME>:7000`
14+
15+
### Local dev
16+
- `task scratch:init`
17+
- `task scratch:patch`
18+
- `task scratch:start`
19+
- change the `const wsServerURL = `<YOUR_IP>:7000`;` in the `index.js`
20+
- Open local scratch on http://localhost:8601/

Taskfile.yaml

Lines changed: 38 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,58 @@
11
version: "3"
22
vars:
33
SCRATCH_EDITOR_VERSION: v12.0.1
4+
ARDUINO_APP_BASE_PATH: /home/arduino/ArduinoApps/scratch-arduino-app
45

56
tasks:
6-
scratch:init:
7-
- git clone --depth 1 --branch {{ .SCRATCH_EDITOR_VERSION }} https://github.com/scratchfoundation/scratch-editor.git
7+
app:upload:
8+
desc: "Upload app files to the Arduino Board"
9+
cmds:
10+
- adb push ./python/main.py {{ .ARDUINO_APP_BASE_PATH }}/python/main.py
11+
- adb push ./sketch/sketch.ino {{ .ARDUINO_APP_BASE_PATH }}/sketch/sketch.ino
12+
- adb push ./sketch/sketch.yaml {{ .ARDUINO_APP_BASE_PATH }}/sketch/sketch.yaml
13+
- task modulino:patch
14+
- adb push ./sketch/Arduino_Modulino {{ .ARDUINO_APP_BASE_PATH }}/sketch/Arduino_Modulino
15+
- adb push ./app.yaml {{ .ARDUINO_APP_BASE_PATH }}/app.yaml
16+
- adb push ./assets/index.html {{ .ARDUINO_APP_BASE_PATH }}/assets/index.html
17+
- adb push ./assets/gui.js {{ .ARDUINO_APP_BASE_PATH }}/assets/gui.js
818

19+
modulino:patch:
20+
desc: "Patch Arduino Modulino and put it in the sketch folder"
21+
cmds:
22+
# See https://github.com/arduino-libraries/Arduino_Modulino/pull/42
23+
# Any Version<0.6.0 the build fails if Both modulino and ArduinoLedMatrix are used in the UnoQ
24+
- mkdir -p sketch/Arduino_Modulino
25+
- git clone --depth 1 git@github.com:arduino-libraries/Arduino_Modulino.git sketch/Arduino_Modulino
26+
- cd sketch/Arduino_Modulino && git checkout 480e9d183a3b3dede0c68170e469410a6d710bee
27+
28+
scratch:init:
29+
cmds:
30+
- git clone --depth 1 --branch {{ .SCRATCH_EDITOR_VERSION }} https://github.com/scratchfoundation/scratch-editor.git
31+
- task scratch:install
32+
933
scratch:install:
1034
dir: scratch-editor
1135
cmds:
1236
- npm install
13-
- npm run build --workspace @scratch/scratch-svg-renderer
14-
- npm run build --workspace @scratch/scratch-vm
15-
- npm run build:dev --workspace @scratch/scratch-gui
37+
- npm build
1638

1739
scratch:patch:
18-
- cd scratch-editor/packages/scratch-gui && node ../../../scratch-arduino-extensions/scripts/patch-gui.js
40+
cmds:
41+
- cd scratch-editor/packages/scratch-gui && node ../../../scratch-arduino-extensions/scripts/patch-gui.js
1942

2043
scratch:start:
2144
dir: scratch-editor
2245
cmds:
2346
- npm start --workspace @scratch/scratch-gui
2447

2548
scratch:clean:
26-
- rm -rf scratch-editor
27-
28-
board:upload:
29-
- adb push ./python/main.py /home/arduino/ArduinoApps/scratch-arduino-app/python/main.py
30-
- adb push ./sketch/sketch.ino /home/arduino/ArduinoApps/scratch-arduino-app/sketch/sketch.ino
31-
- adb push ./sketch/sketch.yaml /home/arduino/ArduinoApps/scratch-arduino-app/sketch/sketch.yaml
32-
- adb push ./sketch/Arduino_Modulino /home/arduino/ArduinoApps/scratch-arduino-app/sketch/Arduino_Modulino
33-
- adb push ./app.yaml /home/arduino/ArduinoApps/scratch-arduino-app/app.yaml
34-
# - adb shell arduino-app-cli app restart user:scratch-arduino-app
49+
cmds:
50+
- rm -rf scratch-editor
3551

36-
modulino:patch:
37-
# See https://github.com/arduino-libraries/Arduino_Modulino/pull/42
38-
# Any Version<0.6.0 the build fails if Both modulino and ArduinoLedMatrix are used in the UnoQ
39-
- mkdir -p sketch/Arduino_Modulino
40-
- git clone --depth 1 git@github.com:arduino-libraries/Arduino_Modulino.git sketch/Arduino_Modulino
41-
- cd sketch/Arduino_Modulino && git checkout 480e9d183a3b3dede0c68170e469410a6d710bee
52+
scratch:assets:
53+
desc: "Build Scratch GUI files and copy to the assets folder"
54+
dir: scratch-editor/packages/scratch-gui
55+
cmds:
56+
- npm run build:dev --workspace @scratch/scratch-gui
57+
- cp build/index.html ../../../assets/index.html
58+
- cp build/gui.js ../../../assets/gui.js

0 commit comments

Comments
 (0)