Validate the local runtime and dependencies before starting the development server from the repository root. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
30 lines
899 B
Bash
Executable File
30 lines
899 B
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
repo_dir="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd -P)"
|
|
cd -- "$repo_dir"
|
|
|
|
if ! command -v node >/dev/null 2>&1; then
|
|
printf '%s\n' 'Error: Node.js >=18 is required. Install Node.js and try again.' >&2
|
|
exit 1
|
|
fi
|
|
|
|
if ! node -e 'process.exit(Number(process.versions.node.split(".")[0]) >= 18 ? 0 : 1)'; then
|
|
printf '%s\n' 'Error: Node.js >=18 is required. Upgrade Node.js and try again.' >&2
|
|
exit 1
|
|
fi
|
|
|
|
if ! command -v npm >/dev/null 2>&1; then
|
|
printf '%s\n' 'Error: npm is required. Install npm and try again.' >&2
|
|
exit 1
|
|
fi
|
|
|
|
if [[ ! -d node_modules ]] || ! npm ls --depth=0 --omit=optional >/dev/null 2>&1; then
|
|
printf '%s\n' 'Error: Dependencies are missing or invalid. Run:' >&2
|
|
printf ' cd %q && npm ci\n' "$repo_dir" >&2
|
|
exit 1
|
|
fi
|
|
|
|
printf '%s\n' 'Starting Nodecast TV: http://localhost:3000'
|
|
exec npm run dev
|