Skip to content

Commit a76c24b

Browse files
committed
refactor(playground): move playground example to tip crate
1 parent 26d722b commit a76c24b

7 files changed

Lines changed: 18 additions & 45 deletions

File tree

Cargo.lock

Lines changed: 3 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@ monoxide-font.workspace = true
1414
monoxide-script.workspace = true
1515
tracing-subscriber.workspace = true
1616

17-
[build-dependencies]
17+
[dev-dependencies]
18+
dioxus-devtools.workspace = true
19+
monoxide-playground.workspace = true
20+
tokio.workspace = true
1821

1922
[lints.rust]
2023
rust_2018_idioms = { level = "deny", priority = -1 }

crates/monoxide-font/Cargo.toml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@ license.workspace = true
77
repository.workspace = true
88
version.workspace = true
99

10-
[features]
11-
playground = []
12-
1310
[dependencies]
1411
monoxide-curves.workspace = true
1512
monoxide-script.workspace = true
@@ -19,6 +16,5 @@ monoxide-spiro.workspace = true
1916
anyhow.workspace = true
2017
dioxus-devtools.workspace = true
2118
itertools.workspace = true
22-
monoxide-playground.workspace = true
2319
snapbox = { workspace = true }
2420
tokio.workspace = true

crates/monoxide-font/examples/playground.rs

Lines changed: 0 additions & 8 deletions
This file was deleted.

examples/playground.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
use dioxus_devtools::subsecond;
2+
use monoxide_font::make_font;
3+
use monoxide_playground::Playground;
4+
5+
#[tokio::main]
6+
async fn main() -> anyhow::Result<()> {
7+
Playground::dispatch(|| subsecond::call(make_font)).await
8+
}

xtask/src/dev.rs

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,6 @@ fn graceful_shutdown(st: &Mutex<ShutdownState>) {
7272
}
7373

7474
pub fn run(cmd: DevCommand) -> anyhow::Result<()> {
75-
let playground_crate = "monoxide-font";
76-
let playground_example = "playground";
7775
let playground_webui_dir = util::playground_webui_dir();
7876
let playground_webui_dist = util::playground_webui_dist_dir();
7977

@@ -122,13 +120,7 @@ pub fn run(cmd: DevCommand) -> anyhow::Result<()> {
122120
}
123121

124122
// Then start the playground server.
125-
let playground_child = start_playground(
126-
&cmd,
127-
playground_crate,
128-
playground_example,
129-
webui_port,
130-
&playground_webui_dist,
131-
)?;
123+
let playground_child = start_playground(&cmd, webui_port, &playground_webui_dist)?;
132124
{
133125
// graceful shutdown stuff
134126
let mut st = shutdown_state.lock().unwrap();
@@ -189,8 +181,6 @@ fn check_exit_status(shutdown_state: &Arc<Mutex<ShutdownState>>) -> bool {
189181

190182
fn start_playground(
191183
cmd: &DevCommand,
192-
playground_crate: &str,
193-
playground_example: &str,
194184
webui_port: Option<u16>,
195185
playground_webui_dir: &Path,
196186
) -> anyhow::Result<Child> {
@@ -202,15 +192,7 @@ fn start_playground(
202192
playground_cmd = Command::new("dx");
203193
playground_cmd.env("TELEMETRY", "false");
204194
}
205-
playground_cmd.args([
206-
"serve",
207-
"--hotpatch",
208-
"-p",
209-
playground_crate,
210-
"--example",
211-
playground_example,
212-
"--features=playground",
213-
]);
195+
playground_cmd.args(["serve", "--hotpatch", "--example=playground"]);
214196
let mut playground_args = vec![Cow::from("serve"), format!("--port={}", cmd.port).into()];
215197
if let Some(webui_port) = webui_port {
216198
playground_args.push(format!("--reverse-proxy=http://127.0.0.1:{webui_port}").into());

xtask/src/ssg.rs

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,7 @@ pub fn run(cmd: SsgCommand) -> anyhow::Result<()> {
2828
);
2929

3030
let status = Command::new(CARGO)
31-
.args([
32-
"run",
33-
"-p",
34-
"monoxide-font",
35-
"--features",
36-
"playground",
37-
"--example",
38-
"playground",
39-
"--",
40-
"render",
41-
])
31+
.args(["run", "--example=playground", "--", "render"])
4232
.arg(&assets_dir)
4333
.current_dir(workspace_root())
4434
.stdout(std::process::Stdio::inherit())

0 commit comments

Comments
 (0)