From 465205b137a57b623da1537388f63c6a5e785df4 Mon Sep 17 00:00:00 2001 From: "Ricardo Q. Bazan" Date: Sun, 18 Oct 2026 12:28:41 -0500 Subject: [PATCH] fix(examples): give each example its own ports The root `mise run test:e2e` runs the suites in parallel, and five examples shared a port with another one. The CommonJS twins move to 3011-3013, ssr-react-router to 3005 (its `start` task now listens there too) and ssr-tanstack-start to 3006. The examples README lists every example's ports. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_012xRhgX9oTNKCAhLoiC8vSX --- docs/contributing.md | 2 +- examples/README.md | 19 +++++++++++++++++++ examples/backend-bun-cjs/playwright.config.ts | 2 +- .../backend-bun-cjs/src/config/development.ts | 2 +- .../backend-bun-cjs/src/config/production.ts | 2 +- .../backend-bun-cjs/test/e2e/server.spec.ts | 2 +- .../backend-deno-cjs/playwright.config.ts | 2 +- .../src/config/development.ts | 2 +- .../backend-deno-cjs/src/config/production.ts | 2 +- .../backend-deno-cjs/test/e2e/server.spec.ts | 2 +- .../backend-node-cjs/playwright.config.ts | 2 +- .../src/config/development.ts | 2 +- .../backend-node-cjs/src/config/production.ts | 2 +- .../backend-node-cjs/test/e2e/server.spec.ts | 2 +- .../app/config/development.ts | 2 +- .../ssr-react-router/app/config/production.ts | 2 +- examples/ssr-react-router/mise.toml | 1 + .../ssr-react-router/playwright.config.ts | 2 +- .../ssr-tanstack-start/playwright.config.ts | 2 +- examples/ssr-tanstack-start/serve.js | 2 +- examples/ssr-tanstack-start/vite.config.ts | 2 +- 21 files changed, 39 insertions(+), 19 deletions(-) diff --git a/docs/contributing.md b/docs/contributing.md index 96cda83..69d4848 100644 --- a/docs/contributing.md +++ b/docs/contributing.md @@ -91,7 +91,7 @@ When pull requests with changesets land on `main`, the release job in [`ci.yml`] Examples are runtime-isolated demos. Each one installs the packed `@variablelab/env` tarball, as an outside consumer would, with its own lockfile and outside the pnpm workspace. To add one: -1. Create the directory under `examples//` with the source for the demo. +1. Create the directory under `examples//` with the source for the demo, and give it ports no other example uses (see [Ports](../examples/README.md#ports)). 2. Add a `package.json` that consumes `@variablelab/env` from the local tarball: ```jsonc "@variablelab/env": "file:../../package/.local/variablelab-env.tgz" diff --git a/examples/README.md b/examples/README.md index 505b751..d8c96b3 100644 --- a/examples/README.md +++ b/examples/README.md @@ -75,3 +75,22 @@ mise run //examples/backend-node:start ## Why isolated? `@variablelab/env` advertises itself as runtime-agnostic. Examples that secretly resolve through a shared pnpm workspace don't actually prove that promise. With per-example `mise.toml`, lockfiles, and a packed tarball, each example is a real consumer — it works exactly as it would for someone running `pnpm add @variablelab/env` in a fresh project. + +## Ports + +Each example uses its own ports, so `mise run test:e2e` can run all the suites in parallel. + +| Example | Ports | +| -------------------- | ------------------------------------------ | +| `backend-node` | 3001 | +| `backend-bun` | 3002 | +| `backend-deno` | 3003 | +| `backend-node-cjs` | 3011 | +| `backend-bun-cjs` | 3012 | +| `backend-deno-cjs` | 3013 | +| `worker-cloudflare` | 8787 | +| `edge-nextjs` | 3004 | +| `spa-vite-plugin` | 5173 `dev` and E2E, 4173 `preview` | +| `spa-vite-dynamic` | 5174 `dev`, 4174 `preview` (E2E uses both) | +| `ssr-react-router` | 5175 `dev`, 3005 `start` and E2E | +| `ssr-tanstack-start` | 3006 | diff --git a/examples/backend-bun-cjs/playwright.config.ts b/examples/backend-bun-cjs/playwright.config.ts index 6d4b74b..c2c9a63 100644 --- a/examples/backend-bun-cjs/playwright.config.ts +++ b/examples/backend-bun-cjs/playwright.config.ts @@ -1,6 +1,6 @@ import { defineConfig } from "@playwright/test"; -const PORT = 3002; +const PORT = 3012; const BASE_URL = `http://127.0.0.1:${PORT}`; export default defineConfig({ diff --git a/examples/backend-bun-cjs/src/config/development.ts b/examples/backend-bun-cjs/src/config/development.ts index 8a12642..450dfba 100644 --- a/examples/backend-bun-cjs/src/config/development.ts +++ b/examples/backend-bun-cjs/src/config/development.ts @@ -2,6 +2,6 @@ import type { EnvConfig } from "../env/schema.ts"; export default { log: { LEVEL: "debug" }, - server: { PORT: 3002, HOST: "127.0.0.1" }, + server: { PORT: 3012, HOST: "127.0.0.1" }, db: { URL: "postgres://localhost/dev", LOGGING: true }, } satisfies EnvConfig; diff --git a/examples/backend-bun-cjs/src/config/production.ts b/examples/backend-bun-cjs/src/config/production.ts index 7527b53..9da0ac8 100644 --- a/examples/backend-bun-cjs/src/config/production.ts +++ b/examples/backend-bun-cjs/src/config/production.ts @@ -2,6 +2,6 @@ import type { EnvConfig } from "../env/schema.ts"; export default { log: { LEVEL: "info" }, - server: { PORT: 3002, HOST: "0.0.0.0" }, + server: { PORT: 3012, HOST: "0.0.0.0" }, db: { LOGGING: false }, } satisfies EnvConfig; diff --git a/examples/backend-bun-cjs/test/e2e/server.spec.ts b/examples/backend-bun-cjs/test/e2e/server.spec.ts index ab9e16d..13f3ef0 100644 --- a/examples/backend-bun-cjs/test/e2e/server.spec.ts +++ b/examples/backend-bun-cjs/test/e2e/server.spec.ts @@ -11,7 +11,7 @@ test("loads development config via auto-discovery", async ({ request }) => { IS_PROD: false, IS_TEST: false, log: { LEVEL: "debug" }, - server: { PORT: 3002, HOST: "127.0.0.1" }, + server: { PORT: 3012, HOST: "127.0.0.1" }, db: { URL: "postgres://localhost/dev", LOGGING: true }, }, }); diff --git a/examples/backend-deno-cjs/playwright.config.ts b/examples/backend-deno-cjs/playwright.config.ts index ff25770..261c9d8 100644 --- a/examples/backend-deno-cjs/playwright.config.ts +++ b/examples/backend-deno-cjs/playwright.config.ts @@ -1,6 +1,6 @@ import { defineConfig } from "@playwright/test"; -const PORT = 3003; +const PORT = 3013; const BASE_URL = `http://127.0.0.1:${PORT}`; export default defineConfig({ diff --git a/examples/backend-deno-cjs/src/config/development.ts b/examples/backend-deno-cjs/src/config/development.ts index d22289a..a157d9a 100644 --- a/examples/backend-deno-cjs/src/config/development.ts +++ b/examples/backend-deno-cjs/src/config/development.ts @@ -2,6 +2,6 @@ import type { EnvConfig } from "../env/schema.ts"; export default { log: { LEVEL: "debug" }, - server: { PORT: 3003, HOST: "127.0.0.1" }, + server: { PORT: 3013, HOST: "127.0.0.1" }, db: { URL: "postgres://localhost/dev", LOGGING: true }, } satisfies EnvConfig; diff --git a/examples/backend-deno-cjs/src/config/production.ts b/examples/backend-deno-cjs/src/config/production.ts index 34fd7b2..4b8a80f 100644 --- a/examples/backend-deno-cjs/src/config/production.ts +++ b/examples/backend-deno-cjs/src/config/production.ts @@ -2,6 +2,6 @@ import type { EnvConfig } from "../env/schema.ts"; export default { log: { LEVEL: "info" }, - server: { PORT: 3003, HOST: "0.0.0.0" }, + server: { PORT: 3013, HOST: "0.0.0.0" }, db: { LOGGING: false }, } satisfies EnvConfig; diff --git a/examples/backend-deno-cjs/test/e2e/server.spec.ts b/examples/backend-deno-cjs/test/e2e/server.spec.ts index 762fabc..b8fdaed 100644 --- a/examples/backend-deno-cjs/test/e2e/server.spec.ts +++ b/examples/backend-deno-cjs/test/e2e/server.spec.ts @@ -11,7 +11,7 @@ test("loads development config via auto-discovery", async ({ request }) => { IS_PROD: false, IS_TEST: false, log: { LEVEL: "debug" }, - server: { PORT: 3003, HOST: "127.0.0.1" }, + server: { PORT: 3013, HOST: "127.0.0.1" }, db: { URL: "postgres://localhost/dev", LOGGING: true }, }, }); diff --git a/examples/backend-node-cjs/playwright.config.ts b/examples/backend-node-cjs/playwright.config.ts index ba6347d..7613982 100644 --- a/examples/backend-node-cjs/playwright.config.ts +++ b/examples/backend-node-cjs/playwright.config.ts @@ -1,6 +1,6 @@ import { defineConfig } from "@playwright/test"; -const PORT = 3001; +const PORT = 3011; const BASE_URL = `http://127.0.0.1:${PORT}`; export default defineConfig({ diff --git a/examples/backend-node-cjs/src/config/development.ts b/examples/backend-node-cjs/src/config/development.ts index c155ed3..68c0a27 100644 --- a/examples/backend-node-cjs/src/config/development.ts +++ b/examples/backend-node-cjs/src/config/development.ts @@ -2,6 +2,6 @@ import type { EnvConfig } from "../env/schema.ts"; export default { log: { LEVEL: "debug" }, - server: { PORT: 3001, HOST: "127.0.0.1" }, + server: { PORT: 3011, HOST: "127.0.0.1" }, db: { URL: "postgres://localhost/dev", LOGGING: true }, } satisfies EnvConfig; diff --git a/examples/backend-node-cjs/src/config/production.ts b/examples/backend-node-cjs/src/config/production.ts index 0ecabe0..95276cc 100644 --- a/examples/backend-node-cjs/src/config/production.ts +++ b/examples/backend-node-cjs/src/config/production.ts @@ -2,6 +2,6 @@ import type { EnvConfig } from "../env/schema.ts"; export default { log: { LEVEL: "info" }, - server: { PORT: 3001, HOST: "0.0.0.0" }, + server: { PORT: 3011, HOST: "0.0.0.0" }, db: { LOGGING: false }, } satisfies EnvConfig; diff --git a/examples/backend-node-cjs/test/e2e/server.spec.ts b/examples/backend-node-cjs/test/e2e/server.spec.ts index a7a506c..d53ed3e 100644 --- a/examples/backend-node-cjs/test/e2e/server.spec.ts +++ b/examples/backend-node-cjs/test/e2e/server.spec.ts @@ -11,7 +11,7 @@ test("loads development config via auto-discovery", async ({ request }) => { IS_PROD: false, IS_TEST: false, log: { LEVEL: "debug" }, - server: { PORT: 3001, HOST: "127.0.0.1" }, + server: { PORT: 3011, HOST: "127.0.0.1" }, db: { URL: "postgres://localhost/dev", LOGGING: true }, }, }); diff --git a/examples/ssr-react-router/app/config/development.ts b/examples/ssr-react-router/app/config/development.ts index 39933b4..abf9308 100644 --- a/examples/ssr-react-router/app/config/development.ts +++ b/examples/ssr-react-router/app/config/development.ts @@ -1,7 +1,7 @@ import type { ServerEnvConfig } from "../env/schema.server.ts"; export default { - server: { PORT: 3002, HOST: "127.0.0.1" }, + server: { PORT: 3005, HOST: "127.0.0.1" }, public: { API_BASE_URL: "http://localhost:3001/dev-api", APP_NAME: "rr7-dev-app", diff --git a/examples/ssr-react-router/app/config/production.ts b/examples/ssr-react-router/app/config/production.ts index c374253..4b64965 100644 --- a/examples/ssr-react-router/app/config/production.ts +++ b/examples/ssr-react-router/app/config/production.ts @@ -1,7 +1,7 @@ import type { ServerEnvConfig } from "../env/schema.server.ts"; export default { - server: { PORT: 3002, HOST: "0.0.0.0" }, + server: { PORT: 3005, HOST: "0.0.0.0" }, public: { API_BASE_URL: "https://api.example.com", APP_NAME: "rr7-prod-app", diff --git a/examples/ssr-react-router/mise.toml b/examples/ssr-react-router/mise.toml index 4e5d015..837c208 100644 --- a/examples/ssr-react-router/mise.toml +++ b/examples/ssr-react-router/mise.toml @@ -37,6 +37,7 @@ run = "react-router build" [tasks.start] depends = ["setup"] +env = { PORT = "3005" } run = "react-router-serve build/server/index.js" [tasks."test:e2e"] diff --git a/examples/ssr-react-router/playwright.config.ts b/examples/ssr-react-router/playwright.config.ts index 0bc1761..c00cbbb 100644 --- a/examples/ssr-react-router/playwright.config.ts +++ b/examples/ssr-react-router/playwright.config.ts @@ -1,6 +1,6 @@ import { defineConfig } from "@playwright/test"; -const PORT = 3002; +const PORT = 3005; const BASE_URL = `http://127.0.0.1:${PORT}`; export default defineConfig({ diff --git a/examples/ssr-tanstack-start/playwright.config.ts b/examples/ssr-tanstack-start/playwright.config.ts index 60be2f4..f7e1342 100644 --- a/examples/ssr-tanstack-start/playwright.config.ts +++ b/examples/ssr-tanstack-start/playwright.config.ts @@ -1,6 +1,6 @@ import { defineConfig } from "@playwright/test"; -const PORT = 3003; +const PORT = 3006; const BASE_URL = `http://127.0.0.1:${PORT}`; export default defineConfig({ diff --git a/examples/ssr-tanstack-start/serve.js b/examples/ssr-tanstack-start/serve.js index 76cac92..3a10948 100644 --- a/examples/ssr-tanstack-start/serve.js +++ b/examples/ssr-tanstack-start/serve.js @@ -5,6 +5,6 @@ import { serve } from "srvx/node"; import handler from "./dist/server/server.js"; -const port = Number(process.env.PORT) || 3003; +const port = Number(process.env.PORT) || 3006; serve({ fetch: handler.fetch, port }); console.log(`tss-prod-app listening on http://127.0.0.1:${port}`); diff --git a/examples/ssr-tanstack-start/vite.config.ts b/examples/ssr-tanstack-start/vite.config.ts index 82afcf1..0f7ffd9 100644 --- a/examples/ssr-tanstack-start/vite.config.ts +++ b/examples/ssr-tanstack-start/vite.config.ts @@ -5,5 +5,5 @@ import { defineConfig } from "vite"; export default defineConfig({ plugins: [tanstackStart(), react(), envConfig()], - server: { port: 3003, strictPort: true }, + server: { port: 3006, strictPort: true }, });