Merge chore/web-dev-host into main
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by oscabriel · committed by oscabriel · parents 83826c6, f8681bc · Browse files · 2 files·+37 added−19 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
2 files+37 added−19 removed
- other:+37 added−19 removed
Provenance
- Commit
4a9b05a- Tree
3e0f3d9- Author
oscabriel <oscarhernandeziv@gmail.com>- Committer
oscabriel <oscarhernandeziv@gmail.com>- Parent 1
83826c6- Parent 2
f8681bc
2 files changed+37 added−19 removed
modified:apps/web/vite.config.ts+31 added-13 removed
123456567891025 unmodified lines363738394041424344454647484950515253545540414243444546474849505657585960616263646566676869import { cloudflare } from "@cloudflare/vite-plugin";import tailwindcss from "@tailwindcss/vite";import { tanstackStart } from "@tanstack/react-start/plugin/vite";import viteReact from "@vitejs/plugin-react";import { defineConfig } from "vite";import type { Plugin } from "vite";import { defineConfig, loadEnv } from "vite";import type { Plugin, ServerOptions } from "vite";
import { MANIFEST_PATH, webManifestText,25 unmodified lines
// The Cloudflare framework guide's order: the Worker runs TanStack Start's// SSR environment, and Start comes before React. `vite build` picks the// stage from `CLOUDFLARE_ENV` (infra/deploy.ts sets it).export default defineConfig(({ mode }) => { // This machine's Caddy name for the dev server, from the gitignored // `apps/web/.env`; without one, the dev server answers on localhost alone. const caddyDevHost = loadEnv(mode, process.cwd(), "").CADDY_DEV_HOST;
const server: ServerOptions = { host: "127.0.0.1", port: 3032, strictPort: true, };
if (caddyDevHost !== undefined && caddyDevHost !== "") { server.allowedHosts = ["localhost", "127.0.0.1", caddyDevHost]; server.hmr = { clientPort: 443, host: caddyDevHost, protocol: "wss" }; }
export default defineConfig({ plugins: [ cloudflare({ viteEnvironment: { name: "ssr" } }), tailwindcss(), tanstackStart(), viteReact(), webAppManifest(), ], // shadcn's components import through `@/` (components.json), which // tsconfig.json's `paths` maps to `src/`. resolve: { tsconfigPaths: true }, return { plugins: [ cloudflare({ viteEnvironment: { name: "ssr" } }), tailwindcss(), tanstackStart(), viteReact(), webAppManifest(), ], // shadcn's components import through `@/` (components.json), which // tsconfig.json's `paths` maps to `src/`. resolve: { tsconfigPaths: true }, server, };});modified:README.md+6 added-6 removed
81 unmodified lines82 ```sh83 bun run --cwd apps/web dev84 ```85 86-`vite dev` resolves the web's `#backend` import to `apps/web/src/dev/backend.ts`: every contract served in process over memory adapters, seeded with the two fictional example projects, `examples/datekit/` and `examples/burrow/`. Open the URL vite prints; `/auth/dev?handle=ines-v` signs you in as datekit's fictional decider.86+`vite dev` resolves the web's `#backend` import to `apps/web/src/dev/backend.ts`: every contract served in process over memory adapters, seeded with the two fictional example projects, `examples/datekit/` and `examples/burrow/`. It answers on `http://127.0.0.1:3032`, pinned in `apps/web/vite.config.ts`; a `CADDY_DEV_HOST` in the gitignored `apps/web/.env` also lets a reverse proxy serve it under that name, with hot reload over `wss`. `/auth/dev?handle=ines-v` signs you in as datekit's fictional decider.87 88 To see every state a page can draw (each outcome, a family's fan mid-way, every kind of decision, a sealed ledger, a set env value, drafted proposals), add the dev fixtures: a fictional project, `vellum`, told as a story through the same service, and six small projects beside it. `live` also lands one family child about 20 s after a vellum page first reads it, so a page open on it shows the landing as it happens:89 90 ```sh91 VITE_DEV_FIXTURES=1 bun run --cwd apps/web dev92 VITE_DEV_FIXTURES=live bun run --cwd apps/web dev93 ```94 95-With the fixtures running, `WEB_URL=<the URL vite printed> bun run --cwd apps/web e2e -- a11y.e2e.ts` runs axe and a keyboard walk over every page in both colour schemes at 1440 and 390 px (it loads axe from cdnjs at run time).95+With the fixtures running, `WEB_URL=http://127.0.0.1:3032 bun run --cwd apps/web e2e -- a11y.e2e.ts` runs axe and a keyboard walk over every page in both colour schemes at 1440 and 390 px (it loads axe from cdnjs at run time).96 97-The CLI from source, against that dev world (use the port vite printed):97+The CLI from source, against that dev world:98 99 ```sh100-MYR_URL=http://localhost:5173 bun apps/cli/src/bin.ts projects101-MYR_URL=http://localhost:5173 bun apps/cli/src/bin.ts asks --project datekit102-MYR_URL=http://localhost:5173 bun apps/cli/src/bin.ts ask format-ordinal --project datekit100+MYR_URL=http://127.0.0.1:3032 bun apps/cli/src/bin.ts projects101+MYR_URL=http://127.0.0.1:3032 bun apps/cli/src/bin.ts asks --project datekit102+MYR_URL=http://127.0.0.1:3032 bun apps/cli/src/bin.ts ask format-ordinal --project datekit103 ```104 105 Both examples, seeded onto a platform that runs in Node on this machine for the length of the command, with real git:106 287 unmodified lines