Skip to content

Commit

Permalink
fix: Copy script incompatibility with Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
wottpal committed Oct 25, 2023
1 parent 394bbaa commit 2b9bc68
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
6 changes: 6 additions & 0 deletions .changeset/wild-geese-learn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@inkathon/contracts': patch
'@inkathon/frontend': patch
---

Make cp/copy command work cross-platform (i.e. on Windows) for postinstall and build-all scripts.
9 changes: 6 additions & 3 deletions contracts/build-all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
CONTRACTS_DIR="${CONTRACTS_DIR:=./src}" # Base contract directory
OUT_DIR="${OUT_DIR:=./deployments}" # Output directory for build files

# Copy command helper (cross-platform)
CP_CMD=$(command -v cp &> /dev/null && echo "cp" || echo "copy")

# Store all folder names under `CONTRACTS_DIR` in an array
contracts=()
for d in $CONTRACTS_DIR/* ; do
Expand All @@ -20,7 +23,7 @@ do

echo "Copying build files to '$OUT_DIR/$i/'…"
mkdir -p $OUT_DIR/$i
cp ./target/ink/$i/$i.contract $OUT_DIR/$i/
cp ./target/ink/$i/$i.wasm $OUT_DIR/$i/
cp ./target/ink/$i/$i.json $OUT_DIR/$i/
$CP_CMD ./target/ink/$i/$i.contract $OUT_DIR/$i/
$CP_CMD ./target/ink/$i/$i.wasm $OUT_DIR/$i/
$CP_CMD ./target/ink/$i/$i.json $OUT_DIR/$i/
done
2 changes: 1 addition & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
}
},
"scripts": {
"postinstall": "cp -n .env.local.example .env.local; true",
"postinstall": "[[ ! -e .env.local ]] && CP_CMD=$(command -v cp &> /dev/null && echo \"cp\" || echo \"copy\") && $CP_CMD .env.local.example .env.local; true",
"dev": "NODE_ENV=development next dev",
"node": "pnpm run --filter contracts node",
"dev-and-node": "concurrently \"pnpm dev\" \"pnpm node\" --names \"Next,Node\" --kill-others",
Expand Down

1 comment on commit 2b9bc68

@vercel
Copy link

@vercel vercel bot commented on 2b9bc68 Oct 25, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.