diff --git a/packages/core-cli-utils/README.md b/packages/core-cli-utils/README.md index 151cdeef757568..10ea4acc75709f 100644 --- a/packages/core-cli-utils/README.md +++ b/packages/core-cli-utils/README.md @@ -47,6 +47,9 @@ $ ./fancy-framework android clean Gradle: .... ``` +## Features +- `"@react-native/core-cli-utils/version.js"` contains the platform and tooling version requirements for react-native. + ## Contributing Changes to this package can be made locally and linked against your app. Please see the [Contributing guide](https://reactnative.dev/contributing/overview#contributing-code). diff --git a/packages/core-cli-utils/package.json b/packages/core-cli-utils/package.json index 056d43745bfda0..7e6b9666ff076b 100644 --- a/packages/core-cli-utils/package.json +++ b/packages/core-cli-utils/package.json @@ -11,7 +11,8 @@ }, "exports": { ".": "./src/index.js", - "./package.json": "./package.json" + "./package.json": "./package.json", + "./version.js": "./src/public/version.js" }, "types": "./dist/index.d.ts", "homepage": "https://github.com/facebook/react-native/tree/HEAD/packages/core-cli-utils#readme", diff --git a/packages/core-cli-utils/src/index.js b/packages/core-cli-utils/src/index.js index cf3797ac6189ef..2870640d6eb831 100644 --- a/packages/core-cli-utils/src/index.js +++ b/packages/core-cli-utils/src/index.js @@ -12,12 +12,17 @@ import {tasks as android} from './private/android.js'; import {tasks as apple} from './private/apple.js'; import {tasks as clean} from './private/clean.js'; +import * as version from './public/version.js'; /* eslint sort-keys : "error" */ export default { + // Platforms android: typeof android, apple: typeof apple, clean: typeof clean, + + // Meta + version: typeof version, }; export type {Task} from './private/types'; diff --git a/packages/core-cli-utils/src/public/version.js b/packages/core-cli-utils/src/public/version.js new file mode 100644 index 00000000000000..4a8d68333326ff --- /dev/null +++ b/packages/core-cli-utils/src/public/version.js @@ -0,0 +1,53 @@ +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @flow strict-local + * @format + * @oncall react_native + */ + +// Usage: +// +// > const semver = require('semver'); +// > semver.satisfies(process.env.ANDROID_SDK, android.ANDROID_SDK); +// true +// +// The version of @react-native/core-cli-utils matches a particular version +// of react-native. For example: +// +// > npm info @react-native/core-cli-util@latest --json | jq '.version' +// > "0.75.0" +// +// Means that: +// > require('@react-native/core-cli-utils/versions.js').apple.XCODE +// > ">= 12.x" +// +// For react-native@0.75.0 you have to have a version of XCode >= 12 + +export const android = { + ANDROID_NDK: '>= 23.x', + ANDROID_SDK: '>= 33.x', +}; + +export const apple = { + COCOAPODS: '>= 1.10.0', + XCODE: '>= 12.x', +}; + +export const common = { + BUN: '>= 1.0.0', + JAVA: '>= 17 <= 20', + NODE_JS: '>= 18', + NPM: '>= 4.x', + RUBY: '>= 2.6.10', + YARN: '>= 1.10.x', +}; + +export const all = { + ...apple, + ...android, + ...common, +};