Skip to content

Commit

Permalink
Merge pull request #395 from linebender/broken_js_deps2
Browse files Browse the repository at this point in the history
Disable download feature on wasm
  • Loading branch information
raphlinus authored Oct 25, 2023
2 parents 0e998df + f937baf commit 9a6ef95
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions examples/scenes/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ rand = "0.8.5"
instant = { workspace = true }

# Used for the `download` command
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
byte-unit = "4.0"
dialoguer = "0.10"
ureq = "2.6"
6 changes: 6 additions & 0 deletions examples/scenes/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#[cfg(not(target_arch = "wasm32"))]
pub mod download;
mod images;
mod mmark;
Expand All @@ -8,6 +9,7 @@ use std::path::PathBuf;

use anyhow::{anyhow, Result};
use clap::{Args, Subcommand};
#[cfg(not(target_arch = "wasm32"))]
use download::Download;
pub use images::ImageCache;
pub use simple_text::SimpleText;
Expand Down Expand Up @@ -77,6 +79,7 @@ pub struct Arguments {
#[derive(Subcommand, Debug)]
enum Command {
/// Download SVG files for testing. By default, downloads a set of files from wikipedia
#[cfg(not(target_arch = "wasm32"))]
Download(Download),
}

Expand Down Expand Up @@ -111,7 +114,10 @@ impl Arguments {
impl Command {
fn action(&self) -> Result<()> {
match self {
#[cfg(not(target_arch = "wasm32"))]
Command::Download(download) => download.action(),
#[cfg(target_arch = "wasm32")]
_ => unreachable!("downloads not supported on wasm"),
}
}
}
Expand Down

0 comments on commit 9a6ef95

Please sign in to comment.