Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions docs/_installer/init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
# This is just a little script that can be downloaded from the internet to
# install wasm-pack. It just does platform detection, downloads the installer
# and runs it.
if [ -z "$BASH_VERSION" ]; then
curl https://drager.github.io/wasm-pack/installer/init.sh -sSf | bash
exit "$?"
fi

set -u

Expand Down Expand Up @@ -39,6 +43,11 @@ if [ -z "${VERSION:-}" ]; then
fi
fi

err() {
say "$1" >&2
exit 1
}

# Resolve "latest" to actual version number
if [ "$VERSION" = "latest" ]; then
VERSION=$(curl -s https://api.github.com/repos/drager/wasm-pack/releases/latest | grep '"tag_name"' | sed -E 's/.*"v?([^"]+)".*/\1/')
Expand Down Expand Up @@ -187,11 +196,6 @@ say() {
echo "wasm-pack-init: $1"
}

err() {
say "$1" >&2
exit 1
}

need_cmd() {
if ! check_cmd "$1"
then err "need '$1' (command not found)"
Expand Down
Loading