-
Notifications
You must be signed in to change notification settings - Fork 54
/
Justfile
100 lines (73 loc) · 2.01 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
default:
just --list
build:
cargo build --bin compiler
test-runner test_suite="": build
cd compiler/ && deno run -A test/runner.ts {{test_suite}}
build-examples:
mkdir -p playground/static
deno run -A playground/build-examples.ts
run-examples: build build-examples
cd compiler/ && deno run -A test/run-examples.ts
run-importer +args="-folder testpkg":
cd importer/ && go run importer.go {{args}}
update-packages:
deno run -A importer/update-packages.ts
serve-playground:
python3 -m http.server 8888 --directory playground/static
playground-js: build-examples
cp playground/style.css playground/static
cd playground && npx esbuild --bundle wasm-index.js --outfile=static/bundle.js
playground-wasm mode="--debug":
#!/usr/bin/env bash
cd wasm/
wasm-pack build --target web {{mode}}
cp -R pkg ../playground/static
rm ../playground/static/pkg/.gitignore
playground-prod: playground-js
#!/usr/bin/env bash
just playground-wasm --release
cd playground/static
cat bundle.js | npx esbuild --minify > prod.js
mv prod.js bundle.js
watch +command:
watchexec -e rs,md,ts,brg,go,html,js,css,eta "just {{command}}"
deploy-playground destination: playground-prod
cp -R playground/static/* {{destination}}
init-project folder:
#!/usr/bin/env bash
set -euo pipefail
DEST={{folder}}
ROOT="."
MAIN="main.brg"
if [ -d "$DEST" ];
then
echo "Folder \"$DEST\" already exists."
exit 1
fi
echo "Creating project folder: \"$DEST\""
mkdir -p $DEST
echo "Building compiler"
cargo build --bin compiler
echo "Copying files"
cp -R $ROOT/std $DEST
echo "
module borgo_test
go 1.19
" > $DEST/go.mod
echo "
use fmt;
fn main() {
fmt.Println(\"Hello world!\");
}
" > $DEST/$MAIN
# Copy compiler as well
cp $ROOT/target/debug/compiler $DEST/borgo
# cd $DEST
# ./borgo build && go run .
echo "
Done! You can now edit $MAIN and run the compiler.
cd $DEST
./borgo build && go run .
Keep in mind a lot of stuff is broken. Have fun!
"