feat(dev): add portable development launcher (#50)
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>
This commit is contained in:
29
start.sh
Executable file
29
start.sh
Executable file
@ -0,0 +1,29 @@
|
|||||||
|
#!/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
|
||||||
Reference in New Issue
Block a user