fix list.json

pull/5166/head
bunsenstraat 5 months ago committed by Aniket
parent 4ed2409f0e
commit 02b1677b15
  1. 29
      apps/remix-ide/ci/downloadsoljson.sh

@ -4,7 +4,7 @@ echo "Downloading specified soljson.js version based on defaultVersion in packag
set -e
# Check if curl and jq are installed
# Check if curl is installed
if ! command -v curl &> /dev/null; then
echo "curl could not be found"
exit 1
@ -14,32 +14,35 @@ fi
defaultVersion=$(grep '"defaultVersion"' package.json | awk -F '"' '{print $4}')
echo "Specified version from package.json: $defaultVersion"
# Download the list.json file containing available versions
curl -s https://binaries.soliditylang.org/wasm/list.json > list.json
# Fetch the list.json from the Solidity binaries
listJson=$(curl -s --connect-timeout 5 --max-time 5 https://binaries.soliditylang.org/wasm/list.json)
# Check if the download was successful
if [ -z "$listJson" ]; then
echo "Failed to fetch version list. No internet connection or the connection is too slow."
exit 0 # Silently exit
fi
# Check if the specified version exists in the list
check=$(echo "$listJson" | grep "\"$defaultVersion\"")
# Use jq to extract the path for the specified version from the builds array
check=$(grep "\"$defaultVersion\"" list.json)
if [ -z "$check" ]; then
echo "The specified version $defaultVersion could not be found in the list"
exit 1
fi
echo "Path for the specified version: $defaultVersion"
fullPath="https://binaries.soliditylang.org/bin/$defaultVersion"
echo "Download fullPath: $fullPath"
# Ensure the target directory exists
if [ ! -d "./apps/remix-ide/src/assets/js/soljson" ]; then
mkdir -p ./apps/remix-ide/src/assets/js/soljson
fi
# Download the file to ./apps/remix-ide/src/assets/js/soljson.js
echo "Downloading soljson.js from "$fullPath" to ./apps/remix-ide/src/assets/js/soljson.js"
# Download the soljson.js file to ./apps/remix-ide/src/assets/js/soljson.js
echo "Downloading soljson.js from $fullPath to ./apps/remix-ide/src/assets/js/soljson.js"
curl -s "$fullPath" > ./apps/remix-ide/src/assets/js/soljson.js
# Copy the downloaded soljson.js to the specific version directory
cp ./apps/remix-ide/src/assets/js/soljson.js "./apps/remix-ide/src/assets/js/soljson/$path"
cp list.json ./apps/remix-ide/src/assets/list.json
cp ./apps/remix-ide/src/assets/js/soljson.js "./apps/remix-ide/src/assets/js/soljson/$defaultVersion.js"
# Clean up by removing the list.json
rm list.json
echo "Download and setup of soljson.js complete"

Loading…
Cancel
Save