Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@ website/ # demo site (Vite + TanStack Router)
- **Light/dark mode** — handled via CSS `light-dark()` + `color-scheme`, not JS.
- **Accessibility first** — ARIA attributes (e.g. `aria-colindex`, `aria-rowindex`, `aria-selected`, roles) are required. Tests query by role.
- **Formatting** — oxfmt (not Prettier). **Linting** — ESLint (must pass with zero warnings).
- **Build** — Rolldown bundles library to `lib/`; `ecij` plugin prefixes classes with `rdg-{version}-` (dots→dashes) to avoid cross-version conflicts.
- **Build** — tsdown bundles library to `lib/`; `ecij` plugin prefixes classes with `rdg-{version}-` (dots→dashes) to avoid cross-version conflicts.

## Testing

- Browser tests use `vitest/browser` + Playwright. `test/setupBrowser.ts` configures `page.render()` via `vitest-browser-react` and registers custom locators via `locators.extend()` — prefer `page.getGrid()`, `page.getCell({ name })`, `page.getRow()`, `page.getHeaderCell()`, `page.getSelectedCell()`, etc. over raw `page.getByRole()`.
- Test helpers in `test/browser/utils.tsx`: `setup()`, `getRowWithCell()`, `getCellsAtRowIndex()`, `validateCellPosition()`, `scrollGrid()`, `tabIntoGrid()`, `testCount()`, `testRowCount()`.
- Browser tests use `vitest/browser` + Playwright. `test/setupBrowser.ts` configures `page.render()` via `vitest-browser-react` and registers custom locators via `locators.extend()` — prefer `page.getGrid()`, `page.getCell({ name })`, `page.getRow()`, `page.getHeaderCell()`, `page.getActiveCell()`, etc. over raw `page.getByRole()`.
- Test helpers in `test/browser/utils.tsx`: `setup()`, `getRowWithCell()`, `getCellsAtRowIndex()`, `validateCellPosition()`, `scrollGrid()`, `safeTab()`, `testCount()`, `testRowCount()`.
- `test/failOnConsole.ts` fails tests on unexpected console warnings/errors.
- **Never run visual regression tests** — screenshots are environment-dependent so visual regression tests must run in CI only.

Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"start": "vite serve --clearScreen false",
"preview": "vite preview",
"build:website": "vite build",
"build": "rolldown -c",
"build": "tsdown",
"test": "vitest run --project browser --project node",
"test:watch": "vitest watch --project browser --project node",
"test:ci": "vitest run",
Expand All @@ -52,6 +52,7 @@
"@faker-js/faker": "^10.3.0",
"@tanstack/react-router": "^1.166.7",
"@tanstack/router-plugin": "^1.166.7",
"@tsdown/css": "^0.21.7",
"@types/node": "^25.5.0",
"@types/react": "^19.2.14",
"@types/react-dom": "^19.2.3",
Expand All @@ -73,8 +74,7 @@
"postcss": "^8.5.2",
"react": "^19.2.4",
"react-dom": "^19.2.4",
"rolldown": "1.0.0-rc.5",
"rolldown-plugin-dts": "^0.22.5",
"tsdown": "^0.21.7",
"typescript": "~6.0.1-rc",
"typescript-eslint": "^8.57.0",
"vite": "^8.0.0",
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.vite.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
"lib": ["ESNext", "DOM"],
"skipLibCheck": true
},
"include": ["package.json", "rolldown.config.ts", "vite.config.ts"]
"include": ["package.json", "tsdown.config.ts", "vite.config.ts"]
}
27 changes: 13 additions & 14 deletions rolldown.config.ts → tsdown.config.ts
Original file line number Diff line number Diff line change
@@ -1,28 +1,27 @@
import { isAbsolute } from 'node:path';
import { ecij } from 'ecij/plugin';
import { defineConfig } from 'rolldown';
import { dts } from 'rolldown-plugin-dts';
import { defineConfig } from 'tsdown';

import pkg from './package.json' with { type: 'json' };

export default defineConfig({
input: './src/index.ts',
output: {
dir: 'lib',
cssEntryFileNames: 'styles.css',
sourcemap: true,
cleanDir: true
},
outDir: 'lib',
platform: 'neutral',
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be platform: 'browser'?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think so, we want to support SSR as well, so the lib should be compatible with node.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI there's no build output difference at the moment if we set platform: 'browser'

external: (id) => !id.startsWith('.') && !isAbsolute(id),
sourcemap: true,
deps: {
skipNodeModulesBundle: true
},
css: {
fileName: 'styles.css'
},
dts: {
build: true,
tsconfig: './tsconfig.src.json'
},
plugins: [
ecij({
// We add the package version as prefix to avoid style conflicts
// between multiple versions of RDG on the same page
classPrefix: `rdg-${pkg.version.replaceAll('.', '-')}-`
}),
dts({
tsconfig: './tsconfig.src.json'
})
]
});