@beplus/be 0.6.0 → 0.8.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.
- package/bin/be +40 -2
- package/package.json +12 -5
package/bin/be
CHANGED
|
@@ -64,7 +64,7 @@ function n_grep() {
|
|
|
64
64
|
# Setup and state
|
|
65
65
|
#
|
|
66
66
|
|
|
67
|
-
VERSION="v0.
|
|
67
|
+
VERSION="v0.8.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,41 @@ 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. 'latest'/'current'/'stable' mean the newest official
|
|
1160
|
+
# release, so they skip pre-releases and drafts.
|
|
1161
|
+
local jq_release_filter='.[]'
|
|
1162
|
+
if [[ -n "${official_only}" ]]; then
|
|
1163
|
+
jq_release_filter='.[] | select(.prerelease != true and .draft != true)'
|
|
1164
|
+
fi
|
|
1165
|
+
|
|
1166
|
+
# ...then order them ourselves, because no index promises to. The GitHub Releases API sorts by
|
|
1167
|
+
# created_at, and every beplus/cli release shares one (the tags all point at that repo's
|
|
1168
|
+
# unchanged default-branch HEAD), so the list ties and comes back in no particular order —
|
|
1169
|
+
# which had `be 2` resolving to a stage build published before the prod one. Callers take the
|
|
1170
|
+
# first match, so the sort is what makes "first" mean "newest".
|
|
1171
|
+
#
|
|
1172
|
+
# SemVer §11 sort key: major, minor, patch, then "has no pre-release" (a release outranks the
|
|
1173
|
+
# pre-releases it was promoted from), then the pre-release identifiers — numeric ones compared
|
|
1174
|
+
# numerically and ranked below alphanumeric ones, a longer run of identifiers winning a shared
|
|
1175
|
+
# prefix. A name that is not a version sorts last rather than aborting the pipeline.
|
|
1176
|
+
#
|
|
1177
|
+
# This is NOT `sort -V`: GNU version sort ranks 2.0.0-dev.40 *above* 2.0.0, the opposite of
|
|
1178
|
+
# SemVer, which is exactly backwards for a promotion pipeline.
|
|
1179
|
+
local jq_semver_key='def semver_key:
|
|
1180
|
+
ltrimstr("v")
|
|
1181
|
+
| if test("^[0-9]+\\.[0-9]+\\.[0-9]+([-+].*)?$")
|
|
1182
|
+
then (capture("^(?<ma>[0-9]+)\\.(?<mi>[0-9]+)\\.(?<pa>[0-9]+)(?:-(?<pre>[^+]+))?(?:\\+.*)?$")
|
|
1183
|
+
| [1, (.ma|tonumber), (.mi|tonumber), (.pa|tonumber),
|
|
1184
|
+
(if .pre == null then 1 else 0 end),
|
|
1185
|
+
(if .pre == null then []
|
|
1186
|
+
else (.pre | split(".")
|
|
1187
|
+
| map(if test("^[0-9]+$") then [0, (.|tonumber), ""] else [1, 0, .] end))
|
|
1188
|
+
end)])
|
|
1189
|
+
else [0, 0, 0, 0, 0, []]
|
|
1190
|
+
end;'
|
|
1191
|
+
|
|
1154
1192
|
do_get_index "${index_url}" \
|
|
1155
|
-
| jq -r
|
|
1193
|
+
| jq -r "${jq_semver_key} [ ${jq_release_filter} | .name ] | sort_by(semver_key) | reverse | .[]" \
|
|
1156
1194
|
| n_grep -E "${match}" \
|
|
1157
1195
|
| awk "NR<=${match_count}" \
|
|
1158
1196
|
| 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.
|
|
4
|
+
"version": "0.8.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",
|
|
@@ -13,15 +13,22 @@
|
|
|
13
13
|
],
|
|
14
14
|
"repository": {
|
|
15
15
|
"type": "git",
|
|
16
|
-
"url": "git://github.com/beplus/be.git"
|
|
16
|
+
"url": "git+https://github.com/beplus/be.git"
|
|
17
|
+
},
|
|
18
|
+
"publishConfig": {
|
|
19
|
+
"registry": "https://registry.npmjs.org/",
|
|
20
|
+
"@beplus:registry": "https://registry.npmjs.org/",
|
|
21
|
+
"access": "public"
|
|
17
22
|
},
|
|
18
23
|
"scripts": {
|
|
19
|
-
"test": "test/bin/run-all-tests"
|
|
24
|
+
"test": "test/bin/run-all-tests",
|
|
25
|
+
"test:host": "PATH=\"$PWD/bin:$PATH\" bats test/tests",
|
|
26
|
+
"lint": "shellcheck -S warning bin/be bin/bump scripts/install.sh scripts/release/*.sh"
|
|
20
27
|
},
|
|
21
28
|
"devDependencies": {
|
|
22
29
|
"bats": "1.8.2",
|
|
23
|
-
"bats-assert": "
|
|
24
|
-
"bats-support": "
|
|
30
|
+
"bats-assert": "2.2.4",
|
|
31
|
+
"bats-support": "0.3.0"
|
|
25
32
|
},
|
|
26
33
|
"preferGlobal": true,
|
|
27
34
|
"os": [
|