From 0a27f540d22fe6e90770157ce9a8f4e02d03d75f Mon Sep 17 00:00:00 2001 From: Turadg Aleahmad Date: Fri, 26 Apr 2024 13:13:47 -0700 Subject: [PATCH] fixup! build: update replace-packages for npm build --- scripts/get-packed-versions.sh | 5 +++++ scripts/registry.sh | 4 ++++ scripts/replace-packages.sh | 11 +++++++++-- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/scripts/get-packed-versions.sh b/scripts/get-packed-versions.sh index ecaf970ee8d6..2998e7abc4a1 100755 --- a/scripts/get-packed-versions.sh +++ b/scripts/get-packed-versions.sh @@ -23,6 +23,11 @@ corepack enable yarn install 1>&2 yarn build 1>&2 +# use lerna to ensure these run in topological order, whereas npm query +# sorts in order of the array and lexically for the glob +# https://github.com/npm/cli/issues/4139#issuecomment-1730186418 +yarn lerna run prepack 1>&2 +# Convention used in Endo yarn lerna run build:types 1>&2 npm query .workspace | jq -r '.[].location' | while read -r dir; do diff --git a/scripts/registry.sh b/scripts/registry.sh index 4824ac1c3b48..7b23425a3f6f 100755 --- a/scripts/registry.sh +++ b/scripts/registry.sh @@ -70,6 +70,10 @@ publish() { yarn build git commit --allow-empty -am "chore: prepare for publishing" + # use lerna to ensure these run in topological order, whereas npm query + # sorts in order of the array and lexically for the glob + # https://github.com/npm/cli/issues/4139#issuecomment-1730186418 + yarn lerna run prepack # Convention used in Endo yarn lerna run build:types diff --git a/scripts/replace-packages.sh b/scripts/replace-packages.sh index 8901ebe3a2d4..07766aba96d1 100755 --- a/scripts/replace-packages.sh +++ b/scripts/replace-packages.sh @@ -14,8 +14,14 @@ DSTDIR=${2-$PWD/node_modules} pushd "$SRCDIR" yarn install yarn build -# use yarn to ensure these run in topological order + +# use lerna to ensure these run in topological order, whereas npm query +# sorts in order of the array and lexically for the glob +# https://github.com/npm/cli/issues/4139#issuecomment-1730186418 yarn lerna run prepack +# Convention used in Endo +yarn lerna run build:types + npm query .workspace | jq -r '.[].location' | while read -r dir; do # Skip private packages. test "$(jq .private < "$dir/package.json")" != true || continue @@ -24,7 +30,8 @@ npm query .workspace | jq -r '.[].location' | while read -r dir; do pushd "$dir" name=$(jq -r .name < package.json) rm -f package.tgz - yarn pack + npm pack + mv ./*.tgz package.tgz tar -xvf package.tgz # Replace the destination package.