Files
vibemake-pcb-studio/start.sh
T
2026-11-04 17:12:56 +08:00

20 lines
1.1 KiB
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
cd "$(dirname "$0")"
# A configured runtime is optional; ordinary Node 20+ installations also work.
if ! command -v node >/dev/null || [ "$(node -p 'Number(process.versions.node.split(".")[0])')" -lt 20 ]; then
runtime="$HOME/.cache/codex-runtimes/codex-primary-runtime/dependencies/node/bin"
if [ -x "$runtime/node" ]; then export PATH="$runtime:$PATH"; else echo 'Please install Node.js 20+ (recommended 22 LTS) and npm first.'; exit 1; fi
fi
# Local configuration is read by Node's env parser, never evaluated as shell code.
node_args=()
if [ -f .env.local ]; then
node_args=("--env-file=$PWD/.env.local")
fi
if ! command -v npm >/dev/null; then echo 'npm is required to bootstrap the pinned pnpm version.'; exit 1; fi
if [ ! -d node_modules ]; then npm exec --yes --package=pnpm@10.33.0 -- pnpm install --frozen-lockfile; fi
if [ ! -f designer/dist/index.html ] || [ "${REBUILD:-0}" = 1 ] || find designer/src ai common -type f -newer designer/dist/index.html -print -quit | grep -q .; then
npm exec --yes --package=pnpm@10.33.0 -- pnpm -C designer build
fi
exec node "${node_args[@]}" scripts/serve.mjs