Skip to content

Commit

Permalink
fix(script): update optimize script to resolve deployment error (#152)
Browse files Browse the repository at this point in the history
  • Loading branch information
ahramy authored Jan 17, 2025
1 parent 4d8e920 commit 01f1e6f
Showing 1 changed file with 17 additions and 8 deletions.
25 changes: 17 additions & 8 deletions optimize.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,25 @@ fi

# Optimize WASM files
for wasm_file in "$release_folder"/*.wasm; do
if [[ "$wasm_file" != *"optimized"* ]]; then
stellar contract optimize --wasm "$wasm_file"
fi
case "$wasm_file" in
*optimized*)
# Skip already optimized files
continue
;;
*)
stellar contract optimize --wasm "$wasm_file"
;;
esac
done

# Check and rename if the file starts with prefix and contains "optimized" in the middle
# Rename files that start with the prefix and contain "optimized"
for wasm_file in "$release_folder"/*.wasm; do
base_name=$(basename "$wasm_file")
if [[ "$base_name" == ${prefix}* && "$base_name" == *optimized* ]]; then
new_base_name="${base_name#${prefix}}"
mv "$wasm_file" "$release_folder/$new_base_name"
fi
case "$base_name" in
"${prefix}"*optimized*)
# Remove the prefix from the filename
new_base_name="${base_name#"${prefix}"}"
mv "$wasm_file" "$release_folder/$new_base_name"
;;
esac
done

0 comments on commit 01f1e6f

Please sign in to comment.