-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStart-PlotPickle.command
More file actions
38 lines (33 loc) · 1.48 KB
/
Copy pathStart-PlotPickle.command
File metadata and controls
38 lines (33 loc) · 1.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/bin/bash
set -euo pipefail
cd "$(dirname "$0")"
PORT="${PLOTPICKLE_PORT:-4173}"
URL="http://127.0.0.1:${PORT}"
RUNTIME_ENV="${TMPDIR:-/tmp}/plotpickle-runtime-$$.sh"
echo ""
echo "============================================================"
echo " PlotPickle Playhouse - macOS Local Server"
echo "============================================================"
echo "PlotPickle runs only on this Mac at 127.0.0.1."
echo "Keep this Terminal window open while writing."
echo "No cloud account is required."
echo ""
command -v node >/dev/null 2>&1 || { echo "Node.js 22.13 or newer is required: https://nodejs.org/"; exit 1; }
node -e 'const [a,b]=process.versions.node.split(".").map(Number);process.exit(a>22||(a===22&&b>=13)?0:1)' || { echo "Node.js 22.13 or newer is required."; exit 1; }
command -v npm >/dev/null 2>&1 || { echo "npm was not found."; exit 1; }
node scripts/portable-runtime.mjs prepare "$RUNTIME_ENV"
# shellcheck disable=SC1090
source "$RUNTIME_ENV"
rm -f "$RUNTIME_ENV"
export npm_config_cache="$PLOTPICKLE_NPM_CACHE"
if [ ! -x node_modules/.bin/vite ]; then
echo "Installing the package-lock-specific reusable runtime..."
npm ci --prefix "$PLOTPICKLE_RUNTIME_DIR" --include=dev --prefer-offline --no-audit --no-fund
node scripts/portable-runtime.mjs mark-ready
else
echo "Matching PlotPickle runtime reused."
fi
( sleep 3; open "$URL" ) >/dev/null 2>&1 &
echo "Starting ${URL}"
echo "Press Control-C when finished."
exec node_modules/.bin/vite --host 127.0.0.1 --port "$PORT"