@beplus/be 0.6.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/bin/be +16 -2
  2. package/package.json +1 -1
package/bin/be CHANGED
@@ -64,7 +64,7 @@ function n_grep() {
64
64
  # Setup and state
65
65
  #
66
66
 
67
- VERSION="v0.6.0"
67
+ VERSION="v0.7.0"
68
68
 
69
69
  BE_PREFIX="${BE_PREFIX-/usr/local}"
70
70
  BE_PREFIX=${BE_PREFIX%/}
@@ -1116,6 +1116,9 @@ function display_remote_versions() {
1116
1116
  local version="$1"
1117
1117
  local match='.'
1118
1118
  local match_count="${BE_MAX_REMOTE_MATCHES}"
1119
+ # Restrict to official releases (skip pre-releases and drafts) for the
1120
+ # 'latest'/'current'/'stable' labels.
1121
+ local official_only=
1119
1122
 
1120
1123
  # Transform some labels before processing further.
1121
1124
  if is_beplus_support_version "${version}"; then
@@ -1131,9 +1134,11 @@ function display_remote_versions() {
1131
1134
  elif [[ "${version}" = "stable" ]]; then
1132
1135
  match_count=1
1133
1136
  match='.'
1137
+ official_only=1
1134
1138
  elif [[ "${version}" = "latest" || "${version}" = "current" ]]; then
1135
1139
  match_count=1
1136
1140
  match='.'
1141
+ official_only=1
1137
1142
  elif is_numeric_version "${version}"; then
1138
1143
  version="v${version#v}"
1139
1144
  # Avoid restriction message if exact version
@@ -1151,8 +1156,17 @@ function display_remote_versions() {
1151
1156
  # local index_url="https://beplus.s3.amazonaws.com/cli/releases.json"
1152
1157
  local index_url="${BE_RELEASE_INDEX_URL:-https://beplus.s3.amazonaws.com/cli/releases.json}"
1153
1158
 
1159
+ # Select the release names to consider. GitHub lists the newest release
1160
+ # first, including any in-progress pre-releases (e.g. a v2 published while v1
1161
+ # is still the current release), so 'latest'/'current'/'stable' filter those
1162
+ # out to resolve to the newest official release.
1163
+ local jq_release_filter='.[]'
1164
+ if [[ -n "${official_only}" ]]; then
1165
+ jq_release_filter='.[] | select(.prerelease != true and .draft != true)'
1166
+ fi
1167
+
1154
1168
  do_get_index "${index_url}" \
1155
- | jq -r '.[] | .name' \
1169
+ | jq -r "${jq_release_filter} | .name" \
1156
1170
  | n_grep -E "${match}" \
1157
1171
  | awk "NR<=${match_count}" \
1158
1172
  | cut -f 1 \
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@beplus/be",
3
3
  "description": "Interactively Manage beplus CLI Versions",
4
- "version": "0.6.0",
4
+ "version": "0.7.0",
5
5
  "author": "Igor Lamos <igor@be.plus>",
6
6
  "homepage": "https://github.com/beplus/be",
7
7
  "bugs": "https://github.com/beplus/be",