From b37384992db87a4647986398d02286b1c29bc22d Mon Sep 17 00:00:00 2001 From: Nico Chamo Date: Sat, 16 May 2026 10:20:26 -0300 Subject: [PATCH] fix(aztec): use perl -i for portable in-place edit in add_crate.sh --- yarn-project/aztec/scripts/add_crate.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/yarn-project/aztec/scripts/add_crate.sh b/yarn-project/aztec/scripts/add_crate.sh index cff5f0d654e9..83ea60581b5f 100755 --- a/yarn-project/aztec/scripts/add_crate.sh +++ b/yarn-project/aztec/scripts/add_crate.sh @@ -37,16 +37,17 @@ TEMPLATE_DIR="$(dirname $0)/templates/$template" # Copy template crates and substitute placeholders cp -r "$TEMPLATE_DIR/contract" "$contract_dir" cp -r "$TEMPLATE_DIR/test" "$test_dir" +# Use perl -i for portability across os. find "$contract_dir" "$test_dir" -type f -exec \ - sed -i -e "s/__CRATE_NAME__/${crate_name}/g" -e "s/__AZTEC_VERSION__/${AZTEC_VERSION}/g" {} + + perl -i -pe "s/__CRATE_NAME__/${crate_name}/g; s/__AZTEC_VERSION__/${AZTEC_VERSION}/g" {} + # Add members to workspace Nargo.toml if grep -q 'members\s*=\s*\[\s*\]' Nargo.toml; then # Empty array: members = [] - sed -i "s|members\s*=\s*\[\s*\]|members = [\"${contract_dir}\", \"${test_dir}\"]|" Nargo.toml + perl -i -pe "s|members\s*=\s*\[\s*\]|members = [\"${contract_dir}\", \"${test_dir}\"]|" Nargo.toml else # Non-empty array: add before closing ] - sed -i "s|\(members\s*=\s*\[.*\)\]|\1, \"${contract_dir}\", \"${test_dir}\"]|" Nargo.toml + perl -i -pe "s|(members\s*=\s*\[.*)\]|\1, \"${contract_dir}\", \"${test_dir}\"]|" Nargo.toml fi echo "Created crates '${contract_dir}' and '${test_dir}'"