activate_node 480 B

12345678910111213141516
  1. # Activation script for virtual nodejs environment
  2. # Usage:
  3. # source activate_node
  4. vdir="./.venv"
  5. expected="10.15.3"
  6. if [ \! -f "./activate_node" ]
  7. then
  8. echo "Not in project directory"
  9. exit 1
  10. fi
  11. test -x "${vdir}/bin/nodeenv" || ( python3 -m venv "${vdir}" && "${vdir}/bin/pip" install --upgrade nodeenv )
  12. test "$(${vdir}/node/bin/nodejs --version)" = "v${expected}" || "${vdir}/bin/nodeenv" --node=${expected} --force "${vdir}/node"
  13. source "${vdir}/node/bin/activate"