鸿蒙
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

55 lignes
1.4KB

  1. #!/bin/bash
  2. # ----------------------------------------------------------------------------
  3. # Hvigor startup script, version 1.0.0
  4. #
  5. # Required ENV vars:
  6. # ------------------
  7. # NODE_HOME - location of a Node home dir
  8. # or
  9. # Add /usr/local/nodejs/bin to the PATH environment variable
  10. # ----------------------------------------------------------------------------
  11. HVIGOR_APP_HOME="`pwd -P`"
  12. HVIGOR_WRAPPER_SCRIPT=${HVIGOR_APP_HOME}/hvigor/hvigor-wrapper.js
  13. #NODE_OPTS="--max-old-space-size=4096"
  14. fail() {
  15. echo "$*"
  16. exit 1
  17. }
  18. set_executable_node() {
  19. EXECUTABLE_NODE="${NODE_HOME}/bin/node"
  20. if [ -x "$EXECUTABLE_NODE" ]; then
  21. return
  22. fi
  23. EXECUTABLE_NODE="${NODE_HOME}/node"
  24. if [ -x "$EXECUTABLE_NODE" ]; then
  25. return
  26. fi
  27. fail "ERROR: NODE_HOME is set to an invalid directory,check $NODE_HOME\n\nPlease set NODE_HOME in your environment to the location where your nodejs installed"
  28. }
  29. # Determine node to start hvigor wrapper script
  30. if [ -n "${NODE_HOME}" ]; then
  31. set_executable_node
  32. else
  33. EXECUTABLE_NODE="node"
  34. command -v ${EXECUTABLE_NODE} &> /dev/null || fail "ERROR: NODE_HOME not set and 'node' command not found"
  35. fi
  36. # Check hvigor wrapper script
  37. if [ ! -r "$HVIGOR_WRAPPER_SCRIPT" ]; then
  38. fail "ERROR: Couldn't find hvigor/hvigor-wrapper.js in ${HVIGOR_APP_HOME}"
  39. fi
  40. if [ -z "${NODE_OPTS}" ]; then
  41. NODE_OPTS="--"
  42. fi
  43. # start hvigor-wrapper script
  44. exec "${EXECUTABLE_NODE}" "${NODE_OPTS}" \
  45. "${HVIGOR_WRAPPER_SCRIPT}" "$@"