Skip to content

Commit 17fb124

Browse files
committed
chore: normalize rust toolchain channel when comparing in update.ts
rust-toolchain.toml channels may be just "1.84" (no patch); pad to MAJOR.MINOR.PATCH so @std/semver can parse it.
1 parent 43bb3a0 commit 17fb124

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

scripts/update.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,9 +118,12 @@ async function updateRustToolchain(tag: string) {
118118
if (localMatch == null) {
119119
throw new Error("Could not find channel in local rust-toolchain.toml.");
120120
}
121+
// rust-toolchain.toml channels may be just "1.84" (no patch); pad to
122+
// MAJOR.MINOR.PATCH so @std/semver can parse it.
123+
const normalize = (v: string) => /^\d+\.\d+$/.test(v) ? `${v}.0` : v;
121124
// only bump up; never downgrade. compare as semver so 1.95.0 > 1.91.0.
122-
const local = semver.parse(localMatch[1]);
123-
const upstream = semver.parse(biomeRustVersion);
125+
const local = semver.parse(normalize(localMatch[1]));
126+
const upstream = semver.parse(normalize(biomeRustVersion));
124127
if (semver.greaterThan(upstream, local)) {
125128
$.log(`Updating Rust toolchain: ${localMatch[1]} -> ${biomeRustVersion}`);
126129
toolchainPath.writeTextSync(localContent.replace(localMatch[0], `channel = "${biomeRustVersion}"`));

0 commit comments

Comments
 (0)