feat: task 1.3 vite dev proxy + tsconfig hardening
Same-origin dev proxy via Vite's server.proxy:
- /api/* -> ${VITE_DEV_DIRECTUS_URL}/* (Directus REST + GraphQL)
- /ws-business -> ws://.../websocket (Directus business-plane WS)
- /ws-live -> ${VITE_DEV_PROCESSOR_WS_URL} (Processor live WS, Phase 1.5)
WS proxy targets derive ws:// scheme from the http(s) Directus URL.
loadEnv reads VITE_DEV_* overrides; sensible localhost defaults.
tsconfig.app.json: noUncheckedIndexedAccess + noImplicitOverride.
.env.example documents the two override vars; .env.local is gitignored
via the existing *.local pattern.
README "Local dev" section: proxy table + override instructions + port
collision workaround.
Deviation: spec called for .env.dev.example/.env.dev.local but Vite's
dev mode is "development" not "dev", so mode-specific files would be
.env.development.* and Vite wouldn't auto-load .env.dev.local. Switched
to the standard Vite .env.example/.env.local convention. Documented in
the task's Done section.
Plus: backfill 1.2 commit SHA (9918418) in its Done section.
This commit is contained in:
@@ -24,16 +24,16 @@ Implementation planning lives in `.planning/` — see `.planning/ROADMAP.md`.
|
||||
|
||||
## Common scripts
|
||||
|
||||
| Command | Purpose |
|
||||
| -------------------- | --------------------------------------------- |
|
||||
| `pnpm dev` | Start the Vite dev server on `:5173`. |
|
||||
| `pnpm build` | Type-check + production build into `dist/`. |
|
||||
| `pnpm preview` | Serve the built `dist/` for smoke testing. |
|
||||
| `pnpm typecheck` | Type-check only (no build). |
|
||||
| `pnpm lint` | ESLint over the repo. |
|
||||
| `pnpm format` | Prettier auto-format. |
|
||||
| `pnpm format:check` | Prettier check only (CI gate). |
|
||||
| `pnpm test` | Test runner (Phase 3 wires Vitest). |
|
||||
| Command | Purpose |
|
||||
| ------------------- | ------------------------------------------- |
|
||||
| `pnpm dev` | Start the Vite dev server on `:5173`. |
|
||||
| `pnpm build` | Type-check + production build into `dist/`. |
|
||||
| `pnpm preview` | Serve the built `dist/` for smoke testing. |
|
||||
| `pnpm typecheck` | Type-check only (no build). |
|
||||
| `pnpm lint` | ESLint over the repo. |
|
||||
| `pnpm format` | Prettier auto-format. |
|
||||
| `pnpm format:check` | Prettier check only (CI gate). |
|
||||
| `pnpm test` | Test runner (Phase 3 wires Vitest). |
|
||||
|
||||
## Adding a shadcn primitive
|
||||
|
||||
@@ -45,7 +45,17 @@ Components land in `src/ui/primitives/` per `components.json`'s alias config. Ed
|
||||
|
||||
## Local dev
|
||||
|
||||
The Vite dev proxy (Phase 1.3) routes `/api`, `/ws-business`, `/ws-live` to the appropriate local services so the SPA dev experience matches the stage/prod reverse-proxy topology under one origin. Until 1.3 lands, the SPA runs standalone.
|
||||
The Vite dev server (`pnpm dev` on `:5173`) proxies three path namespaces to local services so everything runs same-origin — the same topology stage/prod gets via Traefik, no CORS workarounds needed.
|
||||
|
||||
| Path | Forwards to | Notes |
|
||||
| -------------- | ------------------------------------ | ----------------------------------------------------------------------------- |
|
||||
| `/api/*` | `${VITE_DEV_DIRECTUS_URL}/*` | Directus REST + GraphQL. Default `http://localhost:8055`. |
|
||||
| `/ws-business` | `${VITE_DEV_DIRECTUS_URL}/websocket` | Directus business-plane WebSocket (auto-derived ws:// scheme). |
|
||||
| `/ws-live` | `${VITE_DEV_PROCESSOR_WS_URL}/` | Processor live-position WebSocket. Default `ws://localhost:8081` (Phase 1.5). |
|
||||
|
||||
Override per-developer by copying `.env.example` to `.env.local` and editing — Vite auto-loads `.env.local` in any mode and the values flow into `vite.config.ts` via `loadEnv`.
|
||||
|
||||
If the dev port `5173` collides with another Vite app, run with `VITE_PORT=5174 pnpm dev` (or pin a different port in `vite.config.ts`).
|
||||
|
||||
## CI
|
||||
|
||||
|
||||
Reference in New Issue
Block a user