From 7d5829d902e4666b9ca306f89ac4485857f71a15 Mon Sep 17 00:00:00 2001 From: Scott Motte Date: Fri, 14 Jun 2024 09:06:44 -0700 Subject: [PATCH 1/3] move to npm as registry --- install.sh | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/install.sh b/install.sh index 76d210c..abc4fe5 100755 --- a/install.sh +++ b/install.sh @@ -318,15 +318,25 @@ install_dotenvx() { # 1. setup tmpdir local tmpdir=$(command mktemp -d) - # 2. download and unzip - inside pipe to support stricter installs like github actions + # curl -O https://registry.npmjs.org/@dotenvx/dotenvx-darwin-arm64/-/dotenvx-darwin-arm64-0.1.0.tgz pipe="$tmpdir/pipe" mkfifo "$pipe" - curl $(progress_bar) --fail -L --proto '=https' "$(download_url)" > "$pipe" & + TARBALL_URL="https://registry.npmjs.org/@dotenvx/dotenvx-darwin-arm64/-/dotenvx-darwin-arm64-0.1.0.tgz" + curl $(progress_bar) --fail -L --proto '=https' "$TARBALL_URL" > "$pipe" & sh -c " - tar xz --directory $(directory) < '$pipe' + tar xz --directory $(directory) --strip-components=1 -f '$pipe' 'package/dotenvx' " & wait + # # 2. download and unzip - inside pipe to support stricter installs like github actions + # pipe="$tmpdir/pipe" + # mkfifo "$pipe" + # curl $(progress_bar) --fail -L --proto '=https' "$(download_url)" > "$pipe" & + # sh -c " + # tar xz --directory $(directory) < '$pipe' + # " & + # wait + # 3. clean up rm -r "$tmpdir" From 2294fe1d7b48edff68a82a0f10e0de51b5635bc8 Mon Sep 17 00:00:00 2001 From: Scott Motte Date: Fri, 14 Jun 2024 09:39:25 -0700 Subject: [PATCH 2/3] add note for windows --- install.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/install.sh b/install.sh index abc4fe5..0f15677 100755 --- a/install.sh +++ b/install.sh @@ -318,6 +318,7 @@ install_dotenvx() { # 1. setup tmpdir local tmpdir=$(command mktemp -d) + # todo: handle dotenvx.exe when on a windows machine? binary is not package/dotenvx, it's package/dotenvx.exe # curl -O https://registry.npmjs.org/@dotenvx/dotenvx-darwin-arm64/-/dotenvx-darwin-arm64-0.1.0.tgz pipe="$tmpdir/pipe" mkfifo "$pipe" From 5401eb3858d17441f59600da4a67439c21672d69 Mon Sep 17 00:00:00 2001 From: Scott Motte Date: Fri, 14 Jun 2024 12:10:47 -0700 Subject: [PATCH 3/3] use npm registry for installation --- .gitignore | 1 + install.sh | 19 ++++--------------- spec/install_spec.sh | 2 +- 3 files changed, 6 insertions(+), 16 deletions(-) diff --git a/.gitignore b/.gitignore index bac2dc0..48e8aed 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ node_modules/ .env.keys +spec/tmp/* diff --git a/install.sh b/install.sh index 0f15677..8a81a8e 100755 --- a/install.sh +++ b/install.sh @@ -3,7 +3,7 @@ set -e VERSION="0.44.1" DIRECTORY="/usr/local/bin" -RELEASES_URL="https://github.com/dotenvx/dotenvx/releases" +REGISTRY_URL="https://registry.npmjs.org" INSTALL_SCRIPT_URL="https://dotenvx.sh/install.sh" # ___________________________________________________________________________________________________ @@ -227,7 +227,7 @@ filename() { } download_url() { - echo "$RELEASES_URL/download/v$VERSION/$(filename)" + echo "$REGISTRY_URL/@dotenvx/dotenvx-$(os_arch)/-/dotenvx-$(os_arch)-$VERSION.tgz" return 0 } @@ -318,26 +318,15 @@ install_dotenvx() { # 1. setup tmpdir local tmpdir=$(command mktemp -d) - # todo: handle dotenvx.exe when on a windows machine? binary is not package/dotenvx, it's package/dotenvx.exe - # curl -O https://registry.npmjs.org/@dotenvx/dotenvx-darwin-arm64/-/dotenvx-darwin-arm64-0.1.0.tgz + # TODO: handle dotenvx.exe when on a windows machine? binary is not package/dotenvx, it's package/dotenvx.exe pipe="$tmpdir/pipe" mkfifo "$pipe" - TARBALL_URL="https://registry.npmjs.org/@dotenvx/dotenvx-darwin-arm64/-/dotenvx-darwin-arm64-0.1.0.tgz" - curl $(progress_bar) --fail -L --proto '=https' "$TARBALL_URL" > "$pipe" & + curl $(progress_bar) --fail -L --proto '=https' "$(download_url)" > "$pipe" & sh -c " tar xz --directory $(directory) --strip-components=1 -f '$pipe' 'package/dotenvx' " & wait - # # 2. download and unzip - inside pipe to support stricter installs like github actions - # pipe="$tmpdir/pipe" - # mkfifo "$pipe" - # curl $(progress_bar) --fail -L --proto '=https' "$(download_url)" > "$pipe" & - # sh -c " - # tar xz --directory $(directory) < '$pipe' - # " & - # wait - # 3. clean up rm -r "$tmpdir" diff --git a/spec/install_spec.sh b/spec/install_spec.sh index dca1360..efa9c00 100644 --- a/spec/install_spec.sh +++ b/spec/install_spec.sh @@ -279,7 +279,7 @@ Commands: It 'returns the combined values' When call download_url The status should equal 0 - The output should equal "https://github.com/dotenvx/dotenvx/releases/download/v0.44.1/dotenvx-0.44.1-$(uname -s | tr '[:upper:]' '[:lower:]')-$(uname -m | tr '[:upper:]' '[:lower:]').tar.gz" + The output should equal "https://registry.npmjs.org/@dotenvx/dotenvx-$(uname -s | tr '[:upper:]' '[:lower:]')-$(uname -m | tr '[:upper:]' '[:lower:]')/-/dotenvx-$(uname -s | tr '[:upper:]' '[:lower:]')-$(uname -m | tr '[:upper:]' '[:lower:]')-0.44.1.tgz" End End