-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy path.justfile
More file actions
62 lines (52 loc) · 2.08 KB
/
Copy path.justfile
File metadata and controls
62 lines (52 loc) · 2.08 KB
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
default: run-wasm
# Recipe for building Cargo project for WebAssembly (wasm)
build-wasm:
cargo build --target wasm32-unknown-unknown
# Recipe for running Cargo project on WebAssembly (wasm)
run-wasm: fmt clippy
@if ! rustup target list | grep wasm32-unknown-unknown >/dev/null; then \
echo "wasm32-unknown-unknown target not installed. Run 'just setup-wasm' to install it."; \
exit 1; \
fi
@if ! command -v trunk >/dev/null; then \
echo "trunk not installed. Please install it and make sure it's in your PATH."; \
exit 1; \
fi
trunk serve --open
# Recipe for building Cargo project for Linux native
build-linux:
cargo build --target x86_64-unknown-linux-gnu
# Recipe for running Cargo project on Linux native
run-linux: fmt clippy
cargo run --target x86_64-unknown-linux-gnu
# Recipe for running clippy on the Cargo project
clippy:
cargo clippy
# Recipe for formatting the Cargo project
fmt:
cargo fmt
# Recipe for installing wasm target
setup-wasm:
rustup target add wasm32-unknown-unknown
cargo install wasm-server-runner
@if ! grep -q 'target.wasm32-unknown-unknown' ~/.cargo/config.toml || ! grep -q 'runner = "wasm-server-runner"' ~/.cargo/config.toml; then \
echo '[target.wasm32-unknown-unknown]' >> ~/.cargo/config.toml; \
echo 'runner = "wasm-server-runner"' >> ~/.cargo/config.toml; \
fi
cargo install trunk || true
# Recipe for building the documentation
build-docs:
mdbook build docs/
# Recipe for serving the documentation
serve-docs:
mdbook serve docs/
# Recipe for displaying help information
help:
@echo "Available recipes:"
@echo " build-wasm - Build Cargo project for WebAssembly (wasm)"
@echo " run-wasm - Run Cargo project on WebAssembly (wasm)"
@echo " build-linux - Build Cargo project for Linux native"
@echo " run-linux - Run Cargo project on Linux native"
@echo " clippy - Run clippy on the Cargo project"
@echo " fmt - Format the Cargo project"
@echo " setup-wasm - Install wasm target and wasm-server-runner"