codekingpro/portable-devtools
115k
1#!/bin/sh2argv0=$(echo "$0" | sed -e 's,\\,/,g')3basedir=$(dirname "$(readlink "$0" || echo "$argv0")")4 5case "$(uname -s)" in6 Darwin) basedir="$( cd "$( dirname "$argv0" )" && pwd )";;7 Linux) basedir=$(dirname "$(readlink -f "$0" || echo "$argv0")");;8 *CYGWIN*) basedir=`cygpath -w "$basedir"`;;9 *MSYS*) basedir=`cygpath -w "$basedir"`;;10esac11 12command_exists() {13 command -v "$1" >/dev/null 2>&1;14}15 16if command_exists node; then17 if [ "$YARN_FORCE_WINPTY" = 1 ] || command_exists winpty && test -t 1; then18 winpty node "$basedir/yarn.js" "$@"19 else20 exec node "$basedir/yarn.js" "$@"21 fi22 ret=$?23# Debian and Ubuntu use "nodejs" as the name of the binary, not "node", so we24# search for that too. See:25# https://lists.debian.org/debian-devel-announce/2012/07/msg00002.html26# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=61490727elif command_exists nodejs; then28 exec nodejs "$basedir/yarn.js" "$@"29 ret=$?30else31 >&2 echo 'Yarn requires Node.js 4.0 or higher to be installed.'32 ret=133fi34 35exit $ret36 