Skip to content

Commit 566cd3d

Browse files
authored
Disallow publishing packages with version 0.0.0 (#63)
1 parent 09d6568 commit 566cd3d

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

scripts/publish.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,18 @@ if [[ -z $PUBLISH_NPM_TAG ]]; then
1515
exit 1
1616
fi
1717

18+
CURRENT_PACKAGE_VERSION=$(jq --raw-output .version package.json)
19+
20+
if [[ "$CURRENT_PACKAGE_VERSION" = "0.0.0" ]]; then
21+
echo "Notice: Invalid version: $CURRENT_PACKAGE_VERSION. aborting publish."
22+
exit 0
23+
fi
24+
1825
# check param, if it's set (monorepo) we check if it's published before proceeding
1926
if [[ -n "$1" ]]; then
2027
# check if module is published
2128
PACKAGE_NAME=$(jq --raw-output .name package.json)
2229
LATEST_PACKAGE_VERSION=$(npm view "$PACKAGE_NAME" dist-tags --workspaces false --json | jq --raw-output --arg tag "$PUBLISH_NPM_TAG" '.[$tag]' || echo "")
23-
CURRENT_PACKAGE_VERSION=$(jq --raw-output .version package.json)
2430

2531
if [ "$LATEST_PACKAGE_VERSION" = "$CURRENT_PACKAGE_VERSION" ]; then
2632
echo "Notice: This module is already published at $CURRENT_PACKAGE_VERSION. aborting publish."

0 commit comments

Comments
 (0)