diff --git a/scripts/replace-packages.sh b/scripts/replace-packages.sh index dc934a93cec..8901ebe3a2d 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"