serializer/activate_node

17 lines
480 B
Text
Raw Normal View History

2018-12-30 22:22:16 +00:00
# Activation script for virtual nodejs environment
# Usage:
# source activate_node
2018-12-30 17:12:21 +00:00
vdir="./.venv"
expected="10.15.0"
2018-12-30 22:22:16 +00:00
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 )
2018-12-30 17:12:21 +00:00
test "$(${vdir}/node/bin/nodejs --version)" = "v${expected}" || "${vdir}/bin/nodeenv" --node=${expected} --force "${vdir}/node"
2018-12-30 22:22:16 +00:00
source "${vdir}/node/bin/activate"