Skip to content

Commit

Permalink
Merge pull request #55 from peetzweg/pz/generic-postinstall
Browse files Browse the repository at this point in the history
feat: more generic postinstall
  • Loading branch information
wottpal authored Feb 5, 2024
2 parents f50f9d2 + 6b7ea5d commit f8bbe42
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 8 deletions.
6 changes: 6 additions & 0 deletions .changeset/odd-comics-compare.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@inkathon/contracts": patch
"@inkathon/frontend": patch
---

allow postinstall to work with new contracts instead of only packaged greeter
23 changes: 15 additions & 8 deletions contracts/postinstall.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit f8bbe42

Please sign in to comment.