From a38cf178d16010aa6c542f3191360da32951a03e Mon Sep 17 00:00:00 2001 From: Zixuan Chen Date: Thu, 29 Aug 2024 23:02:03 +0800 Subject: [PATCH] chore: bump rust crates version --- Cargo.lock | 164 ++++++++++++++--------------- crates/delta/Cargo.toml | 2 +- crates/fractional_index/Cargo.toml | 2 +- crates/loro-common/Cargo.toml | 4 +- crates/loro-internal/Cargo.toml | 10 +- crates/loro/Cargo.toml | 6 +- crates/rle/Cargo.toml | 2 +- scripts/.vscode/settings.json | 3 + scripts/bump-rust-crates.ts | 86 +++++++++++++++ scripts/deno.json | 6 ++ scripts/deno.lock | 38 +++++++ 11 files changed, 228 insertions(+), 95 deletions(-) create mode 100644 scripts/.vscode/settings.json create mode 100644 scripts/bump-rust-crates.ts create mode 100644 scripts/deno.json create mode 100644 scripts/deno.lock diff --git a/Cargo.lock b/Cargo.lock index 26ec524b..ab4e6786 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -140,7 +140,7 @@ dependencies = [ "arbitrary", "enum-as-inner 0.5.1", "flate2", - "loro-common 0.16.2", + "loro-common 0.16.10", "rand", "serde_json", ] @@ -607,7 +607,7 @@ dependencies = [ "criterion 0.4.0", "ctor 0.2.6", "flate2", - "loro 0.16.2", + "loro 0.16.10", "serde_json", "tabled 0.15.0", "tracing", @@ -660,8 +660,8 @@ dependencies = [ "enum_dispatch", "fxhash", "itertools 0.12.1", + "loro 0.16.10", "loro 0.16.2", - "loro 0.16.2 (git+https://github.com/loro-dev/loro.git?rev=90470658435ec4c62b5af59ebb82fe9e1f5aa761)", "rand", "serde_json", "tabled 0.10.0", @@ -982,6 +982,19 @@ dependencies = [ [[package]] name = "loro" version = "0.16.2" +source = "git+https://github.com/loro-dev/loro.git?rev=90470658435ec4c62b5af59ebb82fe9e1f5aa761#90470658435ec4c62b5af59ebb82fe9e1f5aa761" +dependencies = [ + "either", + "enum-as-inner 0.6.0", + "generic-btree", + "loro-delta 0.16.2", + "loro-internal 0.16.2", + "tracing", +] + +[[package]] +name = "loro" +version = "0.16.10" dependencies = [ "anyhow", "ctor 0.2.6", @@ -989,34 +1002,37 @@ dependencies = [ "either", "enum-as-inner 0.6.0", "generic-btree", - "loro-delta 0.16.2", - "loro-internal 0.16.2", + "loro-delta 0.16.10", + "loro-internal 0.16.10", "serde_json", "tracing", ] -[[package]] -name = "loro" -version = "0.16.2" -source = "git+https://github.com/loro-dev/loro.git?rev=90470658435ec4c62b5af59ebb82fe9e1f5aa761#90470658435ec4c62b5af59ebb82fe9e1f5aa761" -dependencies = [ - "either", - "enum-as-inner 0.6.0", - "generic-btree", - "loro-delta 0.16.2 (git+https://github.com/loro-dev/loro.git?rev=90470658435ec4c62b5af59ebb82fe9e1f5aa761)", - "loro-internal 0.16.2 (git+https://github.com/loro-dev/loro.git?rev=90470658435ec4c62b5af59ebb82fe9e1f5aa761)", - "tracing", -] - [[package]] name = "loro-common" version = "0.16.2" +source = "git+https://github.com/loro-dev/loro.git?rev=90470658435ec4c62b5af59ebb82fe9e1f5aa761#90470658435ec4c62b5af59ebb82fe9e1f5aa761" +dependencies = [ + "arbitrary", + "enum-as-inner 0.6.0", + "fxhash", + "loro-rle 0.16.2", + "nonmax", + "serde", + "serde_columnar", + "string_cache", + "thiserror", +] + +[[package]] +name = "loro-common" +version = "0.16.10" dependencies = [ "arbitrary", "enum-as-inner 0.6.0", "fxhash", "js-sys", - "loro-rle 0.16.2", + "loro-rle 0.16.10", "nonmax", "serde", "serde_columnar", @@ -1026,24 +1042,20 @@ dependencies = [ ] [[package]] -name = "loro-common" +name = "loro-delta" version = "0.16.2" source = "git+https://github.com/loro-dev/loro.git?rev=90470658435ec4c62b5af59ebb82fe9e1f5aa761#90470658435ec4c62b5af59ebb82fe9e1f5aa761" dependencies = [ - "arbitrary", - "enum-as-inner 0.6.0", - "fxhash", - "loro-rle 0.16.2 (git+https://github.com/loro-dev/loro.git?rev=90470658435ec4c62b5af59ebb82fe9e1f5aa761)", - "nonmax", - "serde", - "serde_columnar", - "string_cache", - "thiserror", + "arrayvec", + "enum-as-inner 0.5.1", + "generic-btree", + "heapless 0.8.0", + "tracing", ] [[package]] name = "loro-delta" -version = "0.16.2" +version = "0.16.10" dependencies = [ "arrayvec", "color-backtrace", @@ -1058,20 +1070,43 @@ dependencies = [ ] [[package]] -name = "loro-delta" +name = "loro-internal" version = "0.16.2" source = "git+https://github.com/loro-dev/loro.git?rev=90470658435ec4c62b5af59ebb82fe9e1f5aa761#90470658435ec4c62b5af59ebb82fe9e1f5aa761" dependencies = [ - "arrayvec", + "append-only-bytes", + "arref", + "either", "enum-as-inner 0.5.1", + "enum_dispatch", + "fxhash", "generic-btree", - "heapless 0.8.0", + "getrandom", + "im", + "itertools 0.12.1", + "leb128", + "loro-common 0.16.2", + "loro-delta 0.16.2", + "loro-rle 0.16.2", + "loro_fractional_index 0.16.2", + "md5", + "num", + "num-derive", + "num-traits", + "once_cell", + "postcard", + "rand", + "serde", + "serde_columnar", + "serde_json", + "smallvec", + "thiserror", "tracing", ] [[package]] name = "loro-internal" -version = "0.16.2" +version = "0.16.10" dependencies = [ "append-only-bytes", "arbitrary", @@ -1093,10 +1128,10 @@ dependencies = [ "itertools 0.12.1", "js-sys", "leb128", - "loro-common 0.16.2", - "loro-delta 0.16.2", - "loro-rle 0.16.2", - "loro_fractional_index 0.16.2", + "loro-common 0.16.10", + "loro-delta 0.16.10", + "loro-rle 0.16.10", + "loro_fractional_index 0.16.10", "md5", "miniz_oxide 0.7.1", "num", @@ -1121,43 +1156,21 @@ dependencies = [ ] [[package]] -name = "loro-internal" +name = "loro-rle" version = "0.16.2" source = "git+https://github.com/loro-dev/loro.git?rev=90470658435ec4c62b5af59ebb82fe9e1f5aa761#90470658435ec4c62b5af59ebb82fe9e1f5aa761" dependencies = [ "append-only-bytes", "arref", - "either", - "enum-as-inner 0.5.1", - "enum_dispatch", + "enum-as-inner 0.6.0", "fxhash", - "generic-btree", - "getrandom", - "im", - "itertools 0.12.1", - "leb128", - "loro-common 0.16.2 (git+https://github.com/loro-dev/loro.git?rev=90470658435ec4c62b5af59ebb82fe9e1f5aa761)", - "loro-delta 0.16.2 (git+https://github.com/loro-dev/loro.git?rev=90470658435ec4c62b5af59ebb82fe9e1f5aa761)", - "loro-rle 0.16.2 (git+https://github.com/loro-dev/loro.git?rev=90470658435ec4c62b5af59ebb82fe9e1f5aa761)", - "loro_fractional_index 0.16.2 (git+https://github.com/loro-dev/loro.git?rev=90470658435ec4c62b5af59ebb82fe9e1f5aa761)", - "md5", "num", - "num-derive", - "num-traits", - "once_cell", - "postcard", - "rand", - "serde", - "serde_columnar", - "serde_json", "smallvec", - "thiserror", - "tracing", ] [[package]] name = "loro-rle" -version = "0.16.2" +version = "0.16.10" dependencies = [ "append-only-bytes", "arref", @@ -1172,19 +1185,6 @@ dependencies = [ "static_assertions", ] -[[package]] -name = "loro-rle" -version = "0.16.2" -source = "git+https://github.com/loro-dev/loro.git?rev=90470658435ec4c62b5af59ebb82fe9e1f5aa761#90470658435ec4c62b5af59ebb82fe9e1f5aa761" -dependencies = [ - "append-only-bytes", - "arref", - "enum-as-inner 0.6.0", - "fxhash", - "num", - "smallvec", -] - [[package]] name = "loro-thunderdome" version = "0.6.2" @@ -1198,8 +1198,8 @@ dependencies = [ "console_error_panic_hook", "getrandom", "js-sys", - "loro-internal 0.16.2", - "loro-rle 0.16.2", + "loro-internal 0.16.10", + "loro-rle 0.16.10", "serde", "serde-wasm-bindgen 0.6.5", "serde_json", @@ -1212,9 +1212,8 @@ dependencies = [ [[package]] name = "loro_fractional_index" version = "0.16.2" +source = "git+https://github.com/loro-dev/loro.git?rev=90470658435ec4c62b5af59ebb82fe9e1f5aa761#90470658435ec4c62b5af59ebb82fe9e1f5aa761" dependencies = [ - "criterion 0.5.1", - "fractional_index", "imbl", "rand", "serde", @@ -1223,9 +1222,10 @@ dependencies = [ [[package]] name = "loro_fractional_index" -version = "0.16.2" -source = "git+https://github.com/loro-dev/loro.git?rev=90470658435ec4c62b5af59ebb82fe9e1f5aa761#90470658435ec4c62b5af59ebb82fe9e1f5aa761" +version = "0.16.10" dependencies = [ + "criterion 0.5.1", + "fractional_index", "imbl", "rand", "serde", diff --git a/crates/delta/Cargo.toml b/crates/delta/Cargo.toml index 766c12fc..50d6beb3 100644 --- a/crates/delta/Cargo.toml +++ b/crates/delta/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "loro-delta" -version = "0.16.2" +version = "0.16.10" edition = "2021" license = "MIT" description = "Loro internal library. It's used as a delta between two versions of text or lists. It's also an efficient Rope." diff --git a/crates/fractional_index/Cargo.toml b/crates/fractional_index/Cargo.toml index b7533e39..42ab4f54 100644 --- a/crates/fractional_index/Cargo.toml +++ b/crates/fractional_index/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "loro_fractional_index" -version = "0.16.2" +version = "0.16.10" edition = "2021" license = "MIT" description = "Fraction index for Loro. Fork and modified from jamsocket/fractional_index" diff --git a/crates/loro-common/Cargo.toml b/crates/loro-common/Cargo.toml index 201b7226..cdc62acc 100644 --- a/crates/loro-common/Cargo.toml +++ b/crates/loro-common/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "loro-common" -version = "0.16.2" +version = "0.16.10" edition = "2021" license = "MIT" description = "Common types and functions for Loro. This is an internal lib of Loro." @@ -14,7 +14,7 @@ keywords = ["crdt", "local-first"] # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -rle = { path = "../rle", version = "0.16.2", package = "loro-rle" } +rle = { path = "../rle", version = "0.16.10", package = "loro-rle" } serde = { workspace = true } thiserror = "1.0.43" wasm-bindgen = { version = "=0.2.92", optional = true } diff --git a/crates/loro-internal/Cargo.toml b/crates/loro-internal/Cargo.toml index 23977920..6ef3c6af 100644 --- a/crates/loro-internal/Cargo.toml +++ b/crates/loro-internal/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "loro-internal" -version = "0.16.2" +version = "0.16.10" edition = "2021" license = "MIT" description = "Loro internal library. Do not use it directly as it's not stable." @@ -15,12 +15,12 @@ keywords = ["crdt", "local-first"] [dependencies] smallvec = { workspace = true } -loro-delta = { path = "../delta", version = "0.16.2", package = "loro-delta" } -rle = { path = "../rle", version = "0.16.2", package = "loro-rle" } -loro-common = { path = "../loro-common", version = "0.16.2" } +loro-delta = { path = "../delta", version = "0.16.10", package = "loro-delta" } +rle = { path = "../rle", version = "0.16.10", package = "loro-rle" } +loro-common = { path = "../loro-common", version = "0.16.10" } fractional_index = { path = "../fractional_index", features = [ "serde", -], version = "0.16.2", package = "loro_fractional_index" } +], version = "0.16.10", package = "loro_fractional_index" } postcard = "1" fxhash = { workspace = true } serde = { workspace = true } diff --git a/crates/loro/Cargo.toml b/crates/loro/Cargo.toml index b373ad42..ba21d3f9 100644 --- a/crates/loro/Cargo.toml +++ b/crates/loro/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "loro" -version = "0.16.2" +version = "0.16.10" edition = "2021" license = "MIT" documentation = "https://docs.rs/loro/" @@ -14,8 +14,8 @@ keywords = ["crdt", "local-first"] # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -loro-internal = { path = "../loro-internal", version = "0.16.2" } -delta = { path = "../delta", package = "loro-delta", version = "0.16.2" } +loro-internal = { path = "../loro-internal", version = "0.16.10" } +delta = { path = "../delta", package = "loro-delta", version = "0.16.10" } generic-btree = { version = "^0.10.5" } enum-as-inner = "0.6.0" either = "1.9.0" diff --git a/crates/rle/Cargo.toml b/crates/rle/Cargo.toml index be6c2a80..4b4f29ff 100644 --- a/crates/rle/Cargo.toml +++ b/crates/rle/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "loro-rle" -version = "0.16.2" +version = "0.16.10" edition = "2021" license = "MIT" description = "A internal library of loro for storing and manipulating run-length encoded data. Do not use it directly." diff --git a/scripts/.vscode/settings.json b/scripts/.vscode/settings.json new file mode 100644 index 00000000..f7f606b3 --- /dev/null +++ b/scripts/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "deno.enable": true +} diff --git a/scripts/bump-rust-crates.ts b/scripts/bump-rust-crates.ts new file mode 100644 index 00000000..fa866574 --- /dev/null +++ b/scripts/bump-rust-crates.ts @@ -0,0 +1,86 @@ +import { parse as parseToml, stringify as stringifyToml } from "@std/toml"; +import { walk } from "@std/fs/"; + +const CRATES = { + "loro": "loro", + "loro-internal": "loro-internal", + "loro-common": "loro-common", + "rle": "loro-rle", + "delta": "loro-delta", + "fractional_index": "loro_fractional_index", +}; + +async function updateCargoToml(filePath: string, targetVersion: string) { + let content = await Deno.readTextFile(filePath); + const crates = Object.values(CRATES); + + // Update package version + content = content.replace( + /^\s*version\s*=\s*"[^"]*"/m, + `version = "${targetVersion}"`, + ); + + // Update dependencies + const depRegex = new RegExp( + `^(\\s*)(${ + crates.join("|") + })\\s*=\\s*(?:("\\S+"|\\{[^}]*version\\s*=\\s*)("[^"]*"))`, + "gm", + ); + content = content.replace(depRegex, `$1$2 = $3"${targetVersion}"`); + + // Handle package rename cases and path+version cases + for (const [oldName, newName] of Object.entries(CRATES)) { + const packageRegex = new RegExp( + `^(\\s*${oldName}\\s*=\\s*\\{[^}]*(?:package\\s*=\\s*"${newName}")?[^}]*version\\s*=\\s*)("[^"]*")`, + "gm", + ); + content = content.replace( + packageRegex, + `$1"${targetVersion}"`, + ); + } + + // Write updated content back to file + await Deno.writeTextFile(filePath, content); + console.log(`Updated ${filePath}`); +} + +async function main() { + const targetVersion = Deno.args[0]; + if (!targetVersion) { + console.error("Please provide a target version as an argument."); + Deno.exit(1); + } + + for (const [key, _] of Object.entries(CRATES)) { + const cargoTomlPath = `../crates/${key}/Cargo.toml`; + try { + await updateCargoToml(cargoTomlPath, targetVersion); + } catch (error) { + console.error(`Error updating ${cargoTomlPath}:`, error); + } + } + + const crates = Object.values(CRATES); + // Update dependencies in all Cargo.toml files + for await (const entry of walk("../crates", { exts: [".toml"] })) { + if (entry.name === "Cargo.toml") { + if ( + crates.every((x) => !entry.path.includes("crates/" + x + "/")) + ) { + continue; + } + + try { + await updateCargoToml(entry.path, targetVersion); + } catch (error) { + console.error(`Error updating ${entry.path}:`, error); + } + } + } +} + +if (import.meta.main) { + main(); +} diff --git a/scripts/deno.json b/scripts/deno.json new file mode 100644 index 00000000..c087ca80 --- /dev/null +++ b/scripts/deno.json @@ -0,0 +1,6 @@ +{ + "imports": { + "@std/fs": "jsr:@std/fs@^1.0.2", + "@std/toml": "jsr:@std/toml@^1.0.1" + } +} diff --git a/scripts/deno.lock b/scripts/deno.lock new file mode 100644 index 00000000..4f776732 --- /dev/null +++ b/scripts/deno.lock @@ -0,0 +1,38 @@ +{ + "version": "3", + "packages": { + "specifiers": { + "jsr:@std/collections@^1.0.5": "jsr:@std/collections@1.0.5", + "jsr:@std/fs@^1.0.2": "jsr:@std/fs@1.0.2", + "jsr:@std/path@^1.0.3": "jsr:@std/path@1.0.3", + "jsr:@std/toml@^1.0.1": "jsr:@std/toml@1.0.1" + }, + "jsr": { + "@std/collections@1.0.5": { + "integrity": "ab9eac23b57a0c0b89ba45134e61561f69f3d001f37235a248ed40be260c0c10" + }, + "@std/fs@1.0.2": { + "integrity": "af57555c7a224a6f147d5cced5404692974f7a628ced8eda67e0d22d92d474ec", + "dependencies": [ + "jsr:@std/path@^1.0.3" + ] + }, + "@std/path@1.0.3": { + "integrity": "cd89d014ce7eb3742f2147b990f6753ee51d95276bfc211bc50c860c1bc7df6f" + }, + "@std/toml@1.0.1": { + "integrity": "b55b407159930f338d384b1f8fd317c8e8a35e27ebb8946155f49e3a158d16c4", + "dependencies": [ + "jsr:@std/collections@^1.0.5" + ] + } + } + }, + "remote": {}, + "workspace": { + "dependencies": [ + "jsr:@std/fs@^1.0.2", + "jsr:@std/toml@^1.0.1" + ] + } +}