Skip to content

Commit b336e29

Browse files
authored
feat: Enable cargo workspace (#19)
* feat: use_clipboard * feat: Turn project into cargo workspace * fmt * only run dioxu-std on ci * fix ci * tweaks * add wasm target * fix(ci): Run on windows * chore(ci): Clean up
1 parent e0c74cd commit b336e29

File tree

35 files changed

+86
-83
lines changed

35 files changed

+86
-83
lines changed

.github/workflows/rust.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@ jobs:
2525
clippy:
2626
if: github.event.pull_request.draft == false
2727
name: Clippy
28-
runs-on: ubuntu-latest
28+
runs-on: windows-latest
2929
steps:
3030
- uses: dtolnay/rust-toolchain@stable
3131
- uses: Swatinem/rust-cache@v2
32-
- run: sudo apt-get update
33-
- run: sudo apt install libwebkit2gtk-4.1-dev libgtk-3-dev libayatana-appindicator3-dev
32+
- run: rustup target add wasm32-unknown-unknown
3433
- run: rustup component add clippy
3534
- uses: actions/checkout@v3
36-
- run: cargo clippy --workspace --examples --tests -- -D warnings
35+
- run: cargo clippy --package dioxus-std --target wasm32-unknown-unknown --tests --features wasm-testing -- -D warnings
36+
- run: cargo clippy --package dioxus-std --tests --features desktop-testing -- -D warnings

.github/workflows/testing.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
- uses: actions/checkout@v3
2020
- run: rustup target add wasm32-unknown-unknown
2121
- uses: Swatinem/rust-cache@v2
22-
- run: cargo build --verbose --target wasm32-unknown-unknown --no-default-features --features wasm-testing
22+
- run: cargo build --package dioxus-std --verbose --target wasm32-unknown-unknown --no-default-features --features wasm-testing
2323
# need to run tests here
2424

2525
desktop:
@@ -29,5 +29,5 @@ jobs:
2929
steps:
3030
- uses: actions/checkout@v3
3131
- uses: Swatinem/rust-cache@v2
32-
- run: cargo build --verbose --no-default-features --features desktop-testing
33-
- run: cargo test --verbose --no-default-features --features desktop-testing
32+
- run: cargo build --package dioxus-std --verbose --no-default-features --features desktop-testing
33+
- run: cargo test --package dioxus-std --verbose --no-default-features --features desktop-testing

Cargo.toml

Lines changed: 8 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,8 @@
1-
[package]
2-
name = "dioxus-std"
3-
version = "0.4.0"
4-
authors = ["Jonathan Kelley", "Dioxus Labs", "ealmloff", "DogeDark"]
5-
edition = "2021"
6-
description = "Platform agnostic library for supercharging your productivity with Dioxus"
7-
license = "MIT"
8-
repository = "https://github.com/DioxusLabs/dioxus-std/"
9-
homepage = "https://dioxuslabs.com"
10-
keywords = ["dom", "gui", "dioxus", "standard", "hooks"]
11-
categories = ["multimedia","os", "wasm"]
12-
13-
# This is making it harder to develop for a specific platform when examples are different targets.
14-
# Workaround: Open example project as it's own project.
15-
#[workspace]
16-
#members = ["./examples/*"]
17-
18-
[features]
19-
clipboard = ["dep:copypasta"]
20-
notifications = ["dep:notify-rust"]
21-
geolocation = ["dep:windows", "dep:futures-util", "dep:futures", "dep:web-sys", "dep:wasm-bindgen", "utils"]
22-
color_scheme = ["dep:web-sys", "dep:wasm-bindgen", "dep:wasm-bindgen-futures"]
23-
utils = ["dep:async-broadcast", "dep:uuid"]
24-
i18n = ["dep:serde", "dep:serde_json", "dep:unic-langid"]
25-
all = ["clipboard", "notifications", "geolocation", "color_scheme", "utils", "i18n"]
26-
27-
# CI testing
28-
wasm-testing = ["geolocation", "color_scheme", "utils", "i18n"]
29-
desktop-testing = ["clipboard", "notifications", "geolocation", "utils", "i18n"]
30-
31-
[dependencies]
32-
dioxus = { version = "0.4" }
33-
cfg-if = "1.0.0"
34-
35-
# utils
36-
uuid = { version = "1.3.2", features = ["v4"], optional = true }
37-
async-broadcast = { version = "0.5.1", optional = true }
38-
# clipboard
39-
copypasta = { version = "0.8.2", optional = true }
40-
# notifications
41-
notify-rust = { version = "4.8.0", optional = true }
42-
# geolocation
43-
futures = { version = "0.3.28", features = ["std"], optional = true }
44-
futures-util = {version = "0.3.28", optional = true }
45-
# i18n
46-
serde = { version = "1.0.163", optional = true }
47-
serde_json = { version = "1.0.96", optional = true }
48-
unic-langid = { version = "0.9.1", features = ["serde"], optional = true }
49-
50-
[target.'cfg(windows)'.dependencies]
51-
windows = { version = "0.48.0", features = ["Foundation", "Devices_Geolocation"], optional = true }
52-
53-
[target.'cfg(target_family = "wasm")'.dependencies]
54-
web-sys = { version = "0.3.60", features = ["Window", "MediaQueryList", "Navigator", "Geolocation", "PositionOptions"], optional = true }
55-
wasm-bindgen = { version = "0.2.87", optional = true }
56-
wasm-bindgen-futures = { version = "0.4.35", optional = true}
57-
js-sys = "0.3.62"
58-
# channel
59-
uuid = { version = "1.3.2", features = ["v4", "js"]}
60-
61-
[package.metadata.docs.rs]
62-
default-target = "x86_64-pc-windows-msvc"
63-
no-default-features = true
64-
features = ["desktop-testing"]
65-
1+
[workspace]
2+
members = [
3+
"std",
4+
"examples/*",
5+
]
6+
7+
[workspace.dependencies]
8+
dioxus-std = { path = "./std"}

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ sudo apt-get install xorg-dev
7979
You can add `dioxus-std` to your application by adding it to your dependencies.
8080
```toml
8181
[dependencies]
82-
dioxus-std = { version = "0.4.0", features = [] }
82+
dioxus-std = { version = "0.4", features = [] }
8383
```
8484

8585
## License

examples/README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,7 @@ Learn how to use the `geolocation` abstraction.
1010
Learn how to use the `i18n` abstraction.
1111

1212
### [`channel`](./channel/)
13-
Learn how to use the `channel` abstraction.
13+
Learn how to use the `channel` abstraction.
14+
15+
### [`clipboard`](./clipboard/)
16+
Learn how to use the `clipboard` abstraction.

examples/channel/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ version = "0.1.0"
44
edition = "2021"
55

66
[dependencies]
7-
dioxus-std = { path="../../", features = ["utils"] }
7+
dioxus-std = { workspace = true, features = ["utils"]}
88
dioxus = "0.4"
99
dioxus-web = "0.4"
1010

examples/clipboard/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ version = "0.1.0"
44
edition = "2021"
55

66
[dependencies]
7-
dioxus-std = { path="../../", features = ["clipboard"] }
7+
dioxus-std = { workspace = true, features = ["clipboard"] }
88
dioxus = "0.4"
99
dioxus-desktop = "0.4"

examples/color_scheme/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ version = "0.1.0"
44
edition = "2021"
55

66
[dependencies]
7-
dioxus-std = { path="../../", features = ["color_scheme"] }
7+
dioxus-std = { workspace = true, features = ["color_scheme"] }
88
dioxus = "0.4"
99
dioxus-web = "0.4"
1010

examples/geolocation/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ version = "0.1.0"
44
edition = "2021"
55

66
[dependencies]
7-
dioxus-std = { path="../../", features = ["geolocation"] }
7+
dioxus-std = { workspace = true, features = ["geolocation"] }
88
dioxus = "0.4"
99
dioxus-desktop = "0.4"
1010
#dioxus-web = "0.4"

examples/geolocation/src/main.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
use dioxus::prelude::*;
2-
use dioxus_std::geolocation::{
3-
init_geolocator, use_geolocation, PowerMode
4-
};
2+
use dioxus_std::geolocation::{init_geolocator, use_geolocation, PowerMode};
53

64
fn main() {
75
dioxus_desktop::launch(app);
@@ -34,7 +32,7 @@ fn app(cx: Scope) -> Element {
3432
h1 { "🗺️ Dioxus Geolocation Example 🛰️" }
3533
h3 { "Your initial location is:"}
3634

37-
p {
35+
p {
3836
if let Some(coords) = initial_coords {
3937
format!("Latitude: {} | Longitude: {}", coords.latitude, coords.longitude)
4038
} else {

0 commit comments

Comments
 (0)