Detect bad reponse from yarn info (#406)

This commit is contained in:
David Boreham 2023-05-23 03:42:55 +08:00 committed by GitHub
parent 161665ef72
commit 1d8f252a51
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -27,8 +27,8 @@ yarn_info_output=$(yarn info --json $versioned_target_package 2>/dev/null)
# If it doesn't exist there will be no .data.dist.tarball element, # If it doesn't exist there will be no .data.dist.tarball element,
# and jq will output the string "null" # and jq will output the string "null"
package_tarball=$(echo $yarn_info_output | jq -r .data.dist.tarball) package_tarball=$(echo $yarn_info_output | jq -r .data.dist.tarball)
if [[ $package_tarball == "null" ]]; then if [[ "$yarn_info_output" == "" || $package_tarball == "null" ]]; then
echo "FATAL: Target package version ($versioned_target_package) not found" >&2 echo "FATAL: Target package version ($versioned_target_package) not found (or bad npm auth token)" >&2
exit 1 exit 1
fi fi
# Code below parses out the values we need # Code below parses out the values we need