generated from dalelane/scratch-extension-development
-
Notifications
You must be signed in to change notification settings - Fork 1
/
justfile
70 lines (53 loc) · 1.97 KB
/
justfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# Ensure all properties are exported as shell env-vars
set export
# set the current directory, and the location of the test dats
CWDIR := justfile_directory()
EXTENSION_NAME := "arduino_scratch"
_default:
@just -f {{justfile()}} --list
setup:
#!/bin/bash
git clone --depth=1 https://github.com/LLK/scratch-vm.git
git clone --depth=1 https://github.com/LLK/scratch-gui.git
pushd scratch-vm
npm install && npm ln
npx browserslist@latest --update-db
popd
pushd scratch-gui
npm install && npm ln scratch-vm
npx browserslist@latest --update-db
popd
patch:
#!/bin/bash
set -xeo pipefail
echo "Checking if Scratch source has already been customized"
if [ -e $CWDIR/patched ]; then
exit 1
fi
cd $CWDIR/scratch-vm/src/extensions
ln -s $CWDIR/{{EXTENSION_NAME}} {{EXTENSION_NAME}}
cd $CWDIR/scratch-vm
git apply $CWDIR/patches/scratch-vm.patch
mv package.json $CWDIR/dependencies/package.json
ln -s $CWDIR/dependencies/package.json .
mv package-lock.json $CWDIR/dependencies/package-lock.json
ln -s $CWDIR/dependencies/package-lock.json .
cd $CWDIR/scratch-gui
git apply $CWDIR/patches/scratch-gui.patch
echo "Copying in the Scratch extension files"
mkdir -p $CWDIR/scratch-gui/src/lib/libraries/extensions/{{EXTENSION_NAME}}
cd $CWDIR/scratch-gui/src/lib/libraries/extensions/{{EXTENSION_NAME}}
ln -s $CWDIR/{{EXTENSION_NAME}}_background.png {{EXTENSION_NAME}}_background.png
ln -s $CWDIR/{{EXTENSION_NAME}}_icon.png {{EXTENSION_NAME}}_icon.png
echo "Marking the Scratch source as customized"
touch $CWDIR/patched
build:
#!/bin/bash
cd $CWDIR/scratch-vm
NODE_OPTIONS='--openssl-legacy-provider' ./node_modules/.bin/webpack --bail
echo "BUILDING SCRATCH GUI ..."
cd $CWDIR/scratch-gui
NODE_OPTIONS='--openssl-legacy-provider' ./node_modules/.bin/webpack --bail
run:
#!/bin/bash
npx http-server $CWDIR/scratch-gui/build