claim/start.bat
Syazwan ef25759eda Fix attachment auto-print, persist cell format, migrate to Bun, 1-click launch
Print bug: remove hidden-iframe auto-print in printAttachment that fired the
OS print dialog on iframe.onload; open attachment in a new tab instead so
print only happens on an explicit Ctrl+P. Drop now-dead printIframeRef/cleanupPrintFrame.

Cell format persistence: new CellFormatToolbar + cellFormat.js save the last
saved per-claim-type header/item format to localStorage; new claims and added
rows inherit it so users don't re-size/re-bold each time. Backend
cell_format_service renders _cellFormat in Excel/PDF.

Bun migration: replace Node/yarn with Bun for the frontend build.
Dockerfile uses oven/bun:1-alpine; bun.lock replaces yarn.lock/package-lock.json;
start.bat files use bun. Frontend dev uses relative baseURL + craco proxy on
port 5000 (avoids CORS and the Grafana conflict on 3000).

1-click launch: root start.bat boots backend (uvicorn :8002) and frontend
(craco :5000) in child windows and opens the browser.

Repo cleanup: remove Node/yarn lockfiles, cursor sync scripts, stray test
reports/PDFs, root package.json/requirements.txt duplicates.

Backend services: claim_document_storage, payslip_storage,
pdf_company_extractor; attachment filenames normalized from PDF text.

Security: gitignore now excludes docker/local env files (with .env.example
allowed) so the live JWT secret cannot be committed.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-07-07 17:55:11 +08:00

35 lines
1.3 KiB
Batchfile

@echo off
setlocal
cd /d "%~dp0"
echo === Claim App - 1-click start (backend + frontend) ===
REM Bun is the frontend build/runtime. Ensure it's on PATH for child windows.
where bun >nul 2>&1
if errorlevel 1 set PATH=%PATH%;%USERPROFILE%\.bun\bin
REM Backend needs MongoDB. Warn if nothing is listening locally; cloud Atlas URLs are fine.
netstat -ano | findstr ":27017.*LISTENING" >nul 2>&1
if errorlevel 1 (
echo [WARN] Nothing listening on local port 27017.
echo If backend/.env MONGO_URL points to localhost, start MongoDB first.
echo (mongodb+srv Atlas URLs are not affected.)
)
REM Launch backend in its own window (uvicorn on 8002)
echo Starting backend -^> http://127.0.0.1:8002/api/health
start "Claim API" /D "%~dp0backend" cmd /k start-local.bat
REM Launch frontend in its own window (craco dev server on 5000, proxies /api -> 8002)
echo Starting frontend -^> http://localhost:5000
start "Claim Web" /D "%~dp0frontend" cmd /k start.bat
REM Give the dev server a moment to come up, then open the browser.
timeout /t 8 /nobreak >nul
start "" http://localhost:5000
echo.
echo Backend: http://127.0.0.1:8002/api/health
echo Frontend: http://localhost:5000 (API proxied to 127.0.0.1:8002)
echo Close the "Claim API" and "Claim Web" windows to stop the app.
endlocal