From 63595eedc7e7b5726ee09bb319e0101c30a08999 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BF=97=E5=AE=87?= Date: Fri, 12 Sep 2025 01:40:27 +0000 Subject: [PATCH 1/2] chore(just): Add `verify-standalone` recipe MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This recipe verifies that a crate can be packaged and built in isolation (without workspace dependencies). This is useful for ensuring updated crates do not accidentally depend on breaking changes in upstream crates of the same workspace. Added alias `vs` for quick access to this commonly used verification step. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- justfile | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/justfile b/justfile index b5ca94d16..106499ca2 100644 --- a/justfile +++ b/justfile @@ -3,6 +3,7 @@ alias c := check alias f := fmt alias t := test alias p := pre-push +alias vs := verify-standalone _default: @just --list @@ -57,3 +58,43 @@ _test-testenv: # Run pre-push suite: format, check, and test pre-push: fmt check test + +# Verify that a crate can be built standalone without workspace dependencies +# This ensures the crate is publishable and doesn't accidentally depend on +# breaking changes from other workspace crates +verify-standalone crate *args="": + #!/usr/bin/env bash + set -euo pipefail + + echo "Verifying {{crate}} can build standalone..." + + # Package the crate (default: --no-verify, can be overridden with args) + cargo package -p {{crate}} --no-verify {{args}} + + # Find the packaged tarball + CRATE_VERSION=$(cargo metadata --format-version 1 --no-deps | jq -r ".packages[] | select(.name == \"{{crate}}\") | .version") + TARBALL="target/package/{{crate}}-${CRATE_VERSION}.crate" + + if [ ! -f "$TARBALL" ]; then + echo "Error: Could not find packaged tarball at $TARBALL" + exit 1 + fi + + # Create a temporary directory for unpacking + TEMP_DIR=$(mktemp -d) + trap "rm -rf $TEMP_DIR" EXIT + + # Unpack the tarball + tar -xzf "$TARBALL" -C "$TEMP_DIR" + + # Build the unpacked crate with --locked to ensure it uses registry dependencies + cd "$TEMP_DIR/{{crate}}-${CRATE_VERSION}" + + # Set temporary directories to avoid using workspace dependencies + export CARGO_HOME="$TEMP_DIR/.cargo" + export CARGO_TARGET_DIR="$TEMP_DIR/target" + + echo "Building {{crate}} in isolation..." + cargo build --locked + + echo "✅ {{crate}} builds successfully in isolation!" From 3fbf406c31378e747bf3d1d5ca90bc60fc6db297 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BF=97=E5=AE=87?= Date: Fri, 12 Sep 2025 01:57:05 +0000 Subject: [PATCH 2/2] chore(just): Add `verify-standalone-all` recipe MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Verifies all publishable workspace crates can build in isolation. Added alias `vsa` for quick access. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- justfile | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/justfile b/justfile index 106499ca2..8115d5cad 100644 --- a/justfile +++ b/justfile @@ -4,6 +4,7 @@ alias f := fmt alias t := test alias p := pre-push alias vs := verify-standalone +alias vsa := verify-standalone-all _default: @just --list @@ -98,3 +99,36 @@ verify-standalone crate *args="": cargo build --locked echo "✅ {{crate}} builds successfully in isolation!" + +# Verify all publishable crates can be built standalone +verify-standalone-all *args="": + #!/usr/bin/env bash + set -euo pipefail + + # Get all workspace crates (excluding examples) + CRATES=$(cargo metadata --format-version 1 --no-deps | jq -r '.packages[] | select(.source == null and (.name | startswith("example_") | not)) | .name' | sort) + + echo "Verifying all publishable crates can build standalone..." + echo "Crates to verify:" + echo "$CRATES" | sed 's/^/ - /' + echo + + for crate in $CRATES; do + echo "=========================================" + echo "Verifying $crate..." + echo "=========================================" + + if ! just verify-standalone "$crate" {{args}}; then + echo "❌ $crate: FAILED" + echo "=========================================" + echo "❌ VERIFICATION FAILED for: $crate" + echo "=========================================" + exit 1 + fi + echo "✅ $crate: SUCCESS" + echo + done + + echo "=========================================" + echo "✅ All crates build successfully in isolation!" + echo "========================================="