FreeDATA/tools/create_node_env.sh

34 lines
652 B
Bash
Raw Normal View History

#!/usr/bin/env bash
2022-06-24 20:11:21 +00:00
if [ ! -d "gui" ]; then
echo "Error: Run this script from the main FreeDATA directory."
exit 1
fi
2024-04-17 20:49:39 +00:00
# Move into freedata-gui directory
cd freedata-gui
2022-06-24 20:11:21 +00:00
# Common variables
OLDPATH=${PATH}
PATH=/usr/bin:/bin:/usr/local/bin
NPM=$(which npm)
2022-06-24 20:11:21 +00:00
PATH=${OLDPATH}
VENVDIR="$(pwd)/node_modules"
PATH_ADDITIONS="$(pwd)/node_modules/bin:$(pwd)/node_modules/.bin"
2022-06-24 20:11:21 +00:00
# Verify NPM exists.
if [ -z "${NPM}" ] || [ ! -x "${NPM}" ]; then
2022-06-24 20:11:21 +00:00
echo "Error: ${NPM} isn't executable or doesn't exist."
exit 1
fi
${NPM} install n
${NPM} i
PATH=${PATH_ADDITIONS}:${PATH}
n stable
echo ""
echo "Be sure to add '$PATH_ADDITIONS' to your path."