diff --git a/AGENTS.md b/AGENTS.md index ebfe854..c1cb19c 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -10,11 +10,11 @@ This guide covers `svelte-querybuilder` development: code style, workflow, and o ## Project Overview -Svelte 5 port of [React Query Builder](https://react-querybuilder.js.org). Bun workspace monorepo: +A Svelte 5 library that shares its logic layer with [React Query Builder](https://react-querybuilder.js.org) — not a transliteration of it. Behavior and rendered DOM are held to RQB; the component API is designed for Svelte. Bun workspace monorepo: -- **Main package**: `packages/svelte-querybuilder` - Svelte 5 components + types +- **Main package**: `packages/svelte-querybuilder` - Svelte 5 components + types, plus the development playground under `src/routes` - **Logic layer**: `@react-querybuilder/core` (npm dependency) - query manipulation, parsers, formatters, defaults, i18n strings. **Not vendored.** Re-exported from the barrel so consumers never need a direct core dependency. -- **Examples**: `examples/*` (workspace glob; may be empty) +- **Examples**: `examples/*` (workspace glob) - currently just `sveltekit`, which doubles as the SSR gate See `CHANGELOG.md` for release history. @@ -49,10 +49,12 @@ Run from repo root unless noted. - `bun run check:exports` - `attw` on a packed tarball + `dist` specifier lint (needs a build first) - `bun lint` - oxlint - `bun fmt` / `bun fmt:check` - oxfmt (run `bun fmt` after changes) +- `bun run conformance` - Fetches the RQB fixture set and runs the conformance suites -**Build:** +**Build and run:** - `bun run build` - `svelte-package` into `dist`, then compile SCSS +- `bun run dev` - Serves the playground at `packages/svelte-querybuilder/src/routes` against library source Before submitting a PR, run the CI sequence: `bun run check:all`. @@ -61,14 +63,23 @@ Before submitting a PR, run the CI sequence: `bun run check:all`. ### Structure ``` -packages/svelte-querybuilder/src/lib/ -├── *.svelte # Components (PascalCase.svelte) -├── types/ # TypeScript defs -├── utils/ # Svelte-specific utilities (camelCase.ts) -├── styles/ # SCSS (_svelte.scss layered over core's partials) -└── index.ts # Barrel: components, types, and `export * from '@react-querybuilder/core'` +packages/svelte-querybuilder/ +├── src/lib/ # The only published code +│ ├── *.svelte # Components (PascalCase.svelte) +│ ├── types/ # TypeScript defs +│ ├── utils/ # Svelte-specific utilities (camelCase.ts) +│ ├── styles/ # SCSS (_svelte.scss layered over core's partials) +│ └── index.ts # Barrel: components, types, `export * from '@react-querybuilder/core'` +├── src/routes/ # SvelteKit dev playground; never packaged +└── test/conformance/ # Fixture-driven parity suites (fixtures are downloaded, not generated) ``` +The package is a SvelteKit project so that `src/routes` can exist, but Kit is a development +convenience only: `svelte-package` reads `src/lib` and nothing else. `vite.config.ts` serves the +playground; the unit suite has its own `vitest.config.ts` on the bare `svelte()` plugin, because +`sveltekit()` resolves its project from the working directory and Vitest runs the package from +the monorepo root. + ### Naming - **Components**: PascalCase (`QueryBuilder.svelte`, `RuleGroup.svelte`) @@ -82,7 +93,7 @@ Runes only. No Svelte 4 idioms — no `export let`, no `$:`, no stores for compo ```svelte +
+