storage/activate_node

17 lines
480 B
Text
Raw Normal View History

# Activation script for virtual nodejs environment
# Usage:
# source activate_node
vdir="./.venv"
2019-11-07 21:33:23 +00:00
expected="12.13.0"
if [ \! -f "./activate_node" ]
then
echo "Not in project directory"
exit 1
fi
test -x "${vdir}/bin/nodeenv" || ( python3 -m venv "${vdir}" && "${vdir}/bin/pip" install --upgrade nodeenv )
test "$(${vdir}/node/bin/nodejs --version)" = "v${expected}" || "${vdir}/bin/nodeenv" --node=${expected} --force "${vdir}/node"
source "${vdir}/node/bin/activate"