fix(components): keep tests and stories out of the published types - #3103
Merged
Conversation
`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>
Contributor
Coverage Report for ./packages/components/
File CoverageNo changed files found. |
Contributor
🚀 Preview DeploymentPreview environments are ready:
Images:
|
Lisa18289
approved these changes
Sep 4, 2026
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.
unplugin-dtsemits a declaration for everything itsincludematches, and all eight release builds passedinclude: ["src"]. So story and test declarations shipped:@mittwald/flow-react-components*.stories.d.ts+ 126 maps@mittwald/flow-remote-react-componentsdist/types/tests/**Zero JavaScript — declarations only, and unreachable ones: no package's
exportshas a wildcard subpath, so no consumer loses a type.What changed
publishedDtsOptionsinpackages/corenow holds the option object all eight release builds repeated, with anexcludefor*.stories.*,*.test.*,src/tests/**ande2e/**.The globs cannot move into the shared tsconfig preset instead: its
excludegovernstsc --noEmitas well, and that would stop type-checking the tests — the largest surface in the repo.A story's helper still ships, deliberately.
dev/createDocPropertiesJson.tsparses every.tsxundersrc/and ignores only*.stories.tsx, socomponents/Button/stories/lib.tsxreally does contribute five entries to the publisheddist/assets/doc-properties.json. The exclude therefore matches story and test files, not the directories around them.@mittwald/flow-corebecomes a declared devDependency ofext-bridge,remote-coreandremote-elements, which newly import it — that is also the nx graph edge their build cache needs in order to invalidate whencorechanges.Verified
buildandtest:compilegreen for all eight packages. Afterwardsdist/typescarries 18 story/test-ish files incomponents(down from 252 + 6) and 2 inremote-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