From adeb739812708f25b6e46ba167aede1f4afaf30b Mon Sep 17 00:00:00 2001 From: thephez Date: Thu, 24 Jul 2025 13:11:42 -0400 Subject: [PATCH 1/3] feat(wasm-sdk): add version/build information display to web interface MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add new WASM functions to expose package version, git commit, branch, and build time - Modify build script to inject git information at build time - Update index.html to display version info in header with tooltip - Provides developers with clear build context and version information 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- packages/scripts/build-wasm.sh | 16 +++++++++++++++- packages/wasm-sdk/index.html | 23 ++++++++++++++++++++++- packages/wasm-sdk/src/sdk.rs | 24 ++++++++++++++++++++++++ 3 files changed, 61 insertions(+), 2 deletions(-) diff --git a/packages/scripts/build-wasm.sh b/packages/scripts/build-wasm.sh index cdde279578e..52a7e14a261 100755 --- a/packages/scripts/build-wasm.sh +++ b/packages/scripts/build-wasm.sh @@ -103,9 +103,16 @@ if [ "$USE_WASM_PACK" = true ]; then # Build using wasm-pack echo "Building with wasm-pack..." + # Set build-time environment variables + export GIT_COMMIT=$(git rev-parse --short HEAD 2>/dev/null || echo "unknown") + export GIT_BRANCH=$(git branch --show-current 2>/dev/null || echo "unknown") + export BUILD_TIME=$(date -u +"%Y-%m-%dT%H:%M:%SZ") + + echo "Build info: commit=$GIT_COMMIT, branch=$GIT_BRANCH, time=$BUILD_TIME" + # Disable LTO for wasm-pack builds to avoid conflicts export CARGO_PROFILE_RELEASE_LTO=false - export RUSTFLAGS="-C lto=off" + export RUSTFLAGS="-C lto=off --cfg=env_vars_set" # Add features if specified FEATURES_ARG="" @@ -124,6 +131,13 @@ else # Build using cargo directly echo "Building with cargo..." + # Set build-time environment variables + export GIT_COMMIT=$(git rev-parse --short HEAD 2>/dev/null || echo "unknown") + export GIT_BRANCH=$(git branch --show-current 2>/dev/null || echo "unknown") + export BUILD_TIME=$(date -u +"%Y-%m-%dT%H:%M:%SZ") + + echo "Build info: commit=$GIT_COMMIT, branch=$GIT_BRANCH, time=$BUILD_TIME" + # Add features if specified FEATURES_ARG="" if [ -n "${CARGO_BUILD_FEATURES:-}" ]; then diff --git a/packages/wasm-sdk/index.html b/packages/wasm-sdk/index.html index 5ad4d43f85c..bf189494793 100644 --- a/packages/wasm-sdk/index.html +++ b/packages/wasm-sdk/index.html @@ -791,7 +791,12 @@
-

Dash Platform WASM JS SDK

+
+

Dash Platform WASM JS SDK

+
+ Loading version info... +
+