Skip to content

Commit

Permalink
Merge pull request #6 from dotenvx/npm-registry
Browse files Browse the repository at this point in the history
move to npm as registry
  • Loading branch information
motdotla committed Jun 14, 2024
2 parents 93292f8 + 5401eb3 commit 6c65a79
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
node_modules/
.env.keys
spec/tmp/*
8 changes: 4 additions & 4 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"

# ___________________________________________________________________________________________________
Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -318,12 +318,12 @@ install_dotenvx() {
# 1. setup tmpdir
local tmpdir=$(command mktemp -d)

# 2. download and unzip - inside pipe to support stricter installs like github actions
# TODO: handle dotenvx.exe when on a windows machine? binary is not package/dotenvx, it's package/dotenvx.exe
pipe="$tmpdir/pipe"
mkfifo "$pipe"
curl $(progress_bar) --fail -L --proto '=https' "$(download_url)" > "$pipe" &
sh -c "
tar xz --directory $(directory) < '$pipe'
tar xz --directory $(directory) --strip-components=1 -f '$pipe' 'package/dotenvx'
" &
wait

Expand Down
2 changes: 1 addition & 1 deletion spec/install_spec.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 6c65a79

Please sign in to comment.