npx 887 B

1234567891011121314151617181920212223242526272829303132333435
  1. #!/bin/sh
  2. (set -o igncr) 2>/dev/null && set -o igncr; # cygwin encoding fix
  3. basedir=`dirname "$0"`
  4. case `uname` in
  5. *CYGWIN*) basedir=`cygpath -w "$basedir"`;;
  6. esac
  7. NODE_EXE="$basedir/node.exe"
  8. if ! [ -x "$NODE_EXE" ]; then
  9. NODE_EXE=node
  10. fi
  11. NPM_CLI_JS="$basedir/node_modules/npm/bin/npm-cli.js"
  12. NPX_CLI_JS="$basedir/node_modules/npm/bin/npx-cli.js"
  13. case `uname` in
  14. *MINGW*)
  15. NPM_PREFIX=`"$NODE_EXE" "$NPM_CLI_JS" prefix -g`
  16. NPM_PREFIX_NPX_CLI_JS="$NPM_PREFIX/node_modules/npm/bin/npx-cli.js"
  17. if [ -f "$NPM_PREFIX_NPX_CLI_JS" ]; then
  18. NPX_CLI_JS="$NPM_PREFIX_NPX_CLI_JS"
  19. fi
  20. ;;
  21. *CYGWIN*)
  22. NPM_PREFIX=`"$NODE_EXE" "$NPM_CLI_JS" prefix -g`
  23. NPM_PREFIX_NPX_CLI_JS="$NPM_PREFIX/node_modules/npm/bin/npx-cli.js"
  24. if [ -f "$NPM_PREFIX_NPX_CLI_JS" ]; then
  25. NPX_CLI_JS="$NPM_PREFIX_NPX_CLI_JS"
  26. fi
  27. ;;
  28. esac
  29. "$NODE_EXE" "$NPX_CLI_JS" "$@"