@@ -35,7 +35,7 @@ function expectReactNativePeerDependency({Yarn}) {
35
35
/**
36
36
* Enforce that all @react-native/ scoped packages use the same version
37
37
* as the react-native peer dependency declared in react-native-macos.
38
- * On the main branch, enforce that we use workspace:* for @react-native/ packages.
38
+ * Enforce that we use workspace:* for @react-native/ packages.
39
39
* @param {Context } context
40
40
*/
41
41
function enforceReactNativeVersionConsistency ( { Yarn} ) {
@@ -60,18 +60,16 @@ function enforceReactNativeVersionConsistency({Yarn}) {
60
60
return ;
61
61
}
62
62
targetVersion = rnPeerDependency ;
63
- } // Enforce this version on all @react -native/ scoped packages across all workspaces
63
+ }
64
+ // Enforce this version on all @react -native/ scoped packages across all workspaces
64
65
for ( const dependency of Yarn . dependencies ( ) ) {
65
66
if ( dependency . ident . startsWith ( '@react-native/' ) ) {
66
- // Check if the target package is private (not published)
67
- const targetWorkspace = Yarn . workspace ( { ident : dependency . ident } ) ;
68
- const isPrivatePackage = targetWorkspace && targetWorkspace . manifest . private ;
69
-
70
- if ( isPrivatePackage ) {
71
- // Private packages should always use workspace:* since they're not published
67
+ Yarn . workspace ( { ident : dependency . ident } ) ?. set ( 'private' , true ) ;
68
+
69
+ // Don't use `workspace:*` for `react-native-macos` or `@react-native-macos/` scoped packages (AKA, packages we have forked
70
+ // until nx release with Yarn 4 supports it.
71
+ if ( dependency . workspace . ident !== 'react-native-macos' || dependency . workspace . ident . startsWith ( '@react-native-macos/' ) ) {
72
72
dependency . update ( 'workspace:*' ) ;
73
- } else {
74
- dependency . update ( targetVersion ) ;
75
73
}
76
74
}
77
75
}
0 commit comments