Skip to content

Commit 4e3c0e1

Browse files
committed
fix: restore prebuilt rn core
1 parent 0ab3a98 commit 4e3c0e1

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

packages/cli/src/brownfield/utils/supportsPrebuiltRNCore.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
import { getReactNativeVersion, versionCompare } from '@rock-js/tools';
2+
import { getExpoSdkMajor, isExpoProject } from './project.js';
23

34
/** Minimum RN version that can opt in to prebuilts via `--use-prebuilt-rn-core`. */
45
export const MIN_REACT_NATIVE_VERSION_FOR_OPT_IN_PREBUILT_RN_CORE = '0.81.0';
56
/** Minimum RN version where Brownfield enables prebuilts by default (vanilla projects). */
67
export const MIN_REACT_NATIVE_VERSION_FOR_PREBUILT_RN_CORE_BY_DEFAULT =
78
'0.84.0';
9+
export const MIN_EXPO_SDK_MAJOR_FOR_PREBUILT_RN_CORE_BY_DEFAULT = 55;
10+
811
export type PrebuiltRNCoreSupportResult =
912
| { supported: true; enabledByDefault: boolean; reason?: never }
1013
| { supported: false; enabledByDefault?: never; reason: string };
@@ -36,6 +39,23 @@ export function supportsPrebuiltRNCore({
3639
};
3740
}
3841

42+
if (isExpoProject(projectRoot)) {
43+
const expoSdkMajor = getExpoSdkMajor(projectRoot);
44+
45+
if (
46+
expoSdkMajor === null ||
47+
expoSdkMajor < MIN_EXPO_SDK_MAJOR_FOR_PREBUILT_RN_CORE_BY_DEFAULT
48+
) {
49+
const sdkLabel = expoSdkMajor === null ? 'unknown' : String(expoSdkMajor);
50+
return {
51+
supported: false,
52+
reason: `--use-prebuilt-rn-core is unsupported in Expo SDK ${sdkLabel}: packaging brownfield with prebuilts requires Expo SDK ${MIN_EXPO_SDK_MAJOR_FOR_PREBUILT_RN_CORE_BY_DEFAULT} or newer.`,
53+
};
54+
}
55+
56+
return { supported: true, enabledByDefault: true };
57+
}
58+
3959
const enabledByDefault =
4060
versionCompare(
4161
reactNativeVersion,

0 commit comments

Comments
 (0)