Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix replace-packages script #9296

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions scripts/get-packed-versions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions scripts/registry.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
16 changes: 12 additions & 4 deletions scripts/replace-packages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,25 @@ DSTDIR=${2-$PWD/node_modules}
pushd "$SRCDIR"
yarn install
yarn build

# 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

# Create the tarball.
pushd "$dir"
name=$(jq -r .name < package.json)
stem=$(echo "$name" | sed -e 's!^@!!; s!/!-!g;')
rm -f "${stem}"-*.tgz
yarn pack
tar -xvf "${stem}"-*.tgz
rm -f package.tgz
npm pack
mv ./*.tgz package.tgz
tar -xvf package.tgz

# Replace the destination package.
rm -rf "${DSTDIR:?}/$name"
Expand Down
Loading