Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(align-deps): introduce preset with New Arch packages
- Loading branch information
Showing
8 changed files
with
213 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
"@rnx-kit/align-deps": minor | ||
"@rnx-kit/dep-check-preset-react-native-new-arch": minor | ||
--- | ||
|
||
A containing only packages that are compatible with New Architecture |
47 changes: 47 additions & 0 deletions
47
incubator/dep-check-preset-react-native-new-arch/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# @rnx-kit/dep-check-preset-react-native-new-arch | ||
|
||
[![Build](https://github.com/microsoft/rnx-kit/actions/workflows/build.yml/badge.svg)](https://github.com/microsoft/rnx-kit/actions/workflows/build.yml) | ||
[![npm version](https://img.shields.io/npm/v/@rnx-kit/dep-check-preset-react-native-new-arch)](https://www.npmjs.com/package/@rnx-kit/dep-check-preset-react-native-new-arch) | ||
|
||
🚧🚧🚧🚧🚧🚧🚧🚧🚧🚧🚧 | ||
|
||
### This package is EXPERIMENTAL - USE WITH CAUTION | ||
|
||
🚧🚧🚧🚧🚧🚧🚧🚧🚧🚧🚧 | ||
|
||
A preset for | ||
[`@rnx-kit/dep-check`](https://github.com/microsoft/rnx-kit/tree/main/packages/dep-check#readme) | ||
containing only packages that are compatible with React Native New Architecture. | ||
|
||
## Install | ||
|
||
```sh | ||
npm add --save-dev @rnx-kit/dep-check @rnx-kit/dep-check-preset-react-native-new-arch | ||
``` | ||
|
||
## Usage | ||
|
||
Follow the instructions to initialize a new configuration if you haven't | ||
already: https://github.com/microsoft/rnx-kit/tree/main/packages/dep-check#usage | ||
|
||
Add this package to `customProfiles` in your `package.json`, e.g.: | ||
|
||
```diff | ||
{ | ||
"rnx-kit": { | ||
"reactNativeVersion": "^0.70", | ||
"reactNativeDevVersion": "^0.70", | ||
"capabilities": [ | ||
"core-android", | ||
"core-ios" | ||
], | ||
+ "customProfiles": "@rnx-kit/dep-check-preset-react-native-new-arch" | ||
} | ||
} | ||
``` | ||
|
||
Finally, run: | ||
|
||
``` | ||
yarn rnx-dep-check --vigilant 0.70 | ||
``` |
37 changes: 37 additions & 0 deletions
37
incubator/dep-check-preset-react-native-new-arch/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
{ | ||
"name": "@rnx-kit/dep-check-preset-react-native-new-arch", | ||
"version": "0.0.1", | ||
"description": "EXPERIMENTAL - USE WITH CAUTION - @rnx-kit/dep-check preset for New Architecture compatible packages", | ||
"homepage": "https://github.com/microsoft/rnx-kit/tree/main/incubator/dep-check-preset-react-native-new-arch#readme", | ||
"license": "MIT", | ||
"author": { | ||
"name": "Microsoft Open Source", | ||
"email": "microsoftopensource@users.noreply.github.com" | ||
}, | ||
"files": [ | ||
"src/*.js" | ||
], | ||
"main": "src/index.js", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/microsoft/rnx-kit", | ||
"directory": "incubator/dep-check-preset-react-native-new-arch" | ||
}, | ||
"scripts": { | ||
"build": "rnx-kit-scripts build", | ||
"format": "rnx-kit-scripts format" | ||
}, | ||
"devDependencies": { | ||
"@rnx-kit/dep-check": "*", | ||
"@rnx-kit/scripts": "*" | ||
}, | ||
"depcheck": { | ||
"ignoreMatches": [ | ||
"@rnx-kit/dep-check" | ||
] | ||
}, | ||
"eslintConfig": { | ||
"extends": "@rnx-kit/eslint-config" | ||
}, | ||
"experimental": true | ||
} |
49 changes: 49 additions & 0 deletions
49
incubator/dep-check-preset-react-native-new-arch/src/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
// @ts-check | ||
/** @type {Record<string, import("@rnx-kit/dep-check").Profile>} */ | ||
module.exports = { | ||
"0.70": { | ||
animation: { | ||
name: "react-native-reanimated", | ||
version: "^3.0.0-0", | ||
}, | ||
base64: null, | ||
checkbox: null, | ||
clipboard: null, | ||
"datetime-picker": null, | ||
filesystem: null, | ||
"floating-action": null, | ||
// gestures: already in the default profile | ||
html: null, | ||
"linear-gradient": { | ||
name: "rnx-gradient", | ||
version: "^0.1.0", | ||
}, | ||
"masked-view": null, | ||
modal: null, | ||
"navigation/native": null, | ||
"navigation/stack": null, | ||
netinfo: null, | ||
popover: null, | ||
"safe-area": { | ||
name: "react-native-safe-area-context", | ||
version: "^4.1.2", | ||
}, | ||
screens: { | ||
name: "react-native-screens", | ||
version: "^3.12.0", | ||
}, | ||
shimmer: null, | ||
slider: { | ||
name: "react-native-slider", | ||
version: "^4.3.0", | ||
}, | ||
sqlite: null, | ||
storage: null, | ||
svg: { | ||
name: "react-native-svg", | ||
version: "^13.0.0", | ||
}, | ||
// "test-app": already in the default profile, | ||
webview: null, | ||
}, | ||
}; |
7 changes: 7 additions & 0 deletions
7
incubator/dep-check-preset-react-native-new-arch/tsconfig.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"extends": "@rnx-kit/scripts/tsconfig-shared.json", | ||
"compilerOptions": { | ||
"noEmit": true | ||
}, | ||
"include": ["src/"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
packages/align-deps/src/presets/community/react-native-new-arch-only.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
54 changes: 54 additions & 0 deletions
54
packages/align-deps/src/presets/community/react-native-new-arch-only/profile-0.70.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
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", | ||
}, | ||
// gestures: already in the default profile | ||
// @ts-expect-error 'linear-gradient' is not a known capability | ||
"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.4.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; |