Skip to content

chore: split the client core into @seamless-auth/client as an npm workspace - #149

Merged
Bccorb merged 1 commit into
mainfrom
chore/client-workspace
Sep 13, 2026
Merged

chore: split the client core into @seamless-auth/client as an npm workspace#149
Bccorb merged 1 commit into
mainfrom
chore/client-workspace

Conversation

@Bccorb

@Bccorb Bccorb commented Sep 13, 2026

Copy link
Copy Markdown
Contributor

Summary

Phase 3 of #64 (workspace conversion), pulled forward because a React Native binding is next (fells-code/seamless-templates#40) and it must share the client core rather than copy it.

  • The repository is now an npm workspace with two published packages:
    • packages/client@seamless-auth/client (new, 0.1.0 on release): createSeamlessAuthClient, createAuthSession, SessionStoragePort + implementations, createFetchWithAuth, error and result types, PRF helpers, role matching, wire type aliases. Lint-enforced: no React, router, or React Native imports, and no imports from a binding package.
    • packages/react@seamless-auth/react (patch): depends on @seamless-auth/client and re-exports the same public surface as before. No runtime behaviour change.
  • Files moved with git mv, so history follows them.
  • Tests run as two Jest projects from the root. The React project maps @seamless-auth/client to the client source, so a core change is exercised by the React suite without a build in between; packages/react/tsconfig.json carries the same mapping for type-checking and tsconfig.build.json drops it so emitted declarations reference the package by name.
  • Root scripts keep their names (lint, test, build, typecheck, check-npm-build), so ci.yml and release.yml run unchanged; build runs client before react explicitly.
  • Changesets: packages version independently (linked: []), client starts at 0.0.0 with a minor changeset so the first publish is 0.1.0.
  • AGENTS.md architecture section rewritten for the workspace; new root README and packages/client/README.md.

Kept as a local copy rather than a re-export: scopedRoles.ts. @seamless-auth/types/role/matching only declares import/types export conditions, which Jest 29 under jsdom cannot resolve (no require/default), and any Jest-based consumer of the client bundle would hit the same. Worth a default condition upstream; noted, not done here.

Depends on

fells-code/seamless-cli#203: seamless verify --local packs the react checkout with npm pack at the repo root. With the workspace that produces the private root package, so the harness now packs -w @seamless-auth/client -w @seamless-auth/react when it sees workspaces. The conformance.yml check on this PR consumes that reusable workflow @main, so it will go green once #203 merges.

Test plan

  • npm run lint clean
  • npm test: 327 passing across both projects, coverage 90.25 / 80.03 / 90.03 / 90.29
  • npm run typecheck both packages
  • npm run build both packages; react bundle externals are @seamless-auth/client, libphonenumber-js, react, react-router-dom; client bundle external is @simplewebauthn/browser
  • npm run check-npm-build: both tarballs carry dist, README, CHANGELOG, LICENSE
  • npx changeset status: client minor, react patch

…kspace

@seamless-auth/react was one package holding two layers: the headless client,
session store and result types any binding needs, and the React provider,
hooks and screens on top. A React Native binding is next and must share the
first layer rather than copy it, since the session state machine is the worst
place for two implementations to drift (#64).

packages/client publishes @seamless-auth/client with createSeamlessAuthClient,
createAuthSession, the storage port, createFetchWithAuth, the error and result
types, the PRF helpers, role matching and the wire type aliases. packages/react
depends on it and re-exports the same public surface it did before. Tests run
as one Jest project per package from the root; the React project maps the
client package to its source so a core change is exercised without a build.

Packaging only: no runtime behaviour changes in either package.
@Bccorb
Bccorb merged commit f8f0dfe into main Sep 13, 2026
2 of 3 checks passed
@Bccorb
Bccorb deleted the chore/client-workspace branch September 13, 2026 03:02
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.

1 participant