Skip to content

fix(components): keep tests and stories out of the published types - #3103

Merged
mfal merged 2 commits into
mainfrom
claude/dts-exclude-tests-stories
Sep 4, 2026
Merged

fix(components): keep tests and stories out of the published types#3103
mfal merged 2 commits into
mainfrom
claude/dts-exclude-tests-stories

Conversation

@mfal

@mfal mfal commented Sep 2, 2026

Copy link
Copy Markdown
Member

unplugin-dts emits a declaration for everything its include matches, and all eight release builds passed include: ["src"]. So story and test declarations shipped:

1.1.10 tarball entries of those stories/tests
@mittwald/flow-react-components 4160 126 *.stories.d.ts + 126 maps
@mittwald/flow-remote-react-components 799 196 under dist/types/tests/**

Zero JavaScript — declarations only, and unreachable ones: no package's exports has a wildcard subpath, so no consumer loses a type.

What changed

publishedDtsOptions in packages/core now holds the option object all eight release builds repeated, with an exclude for *.stories.*, *.test.*, src/tests/** and e2e/**.

The globs cannot move into the shared tsconfig preset instead: its exclude governs tsc --noEmit as well, and that would stop type-checking the tests — the largest surface in the repo.

A story's helper still ships, deliberately. dev/createDocPropertiesJson.ts parses every .tsx under src/ and ignores only *.stories.tsx, so components/Button/stories/lib.tsx really does contribute five entries to the published dist/assets/doc-properties.json. The exclude therefore matches story and test files, not the directories around them.

@mittwald/flow-core becomes a declared devDependency of ext-bridge, remote-core and remote-elements, which newly import it — that is also the nx graph edge their build cache needs in order to invalidate when core changes.

Verified

build and test:compile green for all eight packages. Afterwards dist/types carries 18 story/test-ish files in components (down from 252 + 6) and 2 in remote-react-components (down from 196) — the remainder being real source modules: lib/vitest.ts, *.test-types.tsx, testData/** and the story helper above, all of them visible to the doc-properties generator.

🤖 Generated with Claude Code

`unplugin-dts` emits a declaration for everything its `include` matches, and
every release build passed `include: ["src"]` — so `*.stories.d.ts` and whole
test suites shipped. 196 of `@mittwald/flow-remote-react-components@1.1.10`'s
799 tarball entries were `dist/types/tests/**`, and `flow-react-components`
carried 126 story declarations plus their maps.

No consumer loses a type: no package's `exports` has a wildcard subpath, so
none of those declarations was reachable.

All eight release builds now share `publishedDtsOptions` from `packages/core`
instead of repeating the same option object. The globs cannot move into the
shared tsconfig preset instead — its `exclude` governs `tsc --noEmit` too, and
that would stop type-checking the tests.

A story's HELPER still ships, deliberately: `dev/createDocPropertiesJson.ts`
parses every `.tsx` under `src/` and ignores only `*.stories.tsx`, so
`components/Button/stories/lib.tsx` contributes five entries to the published
`dist/assets/doc-properties.json`.

`@mittwald/flow-core` becomes a declared devDependency of ext-bridge,
remote-core and remote-elements, which newly import it — that is also the nx
graph edge their build cache needs to invalidate on a core change.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Coverage Report for ./packages/components/

Status Category Percentage Covered / Total
🔵 Lines 78.69% 746 / 948
🔵 Statements 78.57% 763 / 971
🔵 Functions 80.09% 165 / 206
🔵 Branches 70.33% 377 / 536
File CoverageNo changed files found.
Generated in workflow #6611 for commit 8349936 by the Vitest Coverage Report Action

@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

🚀 Preview Deployment

Preview environments are ready:

Type URL
docs pr-3103.docs.review.flow-components.de
storybook pr-3103.storybook.review.flow-components.de

Images:

  • docs: ghcr.io/mittwald/flow/docs:pr-3103
  • storybook: ghcr.io/mittwald/flow/storybook:pr-3103

@mfal
mfal requested a review from ins0 September 2, 2026 13:14
@mfal
mfal marked this pull request as ready for review September 2, 2026 13:14
@mfal
mfal requested a review from a team September 2, 2026 13:14
@mfal
mfal merged commit bf947d9 into main Sep 4, 2026
22 checks passed
@mfal
mfal deleted the claude/dts-exclude-tests-stories branch September 4, 2026 07:39
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.

2 participants