Skip to content

fix(deps): move internal-only peer deps to dependencies#10

Merged
KruGoL merged 1 commit into
mainfrom
fix/peer-deps-to-deps
Jun 2, 2026
Merged

fix(deps): move internal-only peer deps to dependencies#10
KruGoL merged 1 commit into
mainfrom
fix/peer-deps-to-deps

Conversation

@KruGoL

@KruGoL KruGoL commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

Summary

Three packages were peer dependencies despite having NO shared state with the consumer — they're purely internal to sphere-ui:

  • `react-dropzone` — implementation detail of ``
  • `framer-motion` — drives `motion.*` primitives across the library
  • `lucide-react` — icon set referenced by Icons / form fields

As peer deps, every consumer had to either list them explicitly in their own package.json or skip install via `--legacy-peer-deps` and then have CI fail because vite couldn't resolve the imports from `sphere-ui/dist` (which is exactly what just bit backoffice + dev-portal).

Moving them to `dependencies` puts them in the install tree automatically. Consumers don't have to know they exist. npm dedupe keeps a single copy when consumer-pinned versions overlap, so bundle size is unchanged in the common case.

Kept as peer (correctly)

  • `react` / `react-dom` — single-instance hooks
  • `@tanstack/react-query` / `@tanstack/react-table` — shared state
  • `@dnd-kit/*` — DndContext is shared across host + library
  • `recharts` (optional)

Test plan

  • Trigger publish workflow with v=0.1.23.
  • sphere-backoffice / sphere-dev-portal bump to ^0.1.23 → can remove their explicit `framer-motion` / `react-dropzone` listings in a follow-up.
  • Run `npm ci` on a fresh checkout of a consumer → no "missing peer" warnings, no resolve errors.

🤖 Generated with Claude Code

Three packages were declared as peerDependencies even though they
have NO shared state with the consumer — they're used purely inside
sphere-ui components:
  * react-dropzone — implementation detail of <MediaUploader>
  * framer-motion  — drives motion.* primitives across the lib
  * lucide-react   — icon set referenced by Icons / form fields

Declaring them as peer forced every consumer to either:
  (a) list them explicitly in their own package.json, OR
  (b) skip install with --legacy-peer-deps and then have CI fail
      because vite can't resolve the imports from sphere-ui/dist.

Moving them to `dependencies` puts them in the install tree
automatically. Consumers don't have to know they exist. npm dedupe
keeps a single copy when consumer-pinned versions overlap, so bundle
size stays the same as before in the common case.

Kept as peer (correctly):
  * react / react-dom / @tanstack/react-query / @tanstack/react-table
    — single-instance state (hooks, queryClient, table state)
  * @dnd-kit/* — DndContext is shared across host + library
  * recharts (optional)

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@KruGoL KruGoL merged commit 5c913ec into main Jun 2, 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.

1 participant