Skip to content

Commit 8acac29

Browse files
Saadnajmiclaude
andauthored
fix(0.81): fix yarn constraints failures after release bumps (#2909)
## Summary - Mark root `@react-native-macos/monorepo` and `@react-native-macos/nx-release-version` packages as `private: true` with a fixed version of `1000.0.0` - Add `enforceReactNativeMacosPrivatePackageVersion` yarn constraint to enforce this - Decouples internal packages from release versioning — nx release only bumps `react-native-macos` and `@react-native-macos/virtualized-lists`, so these internal packages were getting left behind and causing `yarn constraints` to fail after every release ## Test plan - [x] `yarn constraints` passes locally 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 8f151ff commit 8acac29

File tree

3 files changed

+20
-22
lines changed

3 files changed

+20
-22
lines changed

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"name": "@react-native-macos/monorepo",
3-
"version": "0.81.5",
3+
"private": true,
4+
"version": "1000.0.0",
45
"license": "MIT",
56
"packageManager": "yarn@4.13.0",
67
"scripts": {

packages/nx-release-version/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@react-native-macos/nx-release-version",
3-
"version": "0.1.0",
43
"private": true,
4+
"version": "1000.0.0",
55
"description": "Nx Release Version Actions for React Native macOS",
66
"homepage": "https://github.com/microsoft/react-native-macos/tree/HEAD/packages/nx-release-version#readme",
77
"license": "MIT",

yarn.config.cjs

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,22 @@ function enforceReactNativeMacosVersionConsistency({Yarn}) {
137137
}
138138
}
139139

140+
/**
141+
* Enforce that all private @react-native-macos/ scoped packages use a fixed
142+
* version of 1000.0.0, so they are decoupled from release versioning.
143+
* @param {Context} context
144+
*/
145+
function enforceReactNativeMacosPrivatePackageVersion({Yarn}) {
146+
for (const workspace of Yarn.workspaces()) {
147+
const isReactNativeMacosScoped = workspace.ident && workspace.ident.startsWith('@react-native-macos/');
148+
const isPrivate = workspace.manifest.private;
149+
150+
if (isReactNativeMacosScoped && isPrivate) {
151+
workspace.set('version', '1000.0.0');
152+
}
153+
}
154+
}
155+
140156
/**
141157
* Enforce that all @react-native-macos/ scoped dependencies use the same version
142158
* as the react-native-macos
@@ -158,32 +174,13 @@ function enforceReactNativeMacOSDependencyConsistency({Yarn}) {
158174
}
159175
}
160176

161-
/**
162-
* Enforce that private @react-native-macos/ scoped packages (i.e. internal
163-
* tooling that is not forked from upstream) have a fixed version of 0.1.0.
164-
* These packages do not track the react-native-macos release version.
165-
* @param {Context} context
166-
*/
167-
function enforceReactNativeMacosPrivatePackageVersion({Yarn}) {
168-
if (!isMainBranch({Yarn})) {
169-
for (const workspace of Yarn.workspaces()) {
170-
const isReactNativeMacosScoped = workspace.ident?.startsWith('@react-native-macos/');
171-
const isPrivate = workspace.manifest.private;
172-
173-
if (isReactNativeMacosScoped && isPrivate) {
174-
workspace.set('version', '0.1.0');
175-
}
176-
}
177-
}
178-
}
179-
180177
module.exports = defineConfig({
181178
constraints: async ctx => {
182179
enforcePrivateReactNativeScopedPackages(ctx);
183180
enforceReactNativeVersionConsistency(ctx);
184181
enforceReactNativeDependencyConsistency(ctx);
185182
enforceReactNativeMacosVersionConsistency(ctx);
186-
enforceReactNativeMacOSDependencyConsistency(ctx);
187183
enforceReactNativeMacosPrivatePackageVersion(ctx);
184+
enforceReactNativeMacOSDependencyConsistency(ctx);
188185
},
189186
});

0 commit comments

Comments
 (0)