diff --git a/CLAUDE.md b/CLAUDE.md index 9e3f830..d8a0451 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -21,11 +21,42 @@ read that before starting anything non-trivial. |---|---| | Dev server | `yarn start` | | Production build | `yarn build` | +| Serve production build | `yarn preview` (defaults to http://localhost:4173) | | Lint | `yarn eslint` | | Type-check (TS 7 native, fast) | `yarn typecheck` | | Test (Vitest, once) | `yarn test` | | Test (watch) | `yarn test:watch` | +## Setup walkthrough + +1. **Clone the renderer SDK as a sibling of this repo.** + `vite.config.mjs` resolves the `@nitrots/*` aliases against + `../Nitro_Render_V3` (preferred) or `../renderer` (legacy). If neither + exists, the dev server and build now fail fast with a message + pointing here. + + ```sh + cd .. # parent of Nitro-V3 + git clone Nitro_Render_V3 + cd Nitro_Render_V3 && yarn install + ``` + +2. **Install client deps.** + ```sh + cd ../Nitro-V3 + yarn install + ``` + +3. **Materialize the runtime configuration.** `public/configuration/` + ships `.example` files. Copy the ones you need without the `.example` + suffix and point them at your game server (websocket URL, asset + base URL, UI texts, etc.). The dev server doesn't fail if these are + missing but the client renders a blank/error screen at runtime. + +4. **Run.** + - Dev: `yarn start` (Vite, HMR, includes the renderer source). + - Production preview: `yarn build && yarn preview`. + The renderer SDK (`@nitrots/nitro-renderer`) is consumed via a filesystem link to a sibling working tree — `../Nitro_Render_V3` (preferred) or `../renderer` (legacy). Without it, `yarn typecheck` reports TS2307 across diff --git a/vite.config.mjs b/vite.config.mjs index 5947ff6..0a8536e 100644 --- a/vite.config.mjs +++ b/vite.config.mjs @@ -7,6 +7,23 @@ const legacyRendererRoot = resolve(__dirname, '..', 'renderer'); const currentRendererRoot = resolve(__dirname, '..', 'Nitro_Render_V3'); const rendererRoot = existsSync(currentRendererRoot) ? currentRendererRoot : legacyRendererRoot; +if(!existsSync(rendererRoot)) +{ + // Fail fast with a useful message instead of waiting for Rolldown to + // report "Failed to resolve import @nitrots/nitro-renderer" deep + // inside the bundle pass. + throw new Error( + '\n Nitro renderer SDK not found.\n\n' + + ' vite.config.mjs expects one of these directories to exist as a sibling of this repo:\n' + + ` - ${ currentRendererRoot } (preferred)\n` + + ` - ${ legacyRendererRoot } (legacy)\n\n` + + ' Clone the Nitro_Render_V3 repo next to Nitro-V3 and rerun:\n' + + ' git clone ../Nitro_Render_V3\n' + + ' cd ../Nitro_Render_V3 && yarn install\n\n' + + ' (See CLAUDE.md "Commands" section for the full setup walkthrough.)\n' + ); +} + const ReactCompilerConfig = { target: '19' };