|
| 1 | +# Agents |
| 2 | + |
| 3 | +Instructions for AI coding agents working on this repo. |
| 4 | + |
| 5 | +## Project |
| 6 | + |
| 7 | +TypeScript monorepo for libraries enhancing web map clients (`@xtramaps` scope) with framework-specific variants. Libraries are published to npm. |
| 8 | + |
| 9 | +## Structure |
| 10 | + |
| 11 | +``` |
| 12 | +packages/ |
| 13 | + vite.config.base.ts # Shared Vite lib config factory |
| 14 | + core/<lib>/ # Plain TypeScript (no framework deps) |
| 15 | + react/<lib>/ # React variant (depends on core, peers on react) |
| 16 | + vue/<lib>/ # Vue variant (depends on core, peers on vue) |
| 17 | + svelte/<lib>/ # Svelte variant (depends on core, peers on svelte) |
| 18 | +``` |
| 19 | + |
| 20 | +Each library has: `package.json`, `tsconfig.json`, `vite.config.ts`, `src/index.ts`. |
| 21 | + |
| 22 | +## Naming |
| 23 | + |
| 24 | +- `@xtramaps/<lib>` — core package |
| 25 | +- `@xtramaps/<lib>-react` — React variant |
| 26 | +- `@xtramaps/<lib>-vue` — Vue variant |
| 27 | +- `@xtramaps/<lib>-svelte` — Svelte variant |
| 28 | + |
| 29 | +## Commands |
| 30 | + |
| 31 | +- `npm run build` — build all packages (via Turborepo) |
| 32 | +- `npm run lint` — lint and format check (Biome) |
| 33 | +- `npm run lint:fix` — auto-fix lint/format issues |
| 34 | +- `npm run typecheck` — type-check all packages |
| 35 | + |
| 36 | +## Key Conventions |
| 37 | + |
| 38 | +- All packages output ESM + CJS + `.d.ts` via Vite library mode |
| 39 | +- `vite.config.ts` uses `defineLibConfig()` from `packages/vite.config.base.ts` |
| 40 | +- `tsconfig.json` extends `tsconfig.base.json` (must specify `outDir`, `rootDir`, `include` locally) |
| 41 | +- Shared devDeps (`typescript`, `vite`, `vite-plugin-dts`) live in root only — do not add to individual packages |
| 42 | +- Framework deps (react, vue, svelte) are externalized and declared as `peerDependencies` |
| 43 | +- Core deps are listed in `dependencies` (not peers) |
| 44 | +- Biome handles formatting and linting — no Prettier or ESLint |
| 45 | +- Changesets for versioning — run `npx changeset` after changes |
| 46 | + |
| 47 | +## Adding a New Library |
| 48 | + |
| 49 | +1. Create `packages/core/<lib>/` with `package.json`, `tsconfig.json`, `vite.config.ts`, `src/index.ts` |
| 50 | +2. Create corresponding `packages/{react,vue,svelte}/<lib>/` variants |
| 51 | +3. Run `npm install` to link workspaces |
| 52 | +4. Run `npm run build` to verify |
| 53 | + |
| 54 | +## Checks Before Committing |
| 55 | + |
| 56 | +1. `npm run lint` passes |
| 57 | +2. `npm run build` succeeds |
| 58 | +3. `npm run typecheck` passes |
0 commit comments