Skip to content

Commit fb23ee3

Browse files
committed
workspace dependencies + yew tracing
1 parent 51bbd84 commit fb23ee3

File tree

8 files changed

+94
-63
lines changed

8 files changed

+94
-63
lines changed

Cargo.lock

+21-18
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+15
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,18 @@ members = [
88
exclude = [
99
"app" # app must NOT be part of the workspace. It needs to have it's own target directory and lock file
1010
]
11+
12+
[workspace.dependencies]
13+
axum = { version = "0.5", features = ["http2"] }
14+
serde = { version = "1", features = ["derive"] }
15+
tokio = { version = "1", features = ["full"] }
16+
serde_json = "1.0"
17+
bson = "2"
18+
mime = "0.3"
19+
thiserror = "1"
20+
tower = { version = "0.4" }
21+
tower-http = "0.3"
22+
tracing = "0.1"
23+
tracing-subscriber = { version = "0.3" }
24+
anyhow = "1"
25+
lazy_static = "1.4.0"

app/src/main.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use yew::prelude::*;
33

44
#[function_component(App)]
55
fn app() -> Html {
6-
html! { "hello eds" }
6+
html! { "hello world" }
77
}
88

99
fn main() {

frontend/Cargo.toml

+13-17
Original file line numberDiff line numberDiff line change
@@ -3,29 +3,25 @@ name = "frontend"
33
version = "0.1.0"
44
edition = "2021"
55

6-
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
7-
86
[dependencies]
97
yew = { git = "https://github.com/yewstack/yew/", features = ["csr"] }
108
yew-router = { git = "https://github.com/yewstack/yew/" }
11-
anyhow = "1"
9+
10+
wasm-bindgen = "0.2.78"
1211
wasm-bindgen-futures = "0.4"
1312
js-sys = "0.3"
14-
wasm-bindgen = "0.2.78"
13+
web-sys = { version = "0.3", features = ["HtmlCollection"] }
14+
1515
gloo = "0.8"
1616
gloo-net = { version = "0.2.4", features = ["http", "json"] }
17-
serde = { version = "1", features = ["derive"] }
18-
serde_json = "1.0"
1917
monaco = { git = "https://github.com/hamza1311/rust-monaco", branch = "yew-playground", features = ["yew-components"] }
20-
bson = "2.1"
21-
getrandom = { version = "*", features = ["js"]}
22-
uuid = { version = "0.8.1", features = ["serde", "v4", "wasm-bindgen"] }
23-
thiserror = "1.0.31"
18+
tracing-web = "0.1.2"
19+
20+
anyhow = { workspace = true }
21+
serde = { workspace = true }
22+
serde_json = { workspace = true }
23+
thiserror = { workspace = true }
2424

25-
[dependencies.web-sys]
26-
version = "0.3"
27-
features = [
28-
"HtmlIFrameElement",
29-
"HtmlDocument",
30-
"HtmlCollection"
31-
]
25+
tracing = { workspace = true, default-features = false }
26+
time = { version = "0.3", features = ["wasm-bindgen"] }
27+
tracing-subscriber = { workspace = true, features = ["time"] }

frontend/src/main.rs

+17
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ mod app;
33
mod components;
44
mod macros;
55
mod utils;
6+
use tracing_web::{MakeConsoleWriter, performance_layer};
7+
use tracing_subscriber::fmt::format::{FmtSpan, Pretty};
8+
use tracing_subscriber::fmt::time::UtcTime;
9+
use tracing_subscriber::prelude::*;
610

711
use app::App;
812
use std::rc::Rc;
@@ -52,5 +56,18 @@ fn Root() -> Html {
5256
}
5357

5458
fn main() {
59+
let fmt_layer = tracing_subscriber::fmt::layer()
60+
.with_ansi(false)
61+
.with_timer(UtcTime::rfc_3339())
62+
.with_writer(MakeConsoleWriter)
63+
.with_span_events(FmtSpan::ACTIVE);
64+
let perf_layer = performance_layer()
65+
.with_details_from_fields(Pretty::default());
66+
67+
tracing_subscriber::registry()
68+
.with(fmt_layer)
69+
.with(perf_layer)
70+
.init();
71+
5572
yew::Renderer::<Root>::new().render();
5673
}

services/app-compiler/Cargo.toml

+9-9
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@ edition = "2021"
66
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
77

88
[dependencies]
9-
axum = { version = "0.5", features = ["http2"] }
10-
tokio = { version = "1.16", features = ["full"] }
11-
serde = { version = "1.0", features = ["derive"] }
12-
serde_json = "1.0"
13-
tower = { version = "0.4", features = ["limit", "timeout"] }
14-
lazy_static = "1"
15-
tracing = "0.1"
16-
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
17-
tower-http = { version = "0.3.0", features = ["trace", "cors"] }
9+
axum = { workspace = true }
10+
tokio = { workspace = true }
11+
serde = { workspace = true }
12+
serde_json = { workspace = true }
13+
tower = { workspace = true }
14+
lazy_static = { workspace = true }
15+
tracing = { workspace = true }
16+
tower-http = { workspace = true, features = ["trace", "cors"] }
17+
anyhow = { workspace = true }
1818

1919
common = { path = "../common" }
2020
hyper = "*"

services/backend/Cargo.toml

+11-11
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,17 @@ edition = "2021"
66
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
77

88
[dependencies]
9-
axum = { version = "0.5", features = ["http2"] }
10-
tokio = { version = "1.16", features = ["full"] }
11-
serde = { version = "1.0", features = ["derive"] }
12-
serde_json = "1.0"
13-
tower = { version = "0.4", features = ["limit", "timeout"] }
14-
bson = "2"
9+
axum = { workspace = true }
10+
tokio = { workspace = true }
11+
serde = { workspace = true }
12+
serde_json = { workspace = true }
13+
tower = { workspace = true }
14+
lazy_static = { workspace = true }
15+
tracing = { workspace = true }
16+
anyhow = { workspace = true }
17+
tower-http = { workspace = true, features = ["trace", "cors"] }
18+
bson = { workspace = true }
19+
1520
thiserror = "1"
16-
lazy_static = "1"
17-
tracing = "0.1"
18-
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
19-
tower-http = { version = "0.3.0", features = ["trace", "cors"] }
2021
reqwest = { version = "0.11.10", features = ["json", "stream"] }
21-
anyhow = "1"
2222
common = { path = "../common" }

services/common/Cargo.toml

+7-7
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ edition = "2021"
66
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
77

88
[dependencies]
9-
axum = { version = "0.5", features = ["http2"] }
10-
serde = { version = "1.0", features = ["derive"] }
11-
serde_json = "1.0"
12-
bson = "2"
9+
axum = { workspace = true }
10+
serde = { workspace = true }
11+
serde_json = { workspace = true }
12+
tracing-subscriber = { workspace = true, features = ["env-filter"] }
13+
anyhow = { workspace = true }
14+
bson = { workspace = true }
1315
mime = "0.3"
16+
tower = { workspace = true, features = ["limit", "timeout"] }
1417
thiserror = "1"
15-
tower = { version = "0.4", features = ["limit", "timeout"] }
16-
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
17-
anyhow = "1"

0 commit comments

Comments
 (0)