Skip to content

Commit 11342b4

Browse files
committed
[Test] Check for peerDependencies/symfony.importmap homogeneity, cleanup changes when a peerDependency changed because multiple versions
1 parent 86e571c commit 11342b4

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

bin/test_package.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,19 @@ processWorkspace() {
4747
fi
4848

4949
echo -e "Processing workspace $workspace at location $location...\n"
50+
51+
echo "Checking '$package_json_path' for peerDependencies and importmap dependencies to have the same version"
52+
deps=$(jq -r '.peerDependencies | keys[]' "$package_json_path")
53+
for library in $deps; do
54+
version=$(jq -r ".peerDependencies.\"$library\"" "$package_json_path")
55+
importmap_version=$(jq -r ".symfony.importmap.\"$library\"" "$package_json_path")
56+
57+
if [ "$version" != "$importmap_version" ]; then
58+
echo " -> Version mismatch for $library: $version (peerDependencies) vs $importmap_version (importmap)"
59+
echo " -> You need to match the version of the \"peerDependency\" with the version in the \"importmap\""
60+
exit
61+
fi
62+
done
5063

5164
echo "Checking '$package_json_path' for peerDependencies with multiple versions defined"
5265
deps_with_multiple_versions=$(jq -r '.peerDependencies | to_entries[] | select(.value | contains("||")) | .key' "$package_json_path")
@@ -68,6 +81,9 @@ processWorkspace() {
6881
runTestSuite
6982
fi
7083
done
84+
85+
echo " -> Reverting version changes for $library"
86+
yarn workspace "$workspace" add "$library@$versionValue" --peer
7187
done
7288
else
7389
echo -e " -> No peerDependencies found with multiple versions defined\n"

0 commit comments

Comments
 (0)