Skip to content

Commit

Permalink
only show packages in the dry run that need publishing
Browse files Browse the repository at this point in the history
  • Loading branch information
rickycodes committed Jun 24, 2024
1 parent 7cf06c2 commit 70d4ceb
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion scripts/publish.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ else
fi
fi

if [[ -z $YARN_NPM_AUTH_TOKEN ]]; then
# "dry-run" for polyrepo
if [[ -z $YARN_NPM_AUTH_TOKEN && ! -n "$1" ]]; then
echo "Notice: 'npm-token' not set. Running '$PACK_CMD'."
$INSTALL_CMD
$PACK_CMD
Expand All @@ -51,6 +52,13 @@ if [[ -n "$1" ]]; then
PACKAGE_NAME=$(jq --raw-output .name package.json)
LATEST_PACKAGE_VERSION=$(npm view "$PACKAGE_NAME" dist-tags --workspaces false --json | jq --raw-output --arg tag "$PUBLISH_NPM_TAG" '.[$tag]' || echo "")

# "dry-run" for monorepo
if [ -z $YARN_NPM_AUTH_TOKEN && ! "$LATEST_PACKAGE_VERSION" = "$CURRENT_PACKAGE_VERSION" ]; then
echo "Notice: 'npm-token' not set. Running '$PACK_CMD'."
$PACK_CMD
exit 0
fi

if [ "$LATEST_PACKAGE_VERSION" = "$CURRENT_PACKAGE_VERSION" ]; then
echo "Notice: This module is already published at $CURRENT_PACKAGE_VERSION. aborting publish."
exit 0
Expand Down

0 comments on commit 70d4ceb

Please sign in to comment.