mirror of
https://github.com/felixrieseberg/windows95.git
synced 2026-05-09 00:24:09 +00:00
Swap the unmaintained parcel-bundler@1.x for Vite's build API, called
from the same generateAssets hook. Output layout is unchanged
(dist/src/main/main.js + dist/static/index.html + dist/renderer.{js,css})
so no runtime path changes — __dirname-based asset lookup, loadFile, and
packagerConfig.ignore all keep working.
Renderer is built in lib/CJS mode with Node builtins + electron
externalized; a one-line banner aliases exports=module.exports since the
Electron <script> context provides module/require but not a bare exports
global. CSS (98.css + root.css) is now imported from app.tsx so Vite
emits a single renderer.css with fonts inlined.
Drops parcel-bundler and rimraf (vite-build clears dist/ itself).
~800ms full build.
77 lines
2.0 KiB
Bash
Executable File
77 lines
2.0 KiB
Bash
Executable File
#!/bin/bash
|
|
# Single boot probe: build → launch → wait for verdict → kill → report.
|
|
# Usage: tools/probe-boot.sh [json-options]
|
|
# tools/probe-boot.sh '{"acpi":false}'
|
|
# tools/probe-boot.sh '{"disable_jit":true}'
|
|
|
|
set -e
|
|
cd "$(dirname "$0")/.."
|
|
|
|
OPTS="${1:-{}}"
|
|
STATUS=/tmp/win95-probe.json
|
|
DONE=/tmp/win95-probe.done
|
|
SCREEN=/tmp/win95-screen.png
|
|
TIMEOUT=200
|
|
|
|
echo "═══ probe: opts=$OPTS ═══"
|
|
|
|
# clean slate
|
|
rm -f "$STATUS" "$DONE" "$SCREEN"
|
|
pkill -f "windows95/node_modules/electron" 2>/dev/null || true
|
|
sleep 1
|
|
|
|
# build (vite only — forge's generateAssets does this too but we want
|
|
# direct control without the forge startup overhead)
|
|
rm -rf dist
|
|
node tools/vite-build.js > /tmp/win95-build.log 2>&1
|
|
if [ $? -ne 0 ]; then
|
|
echo "BUILD FAILED"
|
|
tail -20 /tmp/win95-build.log
|
|
exit 1
|
|
fi
|
|
|
|
# launch electron directly (skip forge to avoid double-build)
|
|
WIN95_PROBE=1 WIN95_PROBE_OPTS="$OPTS" \
|
|
./node_modules/.bin/electron . > /tmp/win95-electron.log 2>&1 &
|
|
PID=$!
|
|
echo "electron pid=$PID, waiting for verdict (timeout ${TIMEOUT}s)..."
|
|
|
|
# poll
|
|
for i in $(seq 1 $TIMEOUT); do
|
|
if [ -f "$DONE" ]; then
|
|
VERDICT=$(cat "$DONE")
|
|
echo "verdict at ${i}s: $VERDICT"
|
|
break
|
|
fi
|
|
if ! kill -0 $PID 2>/dev/null; then
|
|
echo "electron died at ${i}s"
|
|
tail -30 /tmp/win95-electron.log
|
|
VERDICT="CRASHED"
|
|
break
|
|
fi
|
|
sleep 1
|
|
done
|
|
|
|
if [ -z "$VERDICT" ]; then
|
|
echo "TIMEOUT at ${TIMEOUT}s"
|
|
VERDICT="TIMEOUT"
|
|
fi
|
|
|
|
# capture final state
|
|
echo "─── final status ───"
|
|
[ -f "$STATUS" ] && python3 -c "
|
|
import json
|
|
s=json.load(open('$STATUS'))
|
|
print(f\"phase={s['phase']} cpu={s['cpuRunning']} instr_delta={s['instructionDelta']:,}\")
|
|
print(f\"uptime={s['uptimeSec']}s\")
|
|
t=s['textScreen'].strip()
|
|
if t: print('text:'); print(' ' + t.replace(chr(10), chr(10)+' ')[:500])
|
|
" || echo "(no status file)"
|
|
|
|
# kill
|
|
kill $PID 2>/dev/null || true
|
|
wait $PID 2>/dev/null || true
|
|
|
|
echo "═══ $VERDICT ═══"
|
|
[ "$VERDICT" = "SUCCESS" ] && exit 0 || exit 1
|