mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-24 05:43:06 +00:00
chore(help-media): let many media runs share one built client
E2E_WEB_PREVIEW serves client/dist with vite preview instead of a dev server per run; a dozen dev servers compiling the app at once timed out the setup login. The README also notes that mocked services need page.context().route once the service worker controls the page.
This commit is contained in:
@@ -117,6 +117,15 @@ so look at three or four pictures from a subset run before starting it.
|
||||
each run rebuilds it under the servers of the others. Give each run its own
|
||||
`TREK_PLUGINS_DIR` and `TREK_PLUGINS_DATA_DIR` as well (the seed installs a
|
||||
plugin), and its own Vite `cacheDir` when it starts a Vite of its own.
|
||||
- More than three or four runs at once: build the client once (`npm run build`)
|
||||
and set `E2E_WEB_PREVIEW=1` as well, so each run serves `dist/` with
|
||||
`vite preview` instead of a dev server of its own. A dozen dev servers compiling
|
||||
the app at the same time take the whole machine, and the login of the setup
|
||||
step times out after 45 s. The pictures do not change: the guides drive the
|
||||
same app.
|
||||
- A mocked outside service (a photo library, an AI provider) is answered with
|
||||
`page.context().route`, not `page.route`: once the service worker of the built
|
||||
app controls the page, its requests no longer pass a page route.
|
||||
- A plugin installed by a run lives in `server/data/plugins/`; the dev server
|
||||
imports it on its next restart. Guides that install one uninstall it in `cleanup`.
|
||||
- The trip's last day is the run day by construction (`e2e/dates.ts`: every
|
||||
|
||||
@@ -143,7 +143,10 @@ export default defineConfig({
|
||||
stderr: 'pipe',
|
||||
},
|
||||
{
|
||||
command: 'npm run dev',
|
||||
// E2E_WEB_PREVIEW serves the client already built in dist/ (`npm run build`
|
||||
// first) instead of a dev server compiling it again: several media runs at
|
||||
// once otherwise spend the machine on Vite and time out on the first page.
|
||||
command: process.env.E2E_WEB_PREVIEW ? `npx vite preview --port ${WEB_PORT} --strictPort` : 'npm run dev',
|
||||
port: WEB_PORT,
|
||||
env: { TREK_DEV_PORT: String(WEB_PORT), TREK_DEV_API: `http://localhost:${API_PORT}` },
|
||||
reuseExistingServer: !process.env.CI,
|
||||
|
||||
Reference in New Issue
Block a user