fix(packaging)!: make the component library consumable outside the monorepo - #496
Merged
Conversation
This was referenced Jul 14, 2026
aldbr
marked this pull request as draft
July 14, 2026 11:14
This was referenced Jul 14, 2026
aldbr
marked this pull request as ready for review
July 14, 2026 13:49
…norepo
Restructure @dirac-grid/diracx-web-components packaging so the library
works when installed from npm outside this monorepo:
- move host-provided packages (react, react-dom, MUI core, emotion,
@axa-fr/react-oidc, swr) from dependencies to peerDependencies and
mirror them in devDependencies for local dev/test
- add a proper exports map with a root "." entry (types-first) plus a
new ./services entry; add sideEffects: false and engines.node >= 22
- drop the legacy src/{components,contexts,hooks,types}/package.json
stub files (superseded by the exports map)
- add scripts/verify-dist.mjs to the build to fail fast when tsup
output stops matching package.json#exports
- add a framework-agnostic services/fetcher HTTP client module
(exported via ./services; root re-export lands with the consumer
migration) and guard process.env access in useDiracxUrl so non-Next
bundlers don't throw
- remove next/image usage from LoginForm and DashboardDrawer (plain
<img>) so the library no longer requires Next.js; LoginForm gains a
skeleton loading state and an error Alert
- pin Node >= 22 at the root (engines + .nvmrc); react-virtuoso stays
a direct dependency until the DataTable rewrite lands
BREAKING CHANGE: react, react-dom, @mui/material, @mui/icons-material,
@emotion/react, @emotion/styled, @axa-fr/react-oidc and swr are now
peerDependencies and must be installed by the consuming application.
Deep imports that relied on the removed per-directory package.json
stubs must use the documented subpath exports instead.
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.
Part of #494 (stack 2/5). Stacked on #495 — until it merges, review the last commit only (
fix(packaging)!).Makes
@dirac-grid/diracx-web-componentsconsumable outside this monorepo:react,react-dom,@mui/material,@mui/icons-material,@emotion/*,@axa-fr/react-oidc,swrmove from hard dependencies to peers (still in devDependencies for local dev/tests). Prevents duplicate React/emotion instances ("Invalid hook call", broken styles) and a duplicated oidc module with silently broken auth state."."root entry (bare package import currently throwsERR_PACKAGE_PATH_NOT_EXPORTED), orderstypesfirst in every condition block, deletes the stale per-directorypackage.jsonstubs pointing at nonexistent.cjsfiles.sideEffectsset to a scoped array (["**/*.css", "**/SearchBar/DatePicker.*"]) so bundlers can tree-shake while preserving the side-effectfuldayjs/locale/en-gbimport inDatePicker(makes the lazy@mui/x-chartssplit actually effective downstream).verify-distbuild guard: validates everyexportspath against the actual tsup output on each build.next/imageimports (Next.js was never a declared dependency) become plain<img>; theprocess.envread is guarded for non-Next bundlers.services/fetcherHTTP client module (consumed by later PRs in the stack).enginesfield,.nvmrc,test:coveragescript, devDeps used by later stack PRs.BREAKING CHANGE: consumers must install the peer dependencies themselves; the library no longer ships React/MUI/emotion/oidc as its own dependencies.
🤖 Generated with Claude Code