yarn 1.0 KB

1234567891011121314151617181920212223242526272829303132333435
  1. #!/bin/sh
  2. argv0=$(echo "$0" | sed -e 's,\\,/,g')
  3. basedir=$(dirname "$(readlink "$0" || echo "$argv0")")
  4. case "$(uname -s)" in
  5. Darwin) basedir="$( cd "$( dirname "$argv0" )" && pwd )";;
  6. Linux) basedir=$(dirname "$(readlink -f "$0" || echo "$argv0")");;
  7. *CYGWIN*) basedir=`cygpath -w "$basedir"`;;
  8. *MSYS*) basedir=`cygpath -w "$basedir"`;;
  9. esac
  10. command_exists() {
  11. command -v "$1" >/dev/null 2>&1;
  12. }
  13. if command_exists node; then
  14. if [ "$YARN_FORCE_WINPTY" = 1 ] || command_exists winpty && test -t 1; then
  15. winpty node "$basedir/yarn.js" "$@"
  16. else
  17. exec node "$basedir/yarn.js" "$@"
  18. fi
  19. ret=$?
  20. # Debian and Ubuntu use "nodejs" as the name of the binary, not "node", so we
  21. # search for that too. See:
  22. # https://lists.debian.org/debian-devel-announce/2012/07/msg00002.html
  23. # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=614907
  24. elif command_exists nodejs; then
  25. exec nodejs "$basedir/yarn.js" "$@"
  26. ret=$?
  27. else
  28. >&2 echo 'Yarn requires Node.js 4.0 or higher to be installed.'
  29. ret=1
  30. fi
  31. exit $ret