Skip to content

Commit

Permalink
fix: sort_versions function (#23)
Browse files Browse the repository at this point in the history
* chore: bump tool versions

* fix: sort_versions algorithm to sort 1,11,111,1111 correctly

* chore: update pnpm lockfile and node deps

* fix: ci pipeline failure on old nodejs instructions
  • Loading branch information
jthegedus authored Jun 16, 2022
1 parent 57c2f05 commit 5176df6
Show file tree
Hide file tree
Showing 9 changed files with 131 additions and 132 deletions.
4 changes: 0 additions & 4 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ jobs:
uses: actions/checkout@v2
- name: asdf_install
uses: asdf-vm/actions/install@v1
with:
before_install: bash -c '${ASDF_DATA_DIR:=$HOME/.asdf}/plugins/nodejs/bin/import-release-team-keyring'
- name: Shellcheck
run: shellcheck -x bin/* -P lib/

Expand All @@ -26,8 +24,6 @@ jobs:
uses: actions/checkout@v2
- name: asdf_install
uses: asdf-vm/actions/install@v1
with:
before_install: bash -c '${ASDF_DATA_DIR:=$HOME/.asdf}/plugins/nodejs/bin/import-release-team-keyring'
- name: Shell Format - List files to check
run: shfmt -f .
- name: Shell Format - Validate
Expand Down
8 changes: 4 additions & 4 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
nodejs 16.2.0
shellcheck 0.7.2
shfmt 3.3.0
pnpm 6.6.2
nodejs 16.15.1
shellcheck 0.8.0
shfmt 3.5.1
pnpm 7.2.1
2 changes: 0 additions & 2 deletions bin/download
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ set -euo pipefail
current_script_path="${BASH_SOURCE[0]}"
plugin_dir="$(dirname "$(dirname "$current_script_path")")"

# shellcheck source=../lib/helpers.bash
source "${plugin_dir}/lib/helpers.bash"
# shellcheck source=../lib/utils.bash
source "${plugin_dir}/lib/utils.bash"

Expand Down
2 changes: 0 additions & 2 deletions bin/install
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ set -euo pipefail
current_script_path="${BASH_SOURCE[0]}"
plugin_dir="$(dirname "$(dirname "$current_script_path")")"

# shellcheck source=../lib/helpers.bash
source "${plugin_dir}/lib/helpers.bash"
# shellcheck source=../lib/utils.bash
source "${plugin_dir}/lib/utils.bash"

Expand Down
2 changes: 0 additions & 2 deletions bin/list-all
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ set -euo pipefail
current_script_path="${BASH_SOURCE[0]}"
plugin_dir="$(dirname "$(dirname "$current_script_path")")"

# shellcheck source=../lib/helpers.bash
source "${plugin_dir}/lib/helpers.bash"
# shellcheck source=../lib/utils.bash
source "${plugin_dir}/lib/utils.bash"

Expand Down
7 changes: 0 additions & 7 deletions lib/helpers.bash

This file was deleted.

8 changes: 6 additions & 2 deletions lib/utils.bash
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,12 @@ function get_os_name() {
echo "${os_name}"
}

function get_github_repo() {
echo "https://github.com/firebase/firebase-tools"
}

function sort_versions() {
sed 'h; s/[+-]/./g; s/.p\([[:digit:]]\)/.z\1/; s/$/.z/; G; s/\n/ /' |
LC_ALL=C sort -t. -k 1,1 -k 2,2n -k 3,3n -k 4,4n -k 5,5n |
sed 'h; s/[-]/./g; s/.p\([[:digit:]]\)/.z.\1/; s/$/.z/; G; s/\n/ /' |
LC_ALL=C sort -t. -k 1,1n -k 2,2n -k 3,3n |
awk '{print $2}'
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"@commitlint/cli": "^12.1.4",
"@commitlint/config-conventional": "^12.1.4",
"husky": "^6.0.0",
"prettier": "^2.3.0"
"prettier": "^2.7.1"
},
"scripts": {
"prepare": "husky install"
Expand Down
Loading

0 comments on commit 5176df6

Please sign in to comment.