functional/activate_node

17 lines
480 B
Text
Raw Normal View History

2019-09-16 18:20:42 +00:00
# Activation script for virtual nodejs environment
# Usage:
# source activate_node
vdir="./.venv"
expected="10.16.3"
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"