Updates scripts
This commit is contained in:
parent
9cdebed979
commit
dc78fa721a
6 changed files with 10 additions and 134 deletions
|
|
@ -22,27 +22,16 @@ else
|
||||||
echo "Your working directory is clean."
|
echo "Your working directory is clean."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Bumping backend versions"
|
echo "Bumping versions"
|
||||||
cd backend
|
cd backend
|
||||||
cargo set-version --bump $1
|
cargo set-version --bump $1
|
||||||
|
|
||||||
echo "Bumping frontend versions"
|
wasm-pack build --target web --features wasm
|
||||||
cd ../frontend
|
|
||||||
npm version $1 --workspaces
|
|
||||||
|
|
||||||
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
|
# Commit and tag
|
||||||
git add .
|
git add .
|
||||||
TAG=$(node -p "require('./frontend/obsidian-plugin/package.json').version")
|
|
||||||
git commit -m "Bump versions to $TAG"
|
git commit -m "Bump versions to $TAG"
|
||||||
|
|
||||||
git push
|
git push
|
||||||
|
|
|
||||||
|
|
@ -1,4 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
rm -rf backend/databases
|
|
||||||
rm -rf logs
|
|
||||||
8
scripts/dev-website.sh
Executable file
8
scripts/dev-website.sh
Executable file
|
|
@ -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
|
||||||
|
|
@ -1,82 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
set -e
|
|
||||||
set -o pipefail
|
|
||||||
|
|
||||||
# Check if the argument is provided
|
|
||||||
if [ $# -eq 0 ]; then
|
|
||||||
echo "Usage: $0 <number_of_processes>"
|
|
||||||
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
|
|
||||||
|
|
||||||
|
|
@ -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/
|
|
||||||
|
|
@ -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
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue