fix(xtask): update paths in bump-version
and remove the toml dependency
This commit is contained in:
parent
22d658518b
commit
6e8ad7e5cc
4 changed files with 17 additions and 77 deletions
60
Cargo.lock
generated
60
Cargo.lock
generated
|
|
@ -1685,15 +1685,6 @@ dependencies = [
|
|||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_spanned"
|
||||
version = "0.6.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bf41e0cfaf7226dca15e8197172c295a782857fcb97fad1808a166870dee75a3"
|
||||
dependencies = [
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "shell-words"
|
||||
version = "1.1.0"
|
||||
|
|
@ -1889,47 +1880,6 @@ dependencies = [
|
|||
"zerovec",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "toml"
|
||||
version = "0.8.23"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dc1beb996b9d83529a9e75c17a1686767d148d70663143c7854d8b4a09ced362"
|
||||
dependencies = [
|
||||
"serde",
|
||||
"serde_spanned",
|
||||
"toml_datetime",
|
||||
"toml_edit",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "toml_datetime"
|
||||
version = "0.6.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "22cddaf88f4fbc13c51aebbf5f8eceb5c7c5a9da2ac40a13519eb5b0a0e8f11c"
|
||||
dependencies = [
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "toml_edit"
|
||||
version = "0.22.27"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "41fe8c660ae4257887cf66394862d21dbca4a6ddd26f04a3560410406a2f819a"
|
||||
dependencies = [
|
||||
"indexmap",
|
||||
"serde",
|
||||
"serde_spanned",
|
||||
"toml_datetime",
|
||||
"toml_write",
|
||||
"winnow",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "toml_write"
|
||||
version = "0.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5d99f8c9a7727884afe522e9bd5edbfc91a3312b36a77b5fb8926e4c31a41801"
|
||||
|
||||
[[package]]
|
||||
name = "topological-sort"
|
||||
version = "0.2.2"
|
||||
|
|
@ -2829,15 +2779,6 @@ version = "0.53.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "271414315aff87387382ec3d271b52d7ae78726f5d44ac98b4f4030c91880486"
|
||||
|
||||
[[package]]
|
||||
name = "winnow"
|
||||
version = "0.7.13"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "21a0236b59786fed61e2a80582dd500fe61f18b5dca67a4a067d0bc9039339cf"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wit-bindgen"
|
||||
version = "0.45.0"
|
||||
|
|
@ -2877,7 +2818,6 @@ dependencies = [
|
|||
"semver",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"toml",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
|
|||
|
|
@ -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"] }
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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::<serde_json::Value>(&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<String> {
|
||||
let cargo_toml = toml::from_str::<Value>(&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"))
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue