2024-01-15 17:36:00 +01:00
|
|
|
#!/usr/bin/env bash
|
2023-07-20 19:32:15 +02:00
|
|
|
|
2024-04-25 01:13:19 +02:00
|
|
|
# Make sure pwd is the directory of the script
|
|
|
|
cd "$(dirname "$0")"
|
|
|
|
|
2023-07-20 19:32:15 +02:00
|
|
|
if ! command -v npm &> /dev/null
|
|
|
|
then
|
|
|
|
read -p "npm is not installed. Do you want to install nodejs and npm? (y/n)" choice
|
|
|
|
case "$choice" in
|
|
|
|
y|Y )
|
|
|
|
echo "Installing nvm..."
|
|
|
|
export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
|
|
|
|
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
|
|
|
|
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash
|
|
|
|
source ~/.bashrc
|
|
|
|
nvm install --lts
|
|
|
|
nvm use --lts;;
|
|
|
|
n|N )
|
|
|
|
echo "Nodejs and npm will not be installed."
|
|
|
|
exit;;
|
|
|
|
* )
|
|
|
|
echo "Invalid option. Nodejs and npm will not be installed."
|
|
|
|
exit;;
|
|
|
|
esac
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "Installing Node Modules..."
|
2024-03-06 21:09:31 +01:00
|
|
|
export NODE_ENV=production
|
2024-09-19 17:42:07 +02:00
|
|
|
npm i --no-audit --no-fund --loglevel=error --no-progress --omit=dev
|
2023-07-20 19:32:15 +02:00
|
|
|
|
|
|
|
echo "Entering SillyTavern..."
|
2024-04-26 21:02:46 +02:00
|
|
|
node "server.js" "$@"
|