Skip to content

Commit 0ac8721

Browse files
authored
Merge branch 'main' into feature/update-mobula-ea-v2
2 parents 0b79145 + 3ddd7ce commit 0ac8721

File tree

216 files changed

+3143
-2806
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

216 files changed

+3143
-2806
lines changed

.changeset/brave-ducks-yawn.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@chainlink/superstate-adapter': minor
3+
---
4+
5+
Modify result data

.changeset/fuzzy-ghosts-itch.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

.changeset/ninety-peaches-camp.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@chainlink/anchorage-adapter': minor
3+
---
4+
5+
Return number instead of string

.changeset/serious-garlics-press.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

.changeset/short-beers-relax.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

.changeset/swift-donuts-worry.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

.changeset/weak-rockets-worry.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

.github/scripts/get-changeset-arguments.sh

Lines changed: 27 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#!/bin/bash -e
22

3+
SOURCE_DIR=$(dirname "$0")
4+
35
# This script takes a list of adapter names to release and outputs the
46
# arguments to pass to `yarn changeset version`.
57
#
@@ -22,57 +24,44 @@ get_packages_from_changeset_files() {
2224
git grep -Eh "^'@chainlink/[^']*-adapter': (major|minor|patch)$" "$@" | sed -E "s#^'(@chainlink/[^']*-adapter)': (major|minor|patch).*\$#\\1#" | sort -u
2325
}
2426

25-
CHANGED_PACKAGES_RECURSIVE="$(get_packages_from_changeset_files)"
27+
CHANGED_PACKAGES_RECURSIVE="$($SOURCE_DIR/get-reverse-dependencies.sh $(get_packages_from_changeset_files) )"
2628

27-
is_changed() {
28-
package="$1"
29-
echo "$CHANGED_PACKAGES_RECURSIVE" | grep -Fxq "$package"
29+
intersect() {
30+
list1="$1"
31+
list2="$2"
32+
grep -Fxf <(echo "$list1") <<< "$list2"
3033
}
3134

32-
add_reverse_package_deps() {
35+
add_changed_reverse_package_deps() {
3336
packages="$1"
3437
{
35-
for package in $packages; do
36-
echo $package
37-
# We need to include reverse dependencies because if a dependency is
38-
# bumped, this also results in a patch bump of the dependent package.
39-
# But if the dependency is not actually changed (either directly or
40-
# transitively), but only included because of a requirement of
41-
# `changeset version`, we don't want to include it. Otherwise almost all
42-
# packages get included through common dependencies such as
43-
# @chainlink/ea-test-helpers.
44-
if ! is_changed $package; then
45-
continue
46-
fi
47-
# git grep is a fast way to find candidate package.json files that probably depend on $package
48-
for reverse_dep_package_file in $(git grep -l '"'"$package"'": "workspace:\*"' 'packages/*/*/package.json'); do
49-
# Check to make sure the candidate package.json file actually depends on $package
50-
if jq -e --arg package "$package" '[ .dependencies | select(. | has($package)) ] | length > 0' "$reverse_dep_package_file" > /dev/null; then
51-
jq -r '.name' "$reverse_dep_package_file"
52-
fi
53-
done
54-
done
38+
# Keep the existing packages.
39+
echo "$packages"
40+
# We need to include reverse dependencies because if a dependency is
41+
# bumped, this also results in a patch bump of the dependent package.
42+
# But if the dependency is not actually changed (either directly or
43+
# transitively), but only included because of a requirement of
44+
# `changeset version`, we don't want to include it. Otherwise almost all
45+
# packages get included through common dependencies such as
46+
# @chainlink/ea-test-helpers.
47+
intersect "$($SOURCE_DIR/get-reverse-dependencies.sh $packages)" "$CHANGED_PACKAGES_RECURSIVE"
5548
} | sort -u
5649
}
5750

58-
# Make sure CHANGED_PACKAGES_RECURSIVE contains transitive reverse dependencies.
59-
new_changed_packages=$(add_reverse_package_deps "$CHANGED_PACKAGES_RECURSIVE")
60-
while [[ "$new_changed_packages" != "$CHANGED_PACKAGES_RECURSIVE" ]]; do
61-
CHANGED_PACKAGES_RECURSIVE="$new_changed_packages"
62-
new_changed_packages="$(add_reverse_package_deps "$CHANGED_PACKAGES_RECURSIVE")"
63-
done
64-
6551
add_package_deps() {
6652
packages="$1"
6753
{
6854
for package in $packages; do
6955
echo $package
7056
package_file="$(git grep -l '"name": "'"$package"'"' packages)"
71-
if [[ -z "$package_file" ]]; then
72-
# This package is from another repo
73-
continue
74-
fi
75-
jq -r '.dependencies | keys[]' "$package_file" | grep '@chainlink/'
57+
for dep in $(jq -r '.dependencies | keys[]' "$package_file" | grep '@chainlink/'); do
58+
dep_file="$(git grep -l '"name": "'"$dep"'"' packages)"
59+
if [[ -z "$dep_file" ]]; then
60+
# This package is from another repo
61+
continue
62+
fi
63+
echo $dep
64+
done
7665
done
7766
} | sort -u
7867
}
@@ -94,7 +83,7 @@ add_deps() {
9483
packages="$1"
9584
packages=$(add_changeset_deps "$packages")
9685
packages=$(add_package_deps "$packages")
97-
packages=$(add_reverse_package_deps "$packages")
86+
packages=$(add_changed_reverse_package_deps "$packages")
9887
echo "$packages"
9988
}
10089

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#!/bin/bash -e
2+
3+
# Returns a transitive list of reverse dependencies within the repository,
4+
# including the input list of packages. Does not include reverse dependencies
5+
# from devDependencies or peerDependencies.
6+
7+
if [[ "$#" = "0" ]]; then
8+
echo "Usage: $0 <list of packages to get reverse dependencies of>" >&2
9+
exit 1
10+
fi
11+
12+
packages="$*"
13+
14+
for package_name in $packages; do
15+
if ! git grep -q '"name": "'"$package_name"'"' packages; then
16+
echo "'$package_name' is not a package in this repository." >&2
17+
exit 1
18+
fi
19+
done
20+
21+
add_reverse_package_deps() {
22+
packages="$1"
23+
{
24+
for package in $packages; do
25+
echo $package
26+
# git grep is a fast way to find candidate package.json files that probably depend on $package
27+
for reverse_dep_package_file in $(git grep -l '"'"$package"'": "' 'packages/*/*/package.json'); do
28+
# Check to make sure the candidate package.json file actually depends on $package
29+
if jq -e --arg package "$package" '[ .dependencies | select(. | has($package)) ] | length > 0' "$reverse_dep_package_file" > /dev/null; then
30+
jq -r '.name' "$reverse_dep_package_file"
31+
fi
32+
done
33+
done
34+
} | sort -u
35+
}
36+
37+
new_packages=$(add_reverse_package_deps "$packages")
38+
while [[ "$new_packages" != "$packages" ]]; do
39+
packages="$new_packages"
40+
new_packages="$(add_reverse_package_deps "$packages")"
41+
done
42+
43+
echo "$packages"

.github/scripts/list-packages-adapters.sh

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,18 @@ SOURCE_DIR="$(dirname "$0")"
44

55
UPSTREAM_BRANCH="${1:-}"
66

7+
PACKAGE_LIST=$(yarn workspaces list -R --json)
8+
79
if [[ -z "$UPSTREAM_BRANCH" ]]; then
810
PACKAGE_LIST=$(yarn workspaces list -R --json)
911
else
10-
PACKAGE_LIST=$(yarn workspaces list -R --json --since=$UPSTREAM_BRANCH)
12+
changed_packages="$(yarn workspaces list --json --since=$UPSTREAM_BRANCH | jq -r 'select(.location | startswith("packages")) | .name')"
13+
packages_to_include="$($SOURCE_DIR/get-reverse-dependencies.sh "$changed_packages")"
14+
# Keep only the packages changed since UPSTREAM_BRANCH
15+
PACKAGE_LIST=$(
16+
echo $PACKAGE_LIST \
17+
| jq -cr --arg packages "$packages_to_include" '($packages | split("\n")) as $packageNames | select(.name as $name | $packageNames | any($name == .))'
18+
)
1119
fi
1220

1321
# The yarn command used above will give us a list of the packages that have changed (including changes by dependencies)

0 commit comments

Comments
 (0)