27 lines
584 B
Bash
Executable file
27 lines
584 B
Bash
Executable file
#!/bin/bash
|
|
|
|
export IP=$( hostname -i )
|
|
|
|
if [[ ! -d "node_modules" ]]; then
|
|
echo "node_modules does not exist."
|
|
if [[ -f "package.json" ]]; then
|
|
npm install
|
|
fi
|
|
fi
|
|
|
|
if [[ -z "$@" ]]; then
|
|
if [[ -f "package.json" ]]; then
|
|
PACKAGE_JSON_START=$( cat package.json | jq -r '.scripts.start // empty' )
|
|
if [[ -z "$PACKAGE_JSON_START" ]]; then
|
|
echo "package.json found, but no start script, starting bash..."
|
|
exec bash
|
|
else
|
|
exec $PACKAGE_JSON_START
|
|
fi
|
|
else
|
|
echo "No package.json found, starting bash..."
|
|
exec bash
|
|
fi
|
|
else
|
|
exec $@
|
|
fi
|