diff --git a/.changeset/shy-lemons-wash.md b/.changeset/shy-lemons-wash.md new file mode 100644 index 0000000000..f689a35ccd --- /dev/null +++ b/.changeset/shy-lemons-wash.md @@ -0,0 +1,5 @@ +--- +"@rnx-kit/align-deps": minor +--- + +Added a preset containing only packages that are compatible with New Architecture diff --git a/packages/align-deps/src/index.ts b/packages/align-deps/src/index.ts index 2128085313..404696c4b3 100644 --- a/packages/align-deps/src/index.ts +++ b/packages/align-deps/src/index.ts @@ -1,6 +1,8 @@ +import { preset as communityReactNativeNewArchOnlyPreset } from "./presets/community/react-native-new-arch-only"; import { preset as reactNativePreset } from "./presets/microsoft/react-native"; export const presets = { + "community/react-native-new-arch-only": communityReactNativeNewArchOnlyPreset, "microsoft/react-native": reactNativePreset, }; diff --git a/packages/align-deps/src/preset.ts b/packages/align-deps/src/preset.ts index a85708f32f..0d0b180889 100644 --- a/packages/align-deps/src/preset.ts +++ b/packages/align-deps/src/preset.ts @@ -3,6 +3,7 @@ import semverCoerce from "semver/functions/coerce"; import semverSatisfies from "semver/functions/satisfies"; import semverValidRange from "semver/ranges/valid"; import { gatherRequirements } from "./dependencies"; +import { preset as communityReactNativeNewArchOnlyPreset } from "./presets/community/react-native-new-arch-only"; import { preset as reactNativePreset } from "./presets/microsoft/react-native"; import type { AlignDepsConfig, Options, Preset } from "./types"; @@ -26,6 +27,8 @@ function loadPreset( resolve = require.resolve ): Preset { switch (preset) { + case "community/react-native-new-arch-only": + return communityReactNativeNewArchOnlyPreset; case "microsoft/react-native": return reactNativePreset; default: diff --git a/packages/align-deps/src/presets/community/react-native-new-arch-only.ts b/packages/align-deps/src/presets/community/react-native-new-arch-only.ts new file mode 100644 index 0000000000..85d82405ac --- /dev/null +++ b/packages/align-deps/src/presets/community/react-native-new-arch-only.ts @@ -0,0 +1,11 @@ +import type { Preset } from "../../types"; +import profile_0_70 from "./react-native-new-arch-only/profile-0.70"; + +// Also export this by name for scripts to work around a bug where this module +// is wrapped twice, i.e. `{ default: { default: preset } }`, when imported as +// ESM. +export const preset: Readonly = { + "0.70": profile_0_70, +}; + +export default preset; diff --git a/packages/align-deps/src/presets/community/react-native-new-arch-only/profile-0.70.ts b/packages/align-deps/src/presets/community/react-native-new-arch-only/profile-0.70.ts new file mode 100644 index 0000000000..7a8abbd109 --- /dev/null +++ b/packages/align-deps/src/presets/community/react-native-new-arch-only/profile-0.70.ts @@ -0,0 +1,58 @@ +import type { Capability } from "@rnx-kit/config"; +import type { Profile } from "../../../types"; +import profile_0_70 from "../../microsoft/react-native/profile-0.70"; + +const profile: Profile = { + ...profile_0_70, + animation: { + name: "react-native-reanimated", + version: "^3.0.0-0", + }, + // @ts-expect-error 'blur' is not a known capability + "blur": { + name: "@react-native-community/blur", + version: "^4.3.0", + }, + // gestures: already in the default profile + "linear-gradient": { + name: "rnx-gradient", + version: "^0.1.0", + }, + // safe-area: already in the default profile + // screens: already in the default profile + slider: { + name: "react-native-slider", + version: "^4.3.1", + }, + svg: { + name: "react-native-svg", + version: "^13.5.0", + }, + // "test-app": already in the default profile, +}; + +const unsupportedCapabilities: Capability[] = [ + "base64", + "checkbox", + "clipboard", + "datetime-picker", + "filesystem", + "floating-action", + "html", + "masked-view", + "modal", + "navigation/native", + "navigation/stack", + "netinfo", + "popover", + "shimmer", + "sqlite", + "storage", + "webview", +]; + +unsupportedCapabilities.forEach((capability) => { + delete profile[capability]; +}); + +export default profile;