From 3d34e7e62e0837eeeeddd3e4536b36b76a954105 Mon Sep 17 00:00:00 2001 From: peetzweg/ Date: Fri, 2 Feb 2024 10:57:27 +0100 Subject: [PATCH 1/2] makes postinstall work with folder names of contracts as it's hardcoded for `greeter` --- contracts/postinstall.sh | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/contracts/postinstall.sh b/contracts/postinstall.sh index 753d719..e6c30c4 100755 --- a/contracts/postinstall.sh +++ b/contracts/postinstall.sh @@ -5,13 +5,20 @@ set -eu # This is kind of a hack to prevent a nasty Next.js error when running the frontend # for the first time after deploying to a local node which forces to clear `frontend/.next`. -if [[ ! -e deployments/greeter/development.ts ]]; then - echo "Creating empty 'development.ts'…" - if command -v touch &> /dev/null; then - touch deployments/greeter/development.ts +for dir in "./src/"*/; do + contract_name=$(basename "${dir}") + + if [[ ! -e "./deployments/${contract_name}/development.ts" ]]; then + echo "Creating empty 'development.ts' file for ${contract_name}" + + mkdir -p "./deployments/${contract_name}" + + if command -v touch &>/dev/null; then + touch "./deployments/${contract_name}/development.ts" + else + copy /b "deployments/${contract_name}/development.ts" +,, + fi else - copy /b deployments/greeter/development.ts +,, + echo "Great, 'development.ts' already exists! Skipping…" fi -else - echo "Great, 'development.ts' already exists! Skipping…" -fi +done From 6b7ea5de1e425242fd4811dbc85898f64ceb069f Mon Sep 17 00:00:00 2001 From: peetzweg/ Date: Fri, 2 Feb 2024 11:22:44 +0100 Subject: [PATCH 2/2] adds changeset --- .changeset/odd-comics-compare.md | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .changeset/odd-comics-compare.md diff --git a/.changeset/odd-comics-compare.md b/.changeset/odd-comics-compare.md new file mode 100644 index 0000000..be94997 --- /dev/null +++ b/.changeset/odd-comics-compare.md @@ -0,0 +1,6 @@ +--- +"@inkathon/contracts": patch +"@inkathon/frontend": patch +--- + +allow postinstall to work with new contracts instead of only packaged greeter