Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(dep-check): introduce preset with New Arch packages #1877

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/shy-lemons-wash.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rnx-kit/align-deps": minor
---

Added a preset containing only packages that are compatible with New Architecture
2 changes: 2 additions & 0 deletions packages/align-deps/src/index.ts
Original file line number Diff line number Diff line change
@@ -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,
};

Expand Down
3 changes: 3 additions & 0 deletions packages/align-deps/src/preset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand All @@ -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:
Expand Down
Original file line number Diff line number Diff line change
@@ -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<Preset> = {
"0.70": profile_0_70,
};

export default preset;
Original file line number Diff line number Diff line change
@@ -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;