Skip to content
Merged
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
21 changes: 14 additions & 7 deletions scripts/check-api-compatibility.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,22 @@ if ! ${SKIP_DOWNLOAD:-false}; then
existing_names=$(echo "$jsii_package_dirs" | xargs -n1 -P4 -I {} bash -c 'dirs_to_existing_names "$@"' _ {})
echo " Done." >&2

current_version=$(node -p 'require("./lerna.json").version')
echo "Current version in lerna.json is $current_version"
if ! ${DOWNLOAD_LATEST:-false} && package_exists_on_npm aws-cdk $current_version; then
echo "Using package version ${current_version} as baseline"
existing_names=$(echo "$existing_names" | sed -e "s/$/@$current_version/")
else
echo "However, using the latest version from NPM as the baseline"
version=$(node -p 'require("./scripts/resolve-version.js").version')
echo "Current version is $version."

if ! package_exists_on_npm aws-cdk $version; then
# occurs within a release PR where the version is bumped but is not yet published to npm.
if [ -z ${NPM_DISTTAG:-} ]; then
echo "env variable NPM_DISTTAG is not set. Failing."
exit 1
fi
echo "Current version not published. Setting version to NPM_DISTTAG (${NPM_DISTTAG})."
version=$NPM_DISTTAG
fi

echo "Using version '$version' as the baseline..."
existing_names=$(echo "$existing_names" | sed -e "s/$/@$version/")

rm -rf $tmpdir
mkdir -p $tmpdir

Expand Down