Skip to content

Commit 112efc4

Browse files
committed
Clean up wasm file after running the test
1 parent 1393ab0 commit 112efc4

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

scripts/test-templates.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,19 @@ TEMPLATES_DIR="${TEMPLATES_DIR:-../cre-templates}"
111111
# 1. Build
112112

113113
info "Building SDK..."
114+
115+
# Back up the compiled wasm artifact before the build overwrites it.
116+
# Using a file backup (not git restore) so we restore whatever state the
117+
# developer had — including uncommitted changes — not just the last commit.
118+
# IMPORTANT: the backup must live outside the dist/ directory because the
119+
# build's clean step runs `rm -rf dist`, which would delete an in-place backup.
120+
WASM_FILE="$MONOREPO_ROOT/packages/cre-sdk-javy-plugin/dist/javy-chainlink-sdk.plugin.wasm"
121+
if [ -f "$WASM_FILE" ]; then
122+
WASM_BACKUP=$(mktemp)
123+
cp "$WASM_FILE" "$WASM_BACKUP"
124+
LOCKFILE_BACKUPS+=("$WASM_BACKUP:$WASM_FILE")
125+
fi
126+
114127
_build_out=""
115128
if ! run_captured _build_out bun run build; then
116129
info "❌ SDK build failed."

0 commit comments

Comments
 (0)