Skip to content

Commit

Permalink
feat(align-deps): introduce preset with New Arch packages
Browse files Browse the repository at this point in the history
  • Loading branch information
tido64 committed Nov 11, 2022
1 parent 88276b4 commit e8b706b
Show file tree
Hide file tree
Showing 5 changed files with 79 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .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
2 changes: 2 additions & 0 deletions 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,
};

Expand Down
3 changes: 3 additions & 0 deletions packages/align-deps/src/preset.ts
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
@@ -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;
@@ -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;

0 comments on commit e8b706b

Please sign in to comment.