Skip to content

Commit 591d50b

Browse files
authored
Improve task file (#49)
* improve * taskfile
1 parent 0d4ee60 commit 591d50b

File tree

2 files changed

+27
-31
lines changed

2 files changed

+27
-31
lines changed

README.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ Accessible from any device via a browser, it makes coding, electronics, and AI h
1111

1212
## Installation
1313

14-
- Open a terminal inside the UNO Q board (you can also use the [adb](https://docs.arduino.cc/software/app-lab/tutorials/cli/) tool)
14+
- Open the Arduino App lab and connect to your UNO Q board.
15+
- Clik on the button "open terminal" (button left)
1516
- Copy and paste the following command into the terminal to install the latest `scratch-arduino-app`:
1617

1718
```
@@ -25,11 +26,9 @@ NOTE: the `https` is needed by the `getUserMedia()` method for security reason.
2526
## Local development
2627

2728
- `task scratch:init`
28-
- `task scratch:watch` watch scratch GUI files and reload on save
29+
- `task watch` watch python, sketch and scratch GUI files and reload on save
2930
- Open the `http://localhost:8602?host=BOARD_IP`
30-
- `task watch` watch files changes for both python and sketch, and upload the changes to the board and restart"
3131

32-
For testing on the board
32+
For upload the current version into the board
3333

34-
- `ŧask app:build`
35-
- `task board:app:upload`
34+
- `ŧask app:upload`

Taskfile.yaml

Lines changed: 22 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -30,30 +30,10 @@ tasks:
3030
- ln -s $PWD/scratch-prg-extensions/extensions/src/arduino_modulino $PWD/prg-raise-playground/extensions/src/arduino_modulino
3131
- cd scratch-prg-extensions/extensions/src/arduino_modulino && pnpm install
3232

33-
scratch:watch:
34-
cmds:
35-
- cd prg-raise-playground && pnpm dev -i arduino_basics arduino_modulino
36-
37-
app:build:
38-
desc: "Copy app files (python, assets, app.yaml) to a build directory"
39-
cmds:
40-
- rm -rf build/scratch-arduino-app/
41-
- mkdir -p build/scratch-arduino-app
42-
- cp ./app.yaml build/scratch-arduino-app/app.yaml
43-
- cp -r ./sketch build/scratch-arduino-app/sketch
44-
- cp -r ./python build/scratch-arduino-app/python
45-
- cp -r ./certs build/scratch-arduino-app/certs
46-
- task scratch:build
47-
- cp -r prg-raise-playground/build/. build/scratch-arduino-app/assets
48-
49-
scratch:build:
50-
dir: prg-raise-playground
51-
cmds:
52-
- CI=true pnpm build
53-
54-
board:app:upload:
55-
desc: "Upload zip file to Arduino board, unzip and deploy to /home/arduino/ArduinoApps"
33+
app:upload:
34+
desc: "Build,and Upload zip file to Arduino board, unzip and deploy to /home/arduino/ArduinoApps"
5635
cmds:
36+
- task app:build
5737
- task app:zip
5838
- |
5939
ZIP_FILE=$(ls -t build/scratch-arduino-app-*.zip 2>/dev/null | head -n1)
@@ -65,9 +45,18 @@ tasks:
6545
ZIP_BASENAME=$(basename "$ZIP_FILE")
6646
adb shell "cd /tmp && unzip -o $ZIP_BASENAME && mkdir -p /home/arduino/ArduinoApps && rm -rf /home/arduino/ArduinoApps/scratch-arduino-app && mv scratch-arduino-app /home/arduino/ArduinoApps/ && rm $ZIP_BASENAME"
6747
echo "App deployed to /home/arduino/ArduinoApps/scratch-arduino-app"
48+
- task app:start
6849

69-
app:start:
70-
- adb shell "arduino-app-cli app start user:scratch-arduino-app"
50+
app:build:
51+
desc: "Copy app files (python, assets, app.yaml) to a build directory"
52+
cmds:
53+
- rm -rf build/scratch-arduino-app/
54+
- mkdir -p build/scratch-arduino-app
55+
- cp ./app.yaml build/scratch-arduino-app/app.yaml
56+
- cp -r ./sketch build/scratch-arduino-app/sketch
57+
- cp -r ./python build/scratch-arduino-app/python
58+
- cp -r ./certs build/scratch-arduino-app/certs
59+
- cd prg-raise-playground && CI=true pnpm build && cp -r build/. ../build/scratch-arduino-app/assets
7160

7261
app:zip:
7362
desc: "Create a zip file with version (defaults to git commit hash)"
@@ -83,11 +72,19 @@ tasks:
8372
- echo "Creating zip with version {{.APP_VERSION}}"
8473
- cd build && zip -r scratch-arduino-app-{{.APP_VERSION}}.zip scratch-arduino-app && cd ..
8574

75+
app:start:
76+
- adb shell "arduino-app-cli app start user:scratch-arduino-app"
77+
8678
watch:
8779
desc: "watch files changes for both python and sketch, and upload the changes to the board and restart"
8880
deps:
8981
- python:watch
9082
- sketch:watch
83+
- scratch:watch
84+
85+
scratch:watch:
86+
cmds:
87+
- cd prg-raise-playground && pnpm dev -i arduino_basics arduino_modulino
9188

9289
python:watch:
9390
desc: "Watch Python folder for changes and auto-upload/restart"

0 commit comments

Comments
 (0)