chore: clean up web ui repo hygiene
This commit is contained in:
parent
94e62c9456
commit
2fcc9db903
4786 changed files with 1271 additions and 1275231 deletions
62
start.sh
62
start.sh
|
|
@ -11,6 +11,68 @@ fi
|
|||
source .venv/bin/activate
|
||||
pip install -r requirements.txt >/dev/null
|
||||
|
||||
FRONTEND_DIR="${SCRIPT_DIR}/frontend"
|
||||
: "${FRONTEND_BUILD_ON_START:=1}"
|
||||
|
||||
resolve_frontend_runner() {
|
||||
if command -v bun >/dev/null 2>&1; then
|
||||
echo "bun"
|
||||
return 0
|
||||
fi
|
||||
if [[ -x "${HOME}/.bun/bin/bun" ]]; then
|
||||
echo "${HOME}/.bun/bin/bun"
|
||||
return 0
|
||||
fi
|
||||
if command -v npm >/dev/null 2>&1; then
|
||||
echo "npm"
|
||||
return 0
|
||||
fi
|
||||
return 1
|
||||
}
|
||||
|
||||
build_frontend_bundle() {
|
||||
if [[ ! -f "${FRONTEND_DIR}/package.json" ]]; then
|
||||
echo "Frontend package.json not found at ${FRONTEND_DIR}" >&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
local runner
|
||||
if ! runner="$(resolve_frontend_runner)"; then
|
||||
echo "Unable to build frontend: install Bun or npm first." >&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [[ ! -d "${FRONTEND_DIR}/node_modules" ]]; then
|
||||
echo "Frontend dependencies are missing at ${FRONTEND_DIR}/node_modules." >&2
|
||||
if [[ "${runner}" == "bun" || "${runner}" == "${HOME}/.bun/bin/bun" ]]; then
|
||||
(
|
||||
cd "${FRONTEND_DIR}"
|
||||
"${runner}" install --frozen-lockfile
|
||||
)
|
||||
else
|
||||
echo "Install frontend dependencies before starting the server." >&2
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "Building frontend bundle from ${FRONTEND_DIR}"
|
||||
if [[ "${runner}" == "npm" ]]; then
|
||||
(
|
||||
cd "${FRONTEND_DIR}"
|
||||
npm run build
|
||||
)
|
||||
else
|
||||
(
|
||||
cd "${FRONTEND_DIR}"
|
||||
"${runner}" run build
|
||||
)
|
||||
fi
|
||||
}
|
||||
|
||||
if [[ "${FRONTEND_BUILD_ON_START}" == "1" ]]; then
|
||||
build_frontend_bundle
|
||||
fi
|
||||
|
||||
# Optional local voice settings. Example file: .env.voice
|
||||
if [[ -f ".env.voice" ]]; then
|
||||
set -a
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue