Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(script): update optimize script to resolve deployment error #152

Merged
merged 2 commits into from
Jan 17, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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*)
ahramy marked this conversation as resolved.
Show resolved Hide resolved
# 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*)
ahramy marked this conversation as resolved.
Show resolved Hide resolved
# Remove the prefix from the filename
new_base_name="${base_name#${prefix}}"
mv "$wasm_file" "$release_folder/$new_base_name"
;;
esac
done
Loading