Skip to content

feat(ui,sdk,shared): add UI test coverage and dual ESM+CJS builds - #19

Merged
Mona-i merged 3 commits into
lumio-network:mainfrom
starfishkrq:feature/8-9-ui-tests-dual-esm-cjs
Sep 10, 2026
Merged

Mona-i merged 3 commits into
lumio-network:mainfrom
starfishkrq:feature/8-9-ui-tests-dual-esm-cjs

Conversation

@starfishkrq

Copy link
Copy Markdown
Contributor

Summary

closes #8
closes #9

This PR implements both open issues in a single cohesive change.


Issue #8 — Expand @lumio/ui test coverage

File changed: packages/ui/src/ui.test.tsx

  • Card / CardTitle / CardBody — renders children, merges a passed className, forwards ref (Card)
  • Input — defaults type to "text", forwards placeholder, forwards disabled, merges className
  • Buttonsecondary and ghost variant class assertions; sm, md (default), lg size class assertions
  • Badge — all five variants exercised: neutral (default), lumen, teal (pre-existing), coral, sky

Result: 27 tests, all passing (up from 6).


Issue #9 — Dual ESM + CJS builds for all three packages

Strategy: two tsc invocations per package — no new runtime dependencies needed.

Package CJS output ESM output
@lumio/shared dist/cjs/ dist/esm/
@lumio/sdk dist/cjs/ dist/esm/
@lumio/ui dist/cjs/ dist/esm/

Per-package changes:

  • tsconfig.jsonmodule: Node16 + moduleResolution: Node16, outDir: dist/cjs
  • tsconfig.esm.json (new) — module: ESNext, moduleResolution: Bundler, outDir: dist/esm
  • package.json — build script runs both configs; exports map updated with import/require/types conditions; main -> dist/cjs/index.js, module -> dist/esm/index.js
  • @lumio/ui ./tailwind-preset sub-path also gets both import and require conditions

Validation

  • pnpm lint green
  • pnpm typecheck green
  • pnpm build green (all 3 packages, both CJS + ESM)
  • pnpm test green (55 tests: 27 UI + 25 shared + 3 sdk)

lumio-bot and others added 3 commits September 10, 2026 18:54
Issue lumio-network#8 — expand @lumio/ui test coverage:
- Add Card, CardTitle, CardBody render tests (children + className merge + ref)
- Add Input tests: default type=text, placeholder, disabled, className merge
- Add Button size variants (sm, md, lg) and secondary/ghost variant tests
- Add all Badge variants: neutral, lumen, coral, sky (teal already covered)
- 27 tests total, all passing (up from 6)

Issue lumio-network#9 — ship dual ESM + CJS builds for all three packages:
- Add tsconfig.esm.json per package (module: ESNext, moduleResolution: Bundler, outDir: dist/esm)
- Update tsconfig.json per package to output CJS into dist/cjs (was dist/)
- Update build script in each package.json: tsc -p tsconfig.json && tsc -p tsconfig.esm.json
- Update package.json exports with import/require/types conditions for . entry
- @lumio/ui also exposes ./tailwind-preset with both import and require conditions
- main points to dist/cjs/index.js; module field points to dist/esm/index.js
The CI typecheck was failing because @lumio/sdk's tsconfig.json used
moduleResolution: Node (inherited from tsconfig.base.json), which cannot
resolve @lumio/shared when its package.json exports map only exposes
import/require conditions — TypeScript 5 finds the ESM types via the
exports map but rejects them under Node resolution.

Fix: set module: Node16 + moduleResolution: Node16 in each package's
tsconfig.json (CJS build). Node16 resolution correctly reads the
exports map and picks the require condition, resolving to dist/cjs/.
The tsconfig.esm.json files keep module: ESNext + moduleResolution: Bundler.

Affected: packages/sdk, packages/shared, packages/ui
@coderabbitai

coderabbitai Bot commented Sep 10, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 81a69515-edd0-442d-9443-468606a42d23


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@Mona-i
Mona-i merged commit 3e3d539 into lumio-network:main Sep 10, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

build(sdk): ship dual ESM + CJS builds for all three packages test(ui): cover Card and Input, and the untested Button/Badge variants

2 participants