2019-10-02 20:12:55 +00:00
|
|
|
# Activation script for virtual nodejs environment
|
|
|
|
# Usage:
|
|
|
|
# source activate_node
|
|
|
|
|
|
|
|
vdir="./.venv"
|
2019-11-07 21:33:23 +00:00
|
|
|
expected="12.13.0"
|
2019-10-02 20:12:55 +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 )
|
|
|
|
test "$(${vdir}/node/bin/nodejs --version)" = "v${expected}" || "${vdir}/bin/nodeenv" --node=${expected} --force "${vdir}/node"
|
|
|
|
source "${vdir}/node/bin/activate"
|