|
|
|
@ -10,27 +10,22 @@ if ! command -v curl &> /dev/null; then |
|
|
|
|
exit 1 |
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
if ! command -v jq &> /dev/null; then |
|
|
|
|
echo "jq could not be found" |
|
|
|
|
exit 1 |
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
# Read the defaultVersion from package.json |
|
|
|
|
defaultVersion=$(jq -r '.defaultVersion' package.json) |
|
|
|
|
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 |
|
|
|
|
|
|
|
|
|
# Use jq to extract the path for the specified version from the builds array |
|
|
|
|
path=$(jq -r --arg version "$defaultVersion" '.builds[] | select(.path==$version) | .path' list.json) |
|
|
|
|
if [ -z "$path" ]; then |
|
|
|
|
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: $path" |
|
|
|
|
fullPath="https://binaries.soliditylang.org/bin/$path" |
|
|
|
|
echo "Path for the specified version: $defaultVersion" |
|
|
|
|
fullPath="https://binaries.soliditylang.org/bin/$defaultVersion" |
|
|
|
|
echo "Download fullPath: $fullPath" |
|
|
|
|
|
|
|
|
|
# Ensure the target directory exists |
|
|
|
|