Commit da19bdb7 authored by Jeremy Morrell's avatar Jeremy Morrell Committed by Jeremy Morrell

Switch yarn over to using nodebin

parent 24e2f931
......@@ -10,15 +10,16 @@ needs_resolution() {
install_yarn() {
local dir="$1"
local version="$2"
local number
local url
if needs_resolution "$version"; then
echo "Resolving yarn version ${version:-(latest)} via semver.io..."
local version=$(curl --silent --get --retry 5 --retry-max-time 15 --data-urlencode "range=${version}" https://semver.herokuapp.com/yarn/resolve)
echo "Resolving yarn version ${version:-(latest)}..."
if ! read number url < <(curl --silent --get --retry 5 --retry-max-time 15 --data-urlencode "range=$version" "https://nodebin.herokai.com/v1/yarn/$platform/latest.txt"); then
echo "Unable to resolve; does that version exist?" && false
fi
echo "Downloading and installing yarn ($version)..."
local download_url="https://yarnpkg.com/downloads/$version/yarn-v$version.tar.gz"
local code=$(curl "$download_url" -L --silent --fail --retry 5 --retry-max-time 15 -o /tmp/yarn.tar.gz --write-out "%{http_code}")
echo "Downloading and installing yarn ($number)..."
local code=$(curl "$url" -L --silent --fail --retry 5 --retry-max-time 15 -o /tmp/yarn.tar.gz --write-out "%{http_code}")
if [ "$code" != "200" ]; then
echo "Unable to download yarn: $code" && false
fi
......
get_os() {
uname | tr A-Z a-z
}
get_cpu() {
if [[ "$(uname -p)" = "i686" ]]; then
echo "x86"
else
echo "x64"
fi
}
os=$(get_os)
cpu=$(get_cpu)
platform="$os-$cpu"
export JQ="$BP_DIR/vendor/jq-$os"
create_default_env() {
export NPM_CONFIG_PRODUCTION=${NPM_CONFIG_PRODUCTION:-true}
export NPM_CONFIG_LOGLEVEL=${NPM_CONFIG_LOGLEVEL:-error}
......
get_os() {
uname | tr A-Z a-z
}
get_cpu() {
if [[ "$(uname -p)" = "i686" ]]; then
echo "x86"
else
echo "x64"
fi
}
os=$(get_os)
cpu=$(get_cpu)
export JQ="$BP_DIR/vendor/jq-$os"
read_json() {
local file=$1
local key=$2
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment