feat: Add unified fluentui-react-native mono-package with subpath exports and migration codemod#4066
Draft
Saadnajmi wants to merge 7 commits intomicrosoft:mainfrom
Draft
feat: Add unified fluentui-react-native mono-package with subpath exports and migration codemod#4066Saadnajmi wants to merge 7 commits intomicrosoft:mainfrom
Saadnajmi wants to merge 7 commits intomicrosoft:mainfrom
Conversation
- New jscodeshift transform: migrate-to-mono-package - Rewrites @fluentui-react-native/* and @uifabricshared/* to fluentui-react-native/* - Decomposes @fluentui/react-native barrel into per-package subpath imports - Replaces yargs with Node built-in parseArgs - Includes test fixtures covering scoped, barrel, require(), and skip cases
|
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.
Summary
Introduces a new unified mono-package (
fluentui-react-native) that re-exports every publishable package in the monorepo via subpath exports. Consumers only need a single dependency and a single version number.Also includes a jscodeshift codemod that automates migration of both source imports and
package.jsondependencies, and demonstrates the migration ontester-core(155 files).Motivation
Today, consumers must track ~70 individual
@fluentui-react-native/*packages with independent version numbers. This makes upgrades painful andpackage.jsonfiles unwieldy. A singlefluentui-react-nativepackage with subpath imports gives consumers one dependency to manage while preserving tree-shaking.What's included
1. Mono-package (
packages/libraries/fluentui-react-native/)src/.tsre-export files; consumers' bundlers (Metro, Webpack) compile them as part of the app build"type": "module","sideEffects": false) for optimal tree-shakingupdate-exports.mtsdiscovers all publishable packages, generatessrc/files, and updatespackage.jsonexports/dependenciescheck-exportstask inlage buildcifails if any publishable package is missingUsage:
2. Migration codemod (
packages/codemods/)A jscodeshift transform +
package.jsonmigration tool:@fluentui-react-native/*,@fluentui/react-native, and@uifabricshared/*imports tofluentui-react-native/<subpath>import { Button, Theme } from '@fluentui/react-native'into per-symbol subpath importspackage.jsonmigration: removes individual scoped dependencies, adds singlefluentui-react-nativedependencyimportandrequire()syntax3. tester-core migration (demonstration)
@fluentui-react-native/*imports tofluentui-react-native/*subpathspackage.json, replaced with singlefluentui-react-native"type": "module") since the mono-package is ESM-only4. Build system changes
lage.config.mjs: Addedcheck-exportstask to thebuildcipipelinelintPackage.ts: Skip"."export validation for subpath-only packages; skip default entry enforcement when source file doesn't existbuildConfig.ts: Suppress CJS build for packages without amainfield (not justtype: modulepackages)fluent-tester,win32,win32-81): Usemodule: esnext/moduleResolution: bundlerto support ESM tester-core dependency; removed unnecessarybuild-cjsDesign decisions
fluentui-react-native)fluentui-react-native/buttonvs@fluentui-react-native/mono/button.tsexports (no lib/)@ts-nocheckyarn update-exportsTesting
yarn lage buildcipasses (build, lint, format, depcheck, lint-package, check-exports, check-publishing)update-exports.mts --checkvalidates all src/ files and package.json fieldsMigration guide
Existing consumers can migrate incrementally:
yarn add fluentui-react-nativeyarn migrate-to-mono-package --path src/The individual
@fluentui-react-native/*packages continue to be published — this is additive, not breaking.