diff --git a/Cargo.lock b/Cargo.lock index 1a2f1e481..432ba0340 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4000,32 +4000,13 @@ dependencies = [ [[package]] name = "spacetimedb-client-api-messages" -version = "0.1.0" +version = "0.5.0" dependencies = [ "prost", "prost-build", "strum", ] -[[package]] -name = "spacetimedb-client-sdk" -version = "0.5.0" -dependencies = [ - "anyhow", - "anymap", - "futures", - "futures-channel", - "http", - "im", - "log", - "prost", - "spacetimedb-client-api-messages", - "spacetimedb-lib", - "spacetimedb-sats", - "tokio", - "tokio-tungstenite 0.19.0", -] - [[package]] name = "spacetimedb-core" version = "0.5.0" @@ -4147,6 +4128,25 @@ dependencies = [ "thiserror", ] +[[package]] +name = "spacetimedb-sdk" +version = "0.5.0" +dependencies = [ + "anyhow", + "anymap", + "futures", + "futures-channel", + "http", + "im", + "log", + "prost", + "spacetimedb-client-api-messages", + "spacetimedb-lib", + "spacetimedb-sats", + "tokio", + "tokio-tungstenite 0.19.0", +] + [[package]] name = "spacetimedb-standalone" version = "0.5.0" diff --git a/Cargo.toml b/Cargo.toml index b825066fa..3214b11a9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,7 +13,7 @@ members = [ "crates/vm", "crates/replay", "crates/client-api", - "crates/client-sdk", + "crates/sdk", "crates/client-api-messages", "crates/sqltest", "modules/rust-wasm-test", diff --git a/crates/client-api-messages/Cargo.toml b/crates/client-api-messages/Cargo.toml index f5f240e2a..516d9f45f 100644 --- a/crates/client-api-messages/Cargo.toml +++ b/crates/client-api-messages/Cargo.toml @@ -1,7 +1,9 @@ [package] name = "spacetimedb-client-api-messages" -version = "0.1.0" +version = "0.5.0" edition = "2021" +license-file = "LICENSE" +description = "Types for the SpacetimeDB client API messages" [dependencies] strum = { version = "0.24.1", features = ["derive"] } diff --git a/crates/client-api-messages/LICENSE b/crates/client-api-messages/LICENSE new file mode 100644 index 000000000..e69de29bb diff --git a/crates/client-sdk/Cargo.toml b/crates/sdk/Cargo.toml similarity index 54% rename from crates/client-sdk/Cargo.toml rename to crates/sdk/Cargo.toml index ffbae785e..6eb5c3949 100644 --- a/crates/client-sdk/Cargo.toml +++ b/crates/sdk/Cargo.toml @@ -1,15 +1,17 @@ [package] -name = "spacetimedb-client-sdk" +name = "spacetimedb-sdk" version = "0.5.0" edition = "2021" +license-file = "LICENSE" +description = "A Rust SDK for clients to interface with SpacetimeDB" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -spacetimedb-sats = { path = "../sats" } -spacetimedb-lib = { path = "../lib" } -spacetimedb-client-api-messages = { path = "../client-api-messages" } -tokio-tungstenite = { version = "*", features = ["native-tls"] } +spacetimedb-sats = { path = "../sats", version = "0.5.0" } +spacetimedb-lib = { path = "../lib", version = "0.5.0" } +spacetimedb-client-api-messages = { path = "../client-api-messages", version = "0.5.0" } +tokio-tungstenite = { version = "0.19", features = ["native-tls"] } tokio = { version = "1.2", features = ["full"] } http = "0.2" anyhow = "1.0" diff --git a/crates/sdk/LICENSE b/crates/sdk/LICENSE new file mode 100644 index 000000000..e69de29bb diff --git a/crates/client-sdk/src/background_connection.rs b/crates/sdk/src/background_connection.rs similarity index 100% rename from crates/client-sdk/src/background_connection.rs rename to crates/sdk/src/background_connection.rs diff --git a/crates/client-sdk/src/callbacks.rs b/crates/sdk/src/callbacks.rs similarity index 100% rename from crates/client-sdk/src/callbacks.rs rename to crates/sdk/src/callbacks.rs diff --git a/crates/client-sdk/src/client_cache.rs b/crates/sdk/src/client_cache.rs similarity index 100% rename from crates/client-sdk/src/client_cache.rs rename to crates/sdk/src/client_cache.rs diff --git a/crates/client-sdk/src/global_connection.rs b/crates/sdk/src/global_connection.rs similarity index 100% rename from crates/client-sdk/src/global_connection.rs rename to crates/sdk/src/global_connection.rs diff --git a/crates/client-sdk/src/identity.rs b/crates/sdk/src/identity.rs similarity index 100% rename from crates/client-sdk/src/identity.rs rename to crates/sdk/src/identity.rs diff --git a/crates/client-sdk/src/lib.rs b/crates/sdk/src/lib.rs similarity index 100% rename from crates/client-sdk/src/lib.rs rename to crates/sdk/src/lib.rs diff --git a/crates/client-sdk/src/reducer.rs b/crates/sdk/src/reducer.rs similarity index 100% rename from crates/client-sdk/src/reducer.rs rename to crates/sdk/src/reducer.rs diff --git a/crates/client-sdk/src/table.rs b/crates/sdk/src/table.rs similarity index 100% rename from crates/client-sdk/src/table.rs rename to crates/sdk/src/table.rs diff --git a/crates/client-sdk/src/websocket.rs b/crates/sdk/src/websocket.rs similarity index 100% rename from crates/client-sdk/src/websocket.rs rename to crates/sdk/src/websocket.rs diff --git a/tools/publish-crates.sh b/tools/publish-crates.sh new file mode 100755 index 000000000..01f239a76 --- /dev/null +++ b/tools/publish-crates.sh @@ -0,0 +1,62 @@ +#!/bin/bash +set -euo pipefail + +cd "$(dirname "$0")/.." + +DRY_RUN=0 + +if [ "$#" != "0" ]; then + if [ "$1" != "--dry-run" ]; then + echo "$1 is not a valid flag"; + exit 1; + else + DRY_RUN=1 + fi +fi + +if [ $DRY_RUN != 1 ] ; then + echo "You are about to publish to crates.io (dry run is false.)" + echo "We are also going to do a test install after publishing. This will remove any version of spacetimedb-cli you may have installed." + echo + echo "Press [Enter] to continue." + read -r +fi + +BASEDIR=$(pwd) +FIRST_CRATE=1 +declare -a CRATES=("bindings-macro" "bindings-sys" "sats" "lib" "bindings" "cli" "client-api-messages" "sdk") + +for crate in "${CRATES[@]}" ; do + if [ ! -d "${BASEDIR}/crates/${crate}" ] ; then + echo "This crate does not exist: ${crate}" + exit 1 + fi +done + +for crate in "${CRATES[@]}" ; do + if [ $FIRST_CRATE != 1 ] ; then + echo "Waiting 60 seconds for crates.io to update..." + sleep 60 + fi + + cd "${BASEDIR}/crates/${crate}" + if [ $DRY_RUN == 1 ] ; then + cargo publish --dry-run + else + cargo publish + fi + FIRST_CRATE=0 +done + +echo "Doing a test install." + +set +e +cargo uninstall spacetimedb-cli > /dev/null +set -e + +echo +if cargo install spacetimedb-cli ; then + echo "Installation was successful. Congrats on publishing to crates.io!" +else + echo "ERROR: Installation failed! Check the build log for details. This typically means you forgot to update the version of a dependency." +fi diff --git a/tools/upgrade-version.sh b/tools/upgrade-version.sh index a353d41cb..893e4843e 100755 --- a/tools/upgrade-version.sh +++ b/tools/upgrade-version.sh @@ -17,7 +17,7 @@ fsed() { } version="$1" -declare -a crates=("bench" "bindings" "bindings-macro" "bindings-sys" "client-api-messages" "cli" "client-api" "core" "lib" "sats" "standalone" "testing") +declare -a crates=("bench" "bindings" "bindings-macro" "bindings-sys" "client-api-messages" "cli" "client-api" "core" "lib" "sats" "standalone" "testing" "client-api-messages" "sdk") upgrade_version() { toml=crates/$1/Cargo.toml if [ ! -f "$toml" ] ; then