@beplus/be 0.7.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 +30 -6
- 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%/}
|
|
@@ -1156,17 +1156,41 @@ function display_remote_versions() {
|
|
|
1156
1156
|
# local index_url="https://beplus.s3.amazonaws.com/cli/releases.json"
|
|
1157
1157
|
local index_url="${BE_RELEASE_INDEX_URL:-https://beplus.s3.amazonaws.com/cli/releases.json}"
|
|
1158
1158
|
|
|
1159
|
-
# Select the release names to consider.
|
|
1160
|
-
#
|
|
1161
|
-
# is still the current release), so 'latest'/'current'/'stable' filter those
|
|
1162
|
-
# out to resolve to the newest official release.
|
|
1159
|
+
# Select the release names to consider. 'latest'/'current'/'stable' mean the newest official
|
|
1160
|
+
# release, so they skip pre-releases and drafts.
|
|
1163
1161
|
local jq_release_filter='.[]'
|
|
1164
1162
|
if [[ -n "${official_only}" ]]; then
|
|
1165
1163
|
jq_release_filter='.[] | select(.prerelease != true and .draft != true)'
|
|
1166
1164
|
fi
|
|
1167
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
|
+
|
|
1168
1192
|
do_get_index "${index_url}" \
|
|
1169
|
-
| jq -r "${jq_release_filter} | .name" \
|
|
1193
|
+
| jq -r "${jq_semver_key} [ ${jq_release_filter} | .name ] | sort_by(semver_key) | reverse | .[]" \
|
|
1170
1194
|
| n_grep -E "${match}" \
|
|
1171
1195
|
| awk "NR<=${match_count}" \
|
|
1172
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": [
|