From dc78fa721a7cf048272d18efa4fd9f74024b595f Mon Sep 17 00:00:00 2001 From: Andras Schmelczer Date: Sun, 15 Jun 2025 12:16:32 +0100 Subject: [PATCH] Updates scripts --- scripts/bump-version.sh | 15 +----- scripts/clean-up.sh | 4 -- scripts/dev-website.sh | 8 ++++ scripts/e2e.sh | 82 -------------------------------- scripts/update-api-types.sh | 11 ----- scripts/utils/wait-for-server.sh | 24 ---------- 6 files changed, 10 insertions(+), 134 deletions(-) delete mode 100755 scripts/clean-up.sh create mode 100755 scripts/dev-website.sh delete mode 100755 scripts/e2e.sh delete mode 100755 scripts/update-api-types.sh delete mode 100755 scripts/utils/wait-for-server.sh diff --git a/scripts/bump-version.sh b/scripts/bump-version.sh index 55813bd..abd0054 100755 --- a/scripts/bump-version.sh +++ b/scripts/bump-version.sh @@ -22,27 +22,16 @@ else echo "Your working directory is clean." fi -echo "Bumping backend versions" +echo "Bumping versions" cd backend cargo set-version --bump $1 -echo "Bumping frontend versions" -cd ../frontend -npm version $1 --workspaces +wasm-pack build --target web --features wasm -echo "Updating frontend dependencies to match the new backend versions" -cd ../backend/sync_lib -wasm-pack build --target web --features console_error_panic_hook -cd ../../frontend -npm install - -cd .. -cp frontend/obsidian-plugin/manifest.json manifest.json # for BRAT, otherwise it wouldn't update # Commit and tag git add . -TAG=$(node -p "require('./frontend/obsidian-plugin/package.json').version") git commit -m "Bump versions to $TAG" git push diff --git a/scripts/clean-up.sh b/scripts/clean-up.sh deleted file mode 100755 index 85c12d1..0000000 --- a/scripts/clean-up.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash - -rm -rf backend/databases -rm -rf logs diff --git a/scripts/dev-website.sh b/scripts/dev-website.sh new file mode 100755 index 0000000..39262fb --- /dev/null +++ b/scripts/dev-website.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +cp -R pkg/reconcile.js examples/website/ +cp -R pkg/reconcile_bg.wasm examples/website/ + +cd examples/website/ + +python3 -m http.server $1 \ No newline at end of file diff --git a/scripts/e2e.sh b/scripts/e2e.sh deleted file mode 100755 index 149d76f..0000000 --- a/scripts/e2e.sh +++ /dev/null @@ -1,82 +0,0 @@ -#!/bin/bash - -set -e -set -o pipefail - -# Check if the argument is provided -if [ $# -eq 0 ]; then - echo "Usage: $0 " - exit 1 -fi - -# Get the number of processes from the first argument -process_count=$1 - -mkdir -p logs - -cd frontend -npm run build - -../scripts/utils/wait-for-server.sh - -pids=() -for i in $(seq 1 $process_count); do - node test-client/dist/cli.js > "../logs/log_${i}.log" 2>&1 & - pids+=($!) -done - -cd - - -print_failed_log() { - for i in $(seq 1 $process_count); do - if [ -n "${pids[$i-1]}" ] && ! kill -0 ${pids[$i-1]} 2>/dev/null; then - # Get the exit code of the process - wait ${pids[$i-1]} - exit_code=$? - - # Only consider non-zero exit codes as failures - if [ $exit_code -ne 0 ]; then - cat "$(pwd)/logs/log_${i}.log" - echo "Process ${pids[$i-1]} failed with exit code $exit_code. Log file: $(pwd)/logs/log_${i}.log" - return 0 - else - echo "Process ${pids[$i-1]} completed successfully with exit code 0" - # Mark this PID as processed by setting it to empty - pids[$i-1]="" - fi - fi - done - return 1 -} - -echo "Monitoring $process_count processes" - -# Monitor processes -while true; do - if print_failed_log; then - # Kill remaining processes - for pid in "${pids[@]}"; do - if [ -n "$pid" ]; then - kill $pid 2>/dev/null || true - fi - done - exit 1 - fi - - # Check if all processes have completed - all_done=true - for pid in "${pids[@]}"; do - if [ -n "$pid" ] && kill -0 $pid 2>/dev/null; then - all_done=false - break - fi - done - - if $all_done; then - echo "All processes completed successfully" - exit 0 - fi - - sleep 0.2 -done - diff --git a/scripts/update-api-types.sh b/scripts/update-api-types.sh deleted file mode 100755 index aea8a89..0000000 --- a/scripts/update-api-types.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash - -set -e - -rm -rf backend/sync_server/bindings - -cd backend -cargo test export_bindings -cd - - -cp -r backend/sync_server/bindings/* frontend/sync-client/src/services/types/ diff --git a/scripts/utils/wait-for-server.sh b/scripts/utils/wait-for-server.sh deleted file mode 100755 index 7824c40..0000000 --- a/scripts/utils/wait-for-server.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/bash - -set -e - -SERVER_URL="http://localhost:3000" -MAX_RETRIES=30 -RETRY_INTERVAL_IN_SECONDS=5 - -echo "Waiting for $SERVER_URL to become available..." -count=0 -while [ $count -lt $MAX_RETRIES ]; do - if curl -s -f -o /dev/null $SERVER_URL; then - echo "$SERVER_URL is now available!" - break - fi - echo "Attempt $(($count+1))/$MAX_RETRIES: $SERVER_URL not available yet, retrying in ${RETRY_INTERVAL_IN_SECONDS}s..." - sleep $RETRY_INTERVAL_IN_SECONDS - count=$(($count+1)) -done - -if [ $count -eq $MAX_RETRIES ]; then - echo "Error: $SERVER_URL did not become available after $MAX_RETRIES attempts." - exit 1 -fi