From d4ec8b0629d61403453a30d385766967263cd83c Mon Sep 17 00:00:00 2001 From: Turadg Aleahmad Date: Fri, 26 Apr 2024 11:45:50 -0700 Subject: [PATCH] build: update replace-packages for npm build --- scripts/replace-packages.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/scripts/replace-packages.sh b/scripts/replace-packages.sh index dc934a93cec5..8901ebe3a2d4 100755 --- a/scripts/replace-packages.sh +++ b/scripts/replace-packages.sh @@ -14,6 +14,8 @@ DSTDIR=${2-$PWD/node_modules} pushd "$SRCDIR" yarn install yarn build +# use yarn to ensure these run in topological order +yarn lerna run prepack npm query .workspace | jq -r '.[].location' | while read -r dir; do # Skip private packages. test "$(jq .private < "$dir/package.json")" != true || continue @@ -21,10 +23,9 @@ npm query .workspace | jq -r '.[].location' | while read -r dir; do # Create the tarball. pushd "$dir" name=$(jq -r .name < package.json) - stem=$(echo "$name" | sed -e 's!^@!!; s!/!-!g;') - rm -f "${stem}"-*.tgz + rm -f package.tgz yarn pack - tar -xvf "${stem}"-*.tgz + tar -xvf package.tgz # Replace the destination package. rm -rf "${DSTDIR:?}/$name"