diff --git a/.changeset/wild-geese-learn.md b/.changeset/wild-geese-learn.md new file mode 100644 index 0000000..a328e2e --- /dev/null +++ b/.changeset/wild-geese-learn.md @@ -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. diff --git a/contracts/build-all.sh b/contracts/build-all.sh index f825db1..8c6f0ae 100755 --- a/contracts/build-all.sh +++ b/contracts/build-all.sh @@ -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 @@ -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 \ No newline at end of file diff --git a/frontend/package.json b/frontend/package.json index 9d62f44..f3960e3 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -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",