-
Notifications
You must be signed in to change notification settings - Fork 35
/
Copy pathjustfile
126 lines (94 loc) · 3.59 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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
SQLSYNC_PROD_URL := "https://sqlsync.orbitinghail.workers.dev"
default:
@just --choose
lint:
cargo clippy --all-targets --all-features -- -D warnings
cargo fmt --check
pnpm exec biome ci --diagnostic-level=warn .
unit-test:
cargo test
build: build-wasm
cargo build -p sqlsync
test:
just unit-test
just run-with-prefix 'test-'
build-wasm:
just run-with-prefix 'wasm-'
run-with-prefix prefix:
#!/usr/bin/env bash
set -euo pipefail
all_tasks=$(just --summary)
for task in $all_tasks; do
if [[ $task == {{prefix}}* ]]; then
just $task
fi
done
wasm-sqlsync +FLAGS='--dev':
cd lib/sqlsync-worker/sqlsync-wasm && wasm-pack build --target web {{FLAGS}}
wasm-sqlsync-reducer-guest:
cargo build --target wasm32-unknown-unknown --example guest
wasm-demo-reducer *FLAGS:
cargo build --target wasm32-unknown-unknown --package demo-reducer {{FLAGS}}
wasm-counter-reducer:
cargo build --target wasm32-unknown-unknown --example counter-reducer
wasm-task-reducer:
cargo build --target wasm32-unknown-unknown --example task-reducer
wasm-examples-reducer-guestbook:
cargo build --target wasm32-unknown-unknown --package reducer-guestbook --release
example-guestbook-react: wasm-examples-reducer-guestbook
cd examples/guestbook-react && pnpm dev
example-guestbook-solid-js: wasm-examples-reducer-guestbook
cd examples/guestbook-solid-js && pnpm dev
test-end-to-end-local rng_seed="": wasm-task-reducer
RUST_BACKTRACE=1 cargo run --example end-to-end-local {{rng_seed}}
test-end-to-end-local-net rng_seed="": wasm-counter-reducer
RUST_BACKTRACE=1 cargo run --example end-to-end-local-net {{rng_seed}}
test-sqlsync-reducer: wasm-sqlsync-reducer-guest
cargo run --example host
node_modules:
pnpm i
package-sqlsync-react:
cd lib/sqlsync-react && pnpm build
package-sqlsync-solid-js:
cd lib/sqlsync-solid-js && pnpm build
package-sqlsync-worker target='release':
#!/usr/bin/env bash
if [[ '{{target}}' = 'release' ]]; then
cd lib/sqlsync-worker && pnpm build-release
else
cd lib/sqlsync-worker && pnpm build
fi
# mode should be either debug or release
# target should be either local or remote
upload-demo-reducer mode='release' target='local':
#!/usr/bin/env bash
set -euo pipefail
cd demo/cloudflare-backend
if [[ '{{mode}}' = 'release' ]]; then
just wasm-demo-reducer '--release'
REDUCER_PATH="../../target/wasm32-unknown-unknown/release/demo_reducer.wasm"
else
just wasm-demo-reducer
REDUCER_PATH="../../target/wasm32-unknown-unknown/debug/demo_reducer.wasm"
fi
if [[ '{{target}}' = 'remote' ]]; then
echo "Uploading $REDUCER_PATH to sqlsync prod"
curl -X PUT --data-binary @$REDUCER_PATH {{SQLSYNC_PROD_URL}}/reducer
echo
else
echo "Uploading $REDUCER_PATH to localhost:8787"
curl -X PUT --data-binary @$REDUCER_PATH http://localhost:8787/reducer
echo
fi
publish-sqlsync-worker: (package-sqlsync-worker "release")
cd lib/sqlsync-worker && pnpm publish --access public
publish-sqlsync-react: package-sqlsync-react
cd lib/sqlsync-react && pnpm publish --access public
publish-sqlsync-solid-js: package-sqlsync-solid-js
cd lib/sqlsync-solid-js && pnpm publish --access public
publish-sqlsync-reducer:
cd lib/sqlsync-reducer && cargo publish
publish-demo-backend:
cd demo/cloudflare-backend && pnpm wrangler-deploy
publish-demo-frontend: (wasm-demo-reducer "--release") (package-sqlsync-worker "release") package-sqlsync-react
cd demo/frontend && pnpm release