-
Notifications
You must be signed in to change notification settings - Fork 9
/
justfile
83 lines (66 loc) · 2.31 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
# just manual: https://github.com/casey/just/#readme
_default:
@just --list
# Installs the trunk packager
install-trunk:
cargo install trunk
# Run the web server
run-web: web-app
cargo run --bin clean-architecture-with-rust-web
# Run the CLI
run-cli:
cargo run --bin clean-architecture-with-rust-cli
# Run the desktop app
run-desktop:
cargo run --bin clean-architecture-with-rust-desktop
# Build the web server
build-web: web-app
cargo build --bin clean-architecture-with-rust-web --release
# Build the CLI
build-cli:
cargo build --bin clean-architecture-with-rust-cli --release
# Build the desktop app
build-desktop:
cargo build --bin clean-architecture-with-rust-desktop --release
# Build the web app
web-app:
cd crates/web-app/ && trunk build
# Read version from Cargo.toml
pkg-version := `sed -En 's/version[[:space:]]*=[[:space:]]*"([^"]+)"/v\1/p' Cargo.toml | head -1`
# Create a tarball with the webserver
pack-web: build-web
tar -C target/release/ \
-cvpJf clean-architecture-with-rust-web_{{pkg-version}}.tar.xz \
clean-architecture-with-rust-web
# Create a tarball with the CLI
pack-cli: build-cli
tar -C target/release/ \
-cvpJf clean-architecture-with-rust-cli_{{pkg-version}}.tar.xz \
clean-architecture-with-rust-cli
# Format source code
fmt:
cargo fmt --all
cd crates/web-app/ && cargo fmt --all
# Run clippy linter
clippy:
cargo clippy --workspace --fix --allow-dirty --allow-staged
cargo fix --workspace --allow-dirty --allow-staged
cd crates/web-app/ && cargo clippy --workspace --fix --allow-dirty --allow-staged
cd crates/web-app/ && cargo fix --workspace --allow-dirty --allow-staged
# Fix lint warnings
fix:
cargo fix --workspace --all-targets
cargo clippy --workspace --all-targets --fix
cd crates/web-app && cargo fix --workspace --all-targets
cd crates/web-app && cargo clippy --workspace --all-targets --fix
# Run tests
test:
RUST_BACKTRACE=1 cargo test --locked --workspace -- --nocapture
RUST_BACKTRACE=1 cargo test --locked --workspace --manifest-path crates/web-app/Cargo.toml -- --nocapture
RUST_BACKTRACE=1 wasm-pack test --chrome --headless crates/web-app/
# Upgrade (and update) dependencies and tools
upgrade:
cargo upgrade --incompatible
cargo update
cd crates/web-app && cargo upgrade --incompatible
cd crates/web-app && cargo update