Skip to content

Commit f8bbe42

Browse files
authored
Merge pull request #55 from peetzweg/pz/generic-postinstall
feat: more generic postinstall
2 parents f50f9d2 + 6b7ea5d commit f8bbe42

File tree

2 files changed

+21
-8
lines changed

2 files changed

+21
-8
lines changed

.changeset/odd-comics-compare.md

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"@inkathon/contracts": patch
3+
"@inkathon/frontend": patch
4+
---
5+
6+
allow postinstall to work with new contracts instead of only packaged greeter

contracts/postinstall.sh

+15-8
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,20 @@ set -eu
55
# This is kind of a hack to prevent a nasty Next.js error when running the frontend
66
# for the first time after deploying to a local node which forces to clear `frontend/.next`.
77

8-
if [[ ! -e deployments/greeter/development.ts ]]; then
9-
echo "Creating empty 'development.ts'…"
10-
if command -v touch &> /dev/null; then
11-
touch deployments/greeter/development.ts
8+
for dir in "./src/"*/; do
9+
contract_name=$(basename "${dir}")
10+
11+
if [[ ! -e "./deployments/${contract_name}/development.ts" ]]; then
12+
echo "Creating empty 'development.ts' file for ${contract_name}"
13+
14+
mkdir -p "./deployments/${contract_name}"
15+
16+
if command -v touch &>/dev/null; then
17+
touch "./deployments/${contract_name}/development.ts"
18+
else
19+
copy /b "deployments/${contract_name}/development.ts" +,,
20+
fi
1221
else
13-
copy /b deployments/greeter/development.ts +,,
22+
echo "Great, 'development.ts' already exists! Skipping…"
1423
fi
15-
else
16-
echo "Great, 'development.ts' already exists! Skipping…"
17-
fi
24+
done

0 commit comments

Comments
 (0)