Dev workflow: network-bound vite dev + documented hot-reload loop
- 'npm run dev' now binds the network (vite dev --host) so the HMR dev server is reachable from another machine. - README documents the two-terminal loop (serve --reload + npm run dev via the /api proxy), so iterating no longer needs build + restart + hard-refresh. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -113,6 +113,22 @@ Endpoints:
|
|||||||
The ingestion CLI stays pure-stdlib; only the `web` extra pulls in FastAPI/uvicorn,
|
The ingestion CLI stays pure-stdlib; only the `web` extra pulls in FastAPI/uvicorn,
|
||||||
so the two halves can be deployed and upgraded independently.
|
so the two halves can be deployed and upgraded independently.
|
||||||
|
|
||||||
|
### Development (hot-reload, no rebuild dance)
|
||||||
|
|
||||||
|
Two terminals, and you stop having to `npm run build` + restart + hard-refresh:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 1. API with auto-reload on backend code changes
|
||||||
|
python3 -m goodnews serve --host 0.0.0.0 --port 8000 --reload
|
||||||
|
|
||||||
|
# 2. Vite dev server with hot module reload (proxies /api -> :8000)
|
||||||
|
cd frontend && npm run dev # serves on http://<host>:5173
|
||||||
|
```
|
||||||
|
|
||||||
|
Visit **:5173** while developing — frontend edits hot-reload instantly, and the
|
||||||
|
`--reload` API restarts itself on backend edits. Only build (`npm run build`) +
|
||||||
|
serve on `:8000` when you want to check the production-served form.
|
||||||
|
|
||||||
### Frontend
|
### Frontend
|
||||||
|
|
||||||
The site is a SvelteKit static SPA in `frontend/` (calm editorial design, mood-mode
|
The site is a SvelteKit static SPA in `frontend/` (calm editorial design, mood-mode
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
"version": "0.1.0",
|
"version": "0.1.0",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite dev",
|
"dev": "vite dev --host",
|
||||||
"build": "vite build",
|
"build": "vite build",
|
||||||
"preview": "vite preview"
|
"preview": "vite preview"
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user