|
| 1 | +# AGENTS.md |
| 2 | + |
| 3 | +## Cursor Cloud specific instructions |
| 4 | + |
| 5 | +This repo is the `nuxt-i18n-micro` pnpm monorepo (Node 22 / pnpm 9.14.2 are preinstalled). The |
| 6 | +startup update script already runs `pnpm install`. No Docker, database, or external service is |
| 7 | +required; integration/e2e tests spawn their own Nuxt servers in-process. |
| 8 | + |
| 9 | +### Build order matters (non-obvious gotcha) |
| 10 | + |
| 11 | +Before running tests, typecheck, or the dev server on a fresh checkout, run the build steps in this |
| 12 | +exact order (the dependency runs both ways): |
| 13 | + |
| 14 | +```bash |
| 15 | +pnpm --filter "./packages/**" --filter "!./packages/*/playground" run build |
| 16 | +pnpm run dev:prepare |
| 17 | +pnpm --filter "./packages/*/playground" run build |
| 18 | +``` |
| 19 | + |
| 20 | +- `dev:prepare` loads `src/module.ts`, which imports the `@i18n-micro/*` packages from their |
| 21 | + `dist/`, so packages must be built first. It also generates `.nuxt/tsconfig.json`, which the root |
| 22 | + `tsconfig.json` extends. |
| 23 | +- The last step (building the package playgrounds) is easy to forget but **required for |
| 24 | + `pnpm run test:unit` / `pnpm run typecheck` to pass**: the Astro playground build generates the |
| 25 | + `virtual:i18n-micro/config` type declaration used by `packages/astro/playground/src/middleware.ts`. |
| 26 | + Skip it and `test:unit` fails with `Cannot find module 'virtual:i18n-micro/config'` even though all |
| 27 | + 280 runtime tests still pass. This mirrors the order in `.github/workflows/ci.yml`. |
| 28 | + |
| 29 | +### Running the app (dev) |
| 30 | + |
| 31 | +`pnpm run dev` starts the main playground (Nuxt) on http://localhost:3000. The root path 302-redirects |
| 32 | +to the default locale (`/en`); locales are prefixed (`/en`, `/de`, `/fr`, `/es`). The startup |
| 33 | +warnings about `localeCookie` and large translation payloads are expected in the playground and are |
| 34 | +not errors. |
| 35 | + |
| 36 | +### Lint / test / build reference |
| 37 | + |
| 38 | +Standard commands live in `package.json` scripts and `.github/CONTRIBUTING.md`. Key ones: |
| 39 | + |
| 40 | +- Lint: `pnpm run lint` (oxlint), format: `pnpm run format` (oxfmt) |
| 41 | +- Unit tests: `pnpm run test:unit` (fast; includes tsc/vue-tsc typecheck of `test/**`) |
| 42 | +- Full suite: `pnpm run test` (unit + integration + e2e + package projects) |
| 43 | +- E2E needs a browser first: `pnpm exec playwright install chromium` |
| 44 | +- Typecheck: `pnpm run typecheck` |
| 45 | + |
| 46 | +### Package changes |
| 47 | + |
| 48 | +Per `.cursor/rules/package-versioning.mdc`: after editing anything under `packages/<name>/` (or `src/` |
| 49 | +for the root module), bump the affected `package.json` patch version once per PR and rebuild that |
| 50 | +package (`pnpm --filter @i18n-micro/<name> build`). |
0 commit comments