fix(packaging): declare @dnd-kit/utilities peer, add ./announcements subpath export - #25
Merged
Merged
Conversation
…subpath dist/index.js statically imports @tanstack/react-table, @dnd-kit/core, @dnd-kit/sortable and @dnd-kit/utilities. The last one was declared nowhere in the manifest -- neither dependencies nor peerDependencies -- so the package imported a specifier it never asked consumers to provide. It only ever resolved because every consumer so far happened to depend on it directly. Two fixes: 1. Add "@dnd-kit/utilities": "^3.2.2" to peerDependencies, next to its siblings. The range is the one sphere, sphere-backoffice and sphere-dev-portal already carry. 2. Give the announcement centre its own entry point, following the existing ./forms, ./canvas, ./panels, ./hooks and ./analytics pattern: a new tsup entry plus the matching "./announcements" exports block. The announcement surface only needs react, lucide-react, react-markdown and remark-gfm, so an app that wants a notification bell no longer has to install a data table and a drag-and-drop stack. The main barrel still re-exports the announcement components unchanged, so existing root imports keep working. This adds a narrower door without closing the wide one.
…brary builds against The peer was pinned to ^3.2.2, the version the three consuming apps happen to carry today. The library itself builds and tests against ^3.0.0 (its own devDependency), and every other peer here states the minimum supported major rather than whatever a consumer currently has installed — @dnd-kit/core is ^6.0.0 while the apps carry ^6.3.1. Stating a floor higher than the real one makes installs fail for consumers the library actually supports.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The defect
0.1.38's main bundledist/index.jsstatically imports four bare specifiers that a consumer must provide:@tanstack/react-table,@dnd-kit/core,@dnd-kit/sortableand@dnd-kit/utilities. All four are intsup.config.ts'sexternalarray; only three are declared inpeerDependencies.@dnd-kit/utilitieswas declared nowhere — not independencies, not inpeerDependencies. The package imported a specifier it never asked anyone to install. It only ever resolved because every consumer so far happened to depend on it directly.The failure surfaced when
sphere-quest-frontendswitched from a localfile:link to the published package. That app uses only the announcement components and carries none of the table/drag-and-drop stack:Note that the missing peer is the manifest half of the bug; the resolve error above is the other half — even a fully correct manifest would still force a notification-bell consumer to install a data table and a drag-and-drop stack just to import a bell.
The fixes
1. Declare the missing peer.
"@dnd-kit/utilities": "^3.2.2"added topeerDependenciesnext to its siblings. Not an invented range — it is exactly whatsphere,sphere-backofficeandsphere-dev-portalalready carry.2. Give the announcements module its own entry point. The announcement surface (
src/components/announcements/) imports onlyreact,lucide-react,react-markdownandremark-gfm— the latter two are regulardependencies, so they come along automatically. There is no reason a notification bell should drag in a data table.This follows the subpath-export pattern the library already uses for
./forms,./canvas,./panels,./hooksand./analytics, rather than inventing a new one:'announcements/index'entry intsup.config.ts,"./announcements"block inpackage.json'sexports, in the same shape as its neighbours.The main barrel is unchanged.
src/index.tsstill re-exports the announcement components, so the three apps that already import them from the root keep working. This adds a narrower door; it does not close the wide one.Evidence
A green build in this repo proves nothing about what a consumer receives, so the fix was verified against the real consumer using a packed tarball.
Emitted subpath bundle is genuinely independent. The only bare specifiers in
dist/announcements/index.js:No
@tanstack/*, no@dnd-kit/*.dist/announcements/index.d.tsnarrows further toreactandlucide-react.Consumer build, end to end.
npm packof this branch, installed intosphere-quest-frontendwithnpm install <tgz> --no-save(its manifest left untouched), imports repointed at@unicitylabs/sphere-ui/announcements:npm run build(tsc && vite build)@tanstack/react-tablenpm run test:runCritically, that build passed with no
@tanstack/react-tableand no@dnd-kit/*anywhere in the app'snode_modules(node_modules/@dnd-kitdoes not exist;node_modules/@tanstackcontains onlyquery-coreandreact-query).tscpassing also confirms thetypescondition of the new export resolves.The import lines that worked, to be applied in that app after publication:
All experimental changes in
sphere-quest-frontendwere reverted afterwards; nothing was committed there.Local checks
npm run test:run— 168 passed (23 files)npm run typecheck— cleannpm run build— clean, emitsdist/announcements/index.js(22.56 KB) +.d.tsnpm run lintis broken repo-wide (eslint not installed, no config) — pre-existing, untouched by this PR.versionis deliberately left at0.1.38; the release workflow owns versioning.