Skip to content

Commit 870e534

Browse files
chore(internal): version bump
1 parent f48215c commit 870e534

File tree

1 file changed

+7
-23
lines changed

1 file changed

+7
-23
lines changed

bin/publish-npm

Lines changed: 7 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -4,35 +4,19 @@ set -eux
44

55
npm config set '//registry.npmjs.org/:_authToken' "$NPM_TOKEN"
66

7+
# Build the project
78
yarn build
8-
cd dist
99

10-
# Get latest version from npm
11-
#
12-
# If the package doesn't exist, yarn will return
13-
# {"type":"error","data":"Received invalid response from npm."}
14-
# where .data.version doesn't exist so LAST_VERSION will be an empty string.
15-
LAST_VERSION="$(yarn info --json 2> /dev/null | jq -r '.data.version')"
10+
# Navigate to the dist directory
11+
cd dist
1612

17-
# Get current version from package.json
13+
# Get the version from package.json
1814
VERSION="$(node -p "require('./package.json').version")"
1915

20-
# Check if current version is pre-release (e.g. alpha / beta / rc)
21-
CURRENT_IS_PRERELEASE=false
16+
# Extract the pre-release tag if it exists
2217
if [[ "$VERSION" =~ -([a-zA-Z]+) ]]; then
23-
CURRENT_IS_PRERELEASE=true
24-
CURRENT_TAG="${BASH_REMATCH[1]}"
25-
fi
26-
27-
# Check if last version is a stable release
28-
LAST_IS_STABLE_RELEASE=true
29-
if [[ -z "$LAST_VERSION" || "$LAST_VERSION" =~ -([a-zA-Z]+) ]]; then
30-
LAST_IS_STABLE_RELEASE=false
31-
fi
32-
33-
# Use a corresponding alpha/beta tag if there already is a stable release and we're publishing a prerelease.
34-
if $CURRENT_IS_PRERELEASE && $LAST_IS_STABLE_RELEASE; then
35-
TAG="$CURRENT_TAG"
18+
# Extract the part before any dot in the pre-release identifier
19+
TAG="${BASH_REMATCH[1]}"
3620
else
3721
TAG="latest"
3822
fi

0 commit comments

Comments
 (0)