From f009223e873d4fe6719bf7b3ea2104710c68e610 Mon Sep 17 00:00:00 2001 From: Sergey Tatarintsev Date: Tue, 5 Dec 2023 18:20:32 +0100 Subject: [PATCH] Get rid of sed --- query-engine/query-engine-wasm/build.sh | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/query-engine/query-engine-wasm/build.sh b/query-engine/query-engine-wasm/build.sh index 3a23babc5e30..03a7c2725814 100755 --- a/query-engine/query-engine-wasm/build.sh +++ b/query-engine/query-engine-wasm/build.sh @@ -3,21 +3,16 @@ set -e # Call this script as `./build.sh ` +set -euo pipefail -OUT_VERSION="$1" +OUT_VERSION="${1:-}" OUT_FOLDER="pkg" OUT_JSON="${OUT_FOLDER}/package.json" OUT_TARGET="bundler" OUT_NPM_NAME="@prisma/query-engine-wasm" -# The local ./Cargo.toml file uses "name = "query_engine_wasm" as library name -# to avoid conflicts with libquery's `name = "query_engine"` library name declaration. -# This little `sed -i` trick below is a hack to publish "@prisma/query-engine-wasm" -# with the same binding filenames currently expected by the Prisma Client. -sed -i.bak 's/name = "query_engine_wasm"/name = "query_engine"/g' Cargo.toml - # use `wasm-pack build --release` on CI only -if [[ -z "$BUILDKITE" ]] && [[ -z "$GITHUB_ACTIONS" ]]; then +if [[ -z "${BUILDKITE:-}" ]] && [[ -z "${GITHUB_ACTIONS:-}" ]]; then BUILD_PROFILE="--dev" else BUILD_PROFILE="--release" @@ -31,14 +26,7 @@ then curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh fi -wasm-pack build $BUILD_PROFILE --target $OUT_TARGET - -sed -i.bak 's/name = "query_engine"/name = "query_engine_wasm"/g' Cargo.toml - -# Remove the backup file created by sed. We only created it because there's no -# cross-platform way to specify we don't need one (it's just `-i` in GNU sed -# but `-i ""` in BSD sed). -rm Cargo.toml.bak +wasm-pack build $BUILD_PROFILE --target $OUT_TARGET --out-name query_engine sleep 1