diff --git a/Cargo.lock b/Cargo.lock index 85fac44e7..d6f51e68f 100644 Binary files a/Cargo.lock and b/Cargo.lock differ diff --git a/Cargo.toml b/Cargo.toml index 0f340fdff..d904bf5a4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -151,7 +151,6 @@ tar = "0.4.40" tempfile = "3.21.0" thiserror = "2.0.16" tiny_http = "0.12.0" -toml = "0.8.23" topological-sort = "0.2.2" unindent = "0.2.4" url = { version = "2.5.4", features = ["serde"] } diff --git a/crates/xtask/Cargo.toml b/crates/xtask/Cargo.toml index 234221382..176a318d5 100644 --- a/crates/xtask/Cargo.toml +++ b/crates/xtask/Cargo.toml @@ -22,7 +22,6 @@ cc.workspace = true clap.workspace = true git2.workspace = true indoc.workspace = true -toml.workspace = true regex.workspace = true semver.workspace = true serde.workspace = true diff --git a/crates/xtask/src/bump.rs b/crates/xtask/src/bump.rs index 3e6239af9..3efffaa10 100644 --- a/crates/xtask/src/bump.rs +++ b/crates/xtask/src/bump.rs @@ -4,7 +4,6 @@ use anyhow::{anyhow, Result}; use git2::{DiffOptions, Repository}; use indoc::indoc; use semver::{BuildMetadata, Prerelease, Version}; -use toml::Value; use crate::{create_commit, BumpVersion}; @@ -241,7 +240,7 @@ fn update_crates(current_version: &Version, next_version: &Version) -> Result<() .arg("--force") .arg("tree-sitter{,-cli,-config,-generate,-loader,-highlight,-tags}") .arg("--ignore-changes") - .arg("lib/language/*"); + .arg("crates/language/*"); let status = cmd.status()?; @@ -253,7 +252,10 @@ fn update_crates(current_version: &Version, next_version: &Version) -> Result<() } fn update_npm(next_version: &Version) -> Result<()> { - for path in ["lib/binding_web/package.json", "cli/npm/package.json"] { + for path in [ + "lib/binding_web/package.json", + "crates/cli/npm/package.json", + ] { let package_json = serde_json::from_str::(&std::fs::read_to_string(path)?)?; @@ -275,13 +277,11 @@ fn update_npm(next_version: &Version) -> Result<()> { } fn update_zig(next_version: &Version) -> Result<()> { - let zig = std::fs::read_to_string("build.zig.zon")?; - - let zig = zig + let zig = std::fs::read_to_string("build.zig.zon")? .lines() .map(|line| { - if line.starts_with(" .version") { - format!(" .version = \"{next_version}\",") + if line.starts_with(" .version") { + format!(" .version = \"{next_version}\",") } else { line.to_string() } @@ -297,11 +297,13 @@ fn update_zig(next_version: &Version) -> Result<()> { /// read Cargo.toml and get the version fn fetch_workspace_version() -> Result { - let cargo_toml = toml::from_str::(&std::fs::read_to_string("Cargo.toml")?)?; - - Ok(cargo_toml["workspace"]["package"]["version"] - .as_str() - .unwrap() - .trim_matches('"') - .to_string()) + std::fs::read_to_string("Cargo.toml")? + .lines() + .find(|line| line.starts_with("version = ")) + .and_then(|line| { + line.split_terminator('"') + .next_back() + .map(|s| s.to_string()) + }) + .ok_or_else(|| anyhow!("No version found in Cargo.toml")) }