feat: using script to update the collab source. (#3508)

* chore: add script

* chore: update script

* chore: update bytes version

* chore: submit lock file
This commit is contained in:
Nathan.fooo 2023-09-24 15:50:58 +08:00 committed by GitHub
parent 3be39f5e7b
commit 56687581f2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 68 additions and 38 deletions

View File

@ -28,3 +28,4 @@ dist-ssr
**/src/appflowy_app/i18n/translations/
coverage
**/AppFlowy-Collab

View File

@ -521,9 +521,9 @@ checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610"
[[package]]
name = "bytes"
version = "1.4.0"
version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be"
checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223"
dependencies = [
"serde",
]

View File

@ -36,10 +36,14 @@ custom-protocol = ["tauri/custom-protocol"]
client-api = { git = "https://github.com/AppFlowy-IO/AppFlowy-Cloud", rev = "8f8f6a" }
# ⚠️⚠️⚠️
# Please using the following command to update the revision id
# Current directory: frontend
# Run the script:
# Please use the following script to update collab.
# Working directory: frontend
#
# To update the commit ID, run:
# scripts/tool/update_collab_rev.sh new_rev_id
#
# To switch to the local path, run:
# scripts/tool/update_collab_source.sh
# ⚠️⚠️⚠️️
collab = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "bf3a19" }
collab-folder = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "bf3a19" }
@ -51,16 +55,6 @@ collab-user = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "b
collab-define = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "bf3a19" }
collab-sync-protocol = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "bf3a19" }
#collab = { path = "../../../../AppFlowy-Collab/collab" }
#collab-folder = { path = "../../../../AppFlowy-Collab/collab-folder" }
#collab-document = { path = "../../../../AppFlowy-Collab/collab-document" }
#collab-database = { path = "../../../../AppFlowy-Collab/collab-database" }
#collab-plugins = { path = "../../../../AppFlowy-Collab/collab-plugins" }
#collab-persistence = { path = "../../../../AppFlowy-Collab/collab-persistence" }
#collab-user = { path = "../../../../AppFlowy-Collab/collab-user" }
#collab-define = { path = "../../../../AppFlowy-Collab/collab-define" }
#collab-sync-protocol = { path = "../../../../AppFlowy-Collab/collab-sync-protocol" }

View File

@ -78,10 +78,14 @@ incremental = false
client-api = { git = "https://github.com/AppFlowy-IO/AppFlowy-Cloud", rev = "8f8f6a" }
# ⚠️⚠️⚠️
# Please using the following command to update the revision id
# Current directory: frontend
# Run the script:
# Please use the following script to update collab.
# Working directory: frontend
#
# To update the commit ID, run:
# scripts/tool/update_collab_rev.sh new_rev_id
#
# To switch to the local path, run:
# scripts/tool/update_collab_source.sh
# ⚠️⚠️⚠️️
collab = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "bf3a19" }
collab-folder = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "bf3a19" }
@ -92,13 +96,3 @@ collab-user = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "b
collab-define = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "bf3a19" }
collab-sync-protocol = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "bf3a19" }
collab-persistence = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "bf3a19" }
#collab = { path = "../AppFlowy-Collab/collab" }
#collab-folder = { path = "../AppFlowy-Collab/collab-folder" }
#collab-database= { path = "../AppFlowy-Collab/collab-database" }
#collab-document = { path = "../AppFlowy-Collab/collab-document" }
#collab-plugins = { path = "../AppFlowy-Collab/collab-plugins" }
#collab-persistence = { path = "../AppFlowy-Collab/collab-persistence" }
#collab-user = { path = "../AppFlowy-Collab/collab-user" }
#collab-define = { path = "../AppFlowy-Collab/collab-define" }
#collab-sync-protocol = { path = "../AppFlowy-Collab/collab-sync-protocol" }

View File

@ -19,7 +19,7 @@ tokio = { version = "1.26", features = ["full", "rt-multi-thread", "tracing"] }
log = "0.4.17"
serde = { version = "1.0", features = ["derive"] }
serde_json = { version = "1.0" }
bytes = { version = "1.4" }
bytes = { version = "1.5" }
crossbeam-utils = "0.8.15"
lazy_static = "1.4.0"
parking_lot = "0.12.1"

View File

@ -13,7 +13,7 @@ flowy-error = { workspace = true }
flowy-derive = { path = "../../../shared-lib/flowy-derive" }
protobuf = {version = "2.28.0"}
bytes = { version = "1.4" }
bytes = { version = "1.5" }
strum_macros = "0.21"
[build-dependencies]

View File

@ -33,7 +33,7 @@ flowy-storage = { workspace = true }
tracing = { version = "0.1", features = ["log"] }
futures-core = { version = "0.3", default-features = false }
bytes = "1.4"
bytes = "1.5"
tokio = { version = "1.26", features = ["full"] }
console-subscriber = { version = "0.1.8", optional = true }
parking_lot = "0.12.1"

View File

@ -20,7 +20,7 @@ flowy-error = { workspace = true, features = ["impl_from_dispatch_error", "impl_
lib-dispatch = { workspace = true }
tokio = { version = "1.26", features = ["sync"] }
flowy-task= { workspace = true }
bytes = { version = "1.4" }
bytes = { version = "1.5" }
tracing = { version = "0.1", features = ["log"] }
serde = { version = "1.0", features = ["derive"] }
serde_json = {version = "1.0"}

View File

@ -20,7 +20,7 @@ lib-dispatch = { workspace = true }
lib-infra = { path = "../../../shared-lib/lib-infra" }
protobuf = {version = "2.28.0"}
bytes = { version = "1.4" }
bytes = { version = "1.5" }
nanoid = "0.4.0"
parking_lot = "0.12.1"
strum_macros = "0.21"

View File

@ -19,7 +19,7 @@ unicode-segmentation = "1.10"
tracing = { version = "0.1", features = ["log"] }
flowy-error = { path = "../flowy-error", features = ["impl_from_dispatch_error"]}
lib-dispatch = { workspace = true }
bytes = { version = "1.4" }
bytes = { version = "1.5" }
lib-infra = { path = "../../../shared-lib/lib-infra" }
tokio = { version = "1.26", features = ["full"] }
nanoid = "0.4.0"

View File

@ -9,7 +9,7 @@ edition = "2018"
lazy_static = { version = "1.4.0" }
protobuf = { version = "2.28.0" }
tracing = { version = "0.1", features = ["log"] }
bytes = { version = "1.4" }
bytes = { version = "1.5" }
serde = "1.0"
flowy-derive = { path = "../../../shared-lib/flowy-derive" }

View File

@ -0,0 +1,41 @@
#!/bin/bash
# Paths to your Cargo.toml files
REPO_PATH="./AppFlowy-Collab"
CARGO_TOML_1="./rust-lib/Cargo.toml"
REPO_RELATIVE_PATH_1="../AppFlowy-Collab"
CARGO_TOML_2="./appflowy_tauri/src-tauri/Cargo.toml"
REPO_RELATIVE_PATH_2="../../AppFlowy-Collab"
# Function to switch dependencies in a given Cargo.toml
switch_deps() {
local cargo_toml="$1"
local repo_path="$2"
if grep -q 'git = "https://github.com/AppFlowy-IO/AppFlowy-Collab"' "$cargo_toml"; then
cp "$cargo_toml" "$cargo_toml.bak"
# Switch to local paths
for crate in collab collab-folder collab-document collab-database collab-plugins collab-user collab-define collab-sync-protocol collab-persistence; do
sed -i '' \
-e "s#${crate} = { git = \"https://github.com/AppFlowy-IO/AppFlowy-Collab\", rev = \"[a-f0-9]*\" }#${crate} = { path = \"$repo_path/$crate\" }#g" \
"$cargo_toml"
done
echo "Switched to local paths in $cargo_toml."
echo "🙏🏽Switch back to git dependencies by rerunning this script"
else
# Switch back to git dependencies
cp "$cargo_toml.bak" "$cargo_toml"
echo "Switched back to git dependencies in $cargo_toml."
rm -rf "$cargo_toml.bak"
fi
}
# Check if AppFlowy-Collab directory exists
if [ ! -d "$REPO_PATH" ]; then
echo "AppFlowy-Collab directory not found. Cloning the repository..."
git clone https://github.com/AppFlowy-IO/AppFlowy-Collab.git "$REPO_PATH"
fi
# Switch dependencies in both Cargo.toml files
switch_deps "$CARGO_TOML_1" "$REPO_RELATIVE_PATH_1"
switch_deps "$CARGO_TOML_2" "$REPO_RELATIVE_PATH_2"