Skip to content

Update all deps #44

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
355 changes: 204 additions & 151 deletions Cargo.lock

Large diffs are not rendered by default.

37 changes: 19 additions & 18 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,51 +19,52 @@ categories = [

[dependencies]
# Simpler error handling
anyhow = "1.0.95"
# Get current date and time.
chrono = { version = "0.4.39", default-features = false, features = ["clock"] }
anyhow = "1.0.98"
# Get current date and time
chrono = { version = "0.4.41", default-features = false, features = ["clock"] }
# Framework for parsing CLI args
clap = { version = "4.5.29", features = ["derive"] }
clap = { version = "4.5.37", features = ["derive"] }
# Detect message boundaries in serial port output from device
cobs = "0.3.0"
# TUI for the "monitor" command, colored terminal output
crossterm = "0.28.1"
crossterm = "0.29.0"
# Convert binary hash into hex
data-encoding = "2.8.0"
data-encoding = "2.9.0"
# Find the best place to sotre the VFS
directories = "6.0.0"
# Serialize app config into meta file in the ROM
firefly-types = { version = "0.5.1" }
# Decode wav files
hound = "3.5.1"
# Parse PNG images
image = { version = "0.25.5", default-features = false, features = ["png"] }
image = { version = "0.25.6", default-features = false, features = ["png"] }
# Random device name generation
rand = "0.8.5"
# Signatures
rsa = { version = "0.9.7", default-features = false, features = [
rsa = { version = "0.9.8", default-features = false, features = [
"std",
"sha2",
] }
rust-embed = { version = "8.5.0", default-features = false, features = [
rust-embed = { version = "8.7.1", default-features = false, features = [
"debug-embed",
] }
# REPL
rustyline = "15.0.0"
# Deserialize firefly.toml (required by `toml`)
serde = { version = "1.0.217", features = ["serde_derive", "derive"] }
# Deserialize JSON API responses from the firefly catalog.
serde_json = "1.0.138"
serialport = "4.7.0"
serde = { version = "1.0.219", features = ["serde_derive", "derive"] }
# Deserialize JSON API responses from the firefly catalog
serde_json = "1.0.140"
# Communicating with running device
serialport = "4.7.1"
# Calculate file checksum
sha2 = "0.10.8"
sha2 = "0.10.9"
# Deserialize firefly.toml
toml = "0.8.20"
toml = "0.8.22"
# Download remote files (`url` field in `firefly.toml`)
ureq = "2.12.1"
# Build together post-processed wasm binaries
wasm-encoder = "0.225.0"
wasm-encoder = "0.230.0"
# Parse wasm binaries for post-processing (removing custom sections)
wasmparser = "0.225.0"
wasmparser = "0.230.0"
# Work with zip archives (distribution format for ROMs)
zip = { version = "2.2.2", default-features = false, features = ["zstd"] }
zip = { version = "2.6.1", default-features = false, features = ["zstd"] }
2 changes: 1 addition & 1 deletion src/commands/badges.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ fn display_badges(
continue;
}
print!("{}", "[hidden] ".grey());
};
}
println!("#{id} {} ({} XP)", badge.name.cyan(), badge.xp);
println!("{}", badge.descr);
let emoji = if progress.earned() {
Expand Down
2 changes: 1 addition & 1 deletion src/commands/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ fn remove_old_files(root: &Path) -> anyhow::Result<()> {
continue;
}
fs::remove_file(entry.path())?;
};
}
}
Ok(())
}
Expand Down
2 changes: 1 addition & 1 deletion src/commands/cheat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ pub fn cmd_cheat(args: &CheatArgs) -> Result<()> {
fn parse_command(raw: &str, root: &Path) -> Result<i32> {
if let Ok(n) = raw.parse::<i32>() {
return Ok(n);
};
}
let config = Config::load(root.into(), root).context("load project config")?;
let Some(cheats) = config.cheats else {
bail!("firefly.toml doesn't have [cheats]")
Expand Down
4 changes: 2 additions & 2 deletions src/commands/inspect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ fn inspect_images(rom_path: &Path) -> anyhow::Result<Vec<ImageStats>> {
let entry = entry?;
if let Some(stat) = inspect_image(&entry.path()) {
stats.push(stat);
};
}
}
Ok(stats)
}
Expand Down Expand Up @@ -203,7 +203,7 @@ fn inspect_audios(rom_path: &Path) -> anyhow::Result<Vec<AudioStats>> {
let entry = entry?;
if let Some(stat) = inspect_audio(&entry.path()) {
stats.push(stat);
};
}
}
Ok(stats)
}
Expand Down
4 changes: 2 additions & 2 deletions src/commands/keys.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ pub fn cmd_key_add(vfs: &Path, args: &KeyArgs) -> anyhow::Result<()> {

/// Download the key from the given URL.
fn download_key(url: &str) -> anyhow::Result<(String, Vec<u8>)> {
let file_name = url.split('/').last().unwrap();
let file_name = url.split('/').next_back().unwrap();
let Some(author) = file_name.strip_suffix(".der") else {
bail!("the key file must have .der extension")
};
Expand Down Expand Up @@ -195,7 +195,7 @@ fn save_raw_key(vfs: &Path, author: &str, raw_key: &[u8]) -> anyhow::Result<()>
} else {
RsaPublicKey::from_pkcs1_der(raw_key).context("parse public key")?;
fs::write(pub_path, raw_key).context("write public key")?;
};
}
Ok(())
}

Expand Down
2 changes: 1 addition & 1 deletion src/commands/logs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ pub fn cmd_logs(args: &LogsArgs) -> Result<()> {
Ok(Response::Log(log)) => println!("{log}"),
Ok(_) => (),
Err(err) => println!("invalid message: {err}"),
};
}
}
}
}
Expand Down
14 changes: 7 additions & 7 deletions src/commands/monitor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ fn request_device_stats(port: &mut Port, stats: &mut Stats) -> Result<()> {
let buf = req.encode_vec().context("encode request")?;
port.write_all(&buf[..]).context("send request")?;
port.flush().context("flush request")?;
};
}
Ok(())
}

Expand Down Expand Up @@ -179,7 +179,7 @@ fn parse_stats(stats: &mut Stats, buf: &[u8]) -> Result<()> {
}
}
serial::Response::Memory(mem) => stats.mem = Some(mem),
};
}
Ok(())
}

Expand Down Expand Up @@ -245,19 +245,19 @@ fn render_stats(stats: &Stats) -> Result<()> {
execute!(io::stdout(), terminal::Clear(terminal::ClearType::All))?;
if let Some(cpu) = &stats.cpu {
render_cpu(cpu).context("render cpu table")?;
};
}
if let Some(fuel) = &stats.update {
render_fuel(1, 7, "update", fuel).context("render fuel table")?;
};
}
if let Some(fuel) = &stats.render {
render_fuel(24, 7, "render", fuel).context("render fuel table")?;
};
}
if let Some(memory) = &stats.mem {
render_memory(memory).context("render memory table")?;
};
}
if let Some(log) = &stats.log {
render_log(log).context("render logs")?;
};
}
Ok(())
}

Expand Down
12 changes: 7 additions & 5 deletions src/commands/new.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ pub fn cmd_new(args: &NewArgs) -> Result<()> {
let root = Path::new(&args.name);
if root.exists() {
bail!("the directory already exists");
};
}
let lang = parse_lang(&args.lang)?;
match lang {
Lang::Go => new_go(&args.name).context("new Go project")?,
Expand All @@ -38,15 +38,17 @@ pub fn cmd_new(args: &NewArgs) -> Result<()> {

/// Create and dump firefly.toml config.
fn write_config(name: &str) -> Result<()> {
use std::fmt::Write;

let root = Path::new(name);
let config_path = root.join("firefly.toml");
let username = get_username().unwrap_or_else(|| "joearms".to_string());

let mut config = String::new();
config.push_str(&format!("author_id = \"{username}\"\n"));
config.push_str(&format!("app_id = \"{name}\"\n"));
config.push_str(&format!("author_name = \"{}\"\n", to_titlecase(&username)));
config.push_str(&format!("app_name = \"{}\"\n", to_titlecase(name)));
_ = writeln!(config, "author_id = \"{username}\"");
_ = writeln!(config, "app_id = \"{name}\"");
_ = writeln!(config, "author_name = \"{}\"", to_titlecase(&username));
_ = writeln!(config, "app_name = \"{}\"", to_titlecase(name));

std::fs::write(config_path, config).context("write config")?;
Ok(())
Expand Down
14 changes: 7 additions & 7 deletions src/langs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -180,11 +180,11 @@ fn find_rust_result(root: &Path) -> anyhow::Result<PathBuf> {
let release_dir = target_dir.join("wasm32-unknown-unknown").join("release");
if let Some(path) = find_wasm_binary(&release_dir)? {
return Ok(path);
};
}
let examples_dir = release_dir.join("examples");
if let Some(path) = find_wasm_binary(&examples_dir)? {
return Ok(path);
};
}
bail!("cannot find wasm binary")
}

Expand Down Expand Up @@ -246,7 +246,7 @@ fn build_cpp_inner(config: &Config, bin_name: &str, fname: &str) -> anyhow::Resu
in_path = in_path_src;
if !in_path.exists() {
bail!("file {fname} not found");
};
}
}
let out_path = config.rom_path.join(BIN);
let wasi_sysroot = wasi_sdk.join("share").join("wasi-sysroot");
Expand Down Expand Up @@ -372,6 +372,8 @@ pub fn check_output(output: &Output) -> anyhow::Result<()> {

/// Run the given binary with the given arg and return an error if it is not installed.
pub fn check_installed(lang: &str, bin: &str, arg: &str) -> anyhow::Result<()> {
use std::fmt::Write;

let output = Command::new(bin).args([arg]).output();
if let Ok(output) = output {
if output.status.success() {
Expand All @@ -380,9 +382,7 @@ pub fn check_installed(lang: &str, bin: &str, arg: &str) -> anyhow::Result<()> {
}
let mut msg =
format!("You're trying to build a {lang} app but you don't have {bin} installed.\n");
msg.push_str(&format!(
"Please, follow the getting started guide for {lang}:\n"
));
msg.push_str(" https://docs.fireflyzero.com/dev/getting-started/");
_ = writeln!(msg, "Please, follow the getting started guide for {lang}:");
_ = write!(msg, " https://docs.fireflyzero.com/dev/getting-started/");
bail!(msg);
}
2 changes: 1 addition & 1 deletion src/net.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ pub fn connect() -> Result<TcpStream> {
if maybe_stream.is_err() {
sleep(Duration::from_secs(1));
maybe_stream = TcpStream::connect(&addrs[..]);
};
}
let stream = maybe_stream.context("connect to emulator")?;
Ok(stream)
}