-
Notifications
You must be signed in to change notification settings - Fork 212
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: properly handle subdependencies for Endo branch override
- Loading branch information
1 parent
d995eaa
commit 50e4a3b
Showing
3 changed files
with
70 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#! /bin/bash | ||
# Usage: get-packed-versions.sh <WORKDIR> | ||
# | ||
# This script creates package tarballs in the specified workspace directory and | ||
# writes out information for resolve-versions.sh to update a destination | ||
# workspace to use them. This is useful for testing changes to dependencies of | ||
# the destination repository. | ||
set -xueo pipefail | ||
|
||
WORKDIR=${1:-.} | ||
cd -- "$WORKDIR" 1>&2 | ||
|
||
# Install and build the source directory. | ||
yarn install 1>&2 | ||
yarn build 1>&2 | ||
yarn --silent workspaces info | jq -r '.[].location' | while read -r dir; do | ||
# Skip private packages. | ||
echo "dir=$dir" 1>&2 | ||
test "$(jq .private < "$dir/package.json")" != true || continue | ||
|
||
################## | ||
pushd "$dir" 1>&2 | ||
|
||
# Gather the metadata. | ||
name=$(jq -r .name < package.json) | ||
version=$(jq -r .version < package.json) | ||
stem=$(echo "$name" | sed -e 's!^@!!; s!/!-!g;') | ||
file="$(pwd)/${stem}-v${version}.tgz" | ||
|
||
# Create the tarball. | ||
yarn pack 1>&2 | ||
|
||
# Write out the version entry. | ||
jq -s --arg name "$name" --arg file "$file" \ | ||
'{ key: $name, value: ("file:" + $file) }' < /dev/null | ||
|
||
popd 1>&2 | ||
################## | ||
done | jq -s from_entries |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/bin/bash | ||
set -ueo pipefail | ||
|
||
# Accepts a dependency version map on stdin and updates the current | ||
# package.json's resolutions section to use the packages and versions from | ||
# the map. | ||
# This is useful for temporary bulk updates over all packages. | ||
|
||
DIR=$(dirname -- "${BASH_SOURCE[0]}") | ||
|
||
cd -- "$DIR/.." | ||
|
||
override=$(jq 'to_entries | map({ key: ("**/" + .key), value: .value }) | from_entries') | ||
|
||
PACKAGEJSONHASH=$( | ||
jq --arg override "$override" '.resolutions *= ($override | fromjson)' package.json | | ||
git hash-object -w --stdin | ||
) | ||
git cat-file blob "$PACKAGEJSONHASH" > package.json |