Skip to content
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
6 changes: 6 additions & 0 deletions .changeset/add-types-react-native-profile.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@rnx-kit/align-deps": patch
"@rnx-kit/types-kit-config": patch
---

Add React Native community type definitions to align-deps profiles through 0.70.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { baseCapabilities } from "./baseCapabilities.ts";
const reactNative: Package = {
name: "react-native",
version: "^0.61.5",
capabilities: ["react"],
capabilities: ["react", "types/react-native"],
};

export const profile: Profile = {
Expand Down Expand Up @@ -207,6 +207,11 @@ export const profile: Profile = {
version: "^0.11.4",
devOnly: true,
},
"types/react-native": {
name: "@types/react-native",
version: "^0.61.0",
devOnly: true,
},
webview: {
name: "react-native-webview",
version: "^11.0.3",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { profile as profile_0_61 } from "./profile-0.61.ts";
const reactNative: Package = {
name: "react-native",
version: "^0.62.3",
capabilities: ["react"],
capabilities: ["react", "types/react-native"],
};

export const profile: Profile = {
Expand Down Expand Up @@ -38,6 +38,11 @@ export const profile: Profile = {
version: "^0.62.0",
capabilities: ["core"],
},
"types/react-native": {
name: "@types/react-native",
version: "^0.62.0",
devOnly: true,
},

"babel-preset-react-native": {
name: "metro-react-native-babel-preset",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { profile as profile_0_62 } from "./profile-0.62.ts";
const reactNative: Package = {
name: "react-native",
version: "^0.63.2",
capabilities: ["react"],
capabilities: ["react", "types/react-native"],
};

export const profile: Profile = {
Expand Down Expand Up @@ -38,6 +38,11 @@ export const profile: Profile = {
version: "^0.63.0",
capabilities: ["core"],
},
"types/react-native": {
name: "@types/react-native",
version: "^0.63.0",
devOnly: true,
},

"babel-preset-react-native": {
name: "metro-react-native-babel-preset",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { profile as profile_0_63 } from "./profile-0.63.ts";
const reactNative: Package = {
name: "react-native",
version: "^0.64.2",
capabilities: ["react"],
capabilities: ["react", "types/react-native"],
};

export const profile: Profile = {
Expand Down Expand Up @@ -38,6 +38,11 @@ export const profile: Profile = {
version: "^0.64.0",
capabilities: ["core"],
},
"types/react-native": {
name: "@types/react-native",
version: "^0.64.0",
devOnly: true,
},

"babel-preset-react-native": {
name: "metro-react-native-babel-preset",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { profile as profile_0_64 } from "./profile-0.64.ts";
const reactNative: Package = {
name: "react-native",
version: "^0.65.0",
capabilities: ["react"],
capabilities: ["react", "types/react-native"],
};

export const profile: Profile = {
Expand Down Expand Up @@ -38,6 +38,11 @@ export const profile: Profile = {
version: "^0.65.0",
capabilities: ["core"],
},
"types/react-native": {
name: "@types/react-native",
version: "^0.65.0",
devOnly: true,
},

"babel-preset-react-native": {
name: "metro-react-native-babel-preset",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { profile as profile_0_65 } from "./profile-0.65.ts";
const reactNative: Package = {
name: "react-native",
version: "^0.66.0",
capabilities: ["react"],
capabilities: ["react", "types/react-native"],
};

export const profile: Profile = {
Expand Down Expand Up @@ -38,6 +38,11 @@ export const profile: Profile = {
version: "^0.66.0",
capabilities: ["core"],
},
"types/react-native": {
name: "@types/react-native",
version: "^0.66.0",
devOnly: true,
},

"babel-preset-react-native": {
name: "metro-react-native-babel-preset",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { profile as profile_0_66 } from "./profile-0.66.ts";
const reactNative: Package = {
name: "react-native",
version: "^0.67.0",
capabilities: ["react"],
capabilities: ["react", "types/react-native"],
};

export const profile: Profile = {
Expand Down Expand Up @@ -38,6 +38,11 @@ export const profile: Profile = {
version: "^0.67.0",
capabilities: ["core"],
},
"types/react-native": {
name: "@types/react-native",
version: "^0.67.0",
devOnly: true,
},

animation: {
name: "react-native-reanimated",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { profile as profile_0_67 } from "./profile-0.67.ts";
const reactNative: Package = {
name: "react-native",
version: "^0.68.0",
capabilities: ["react"],
capabilities: ["react", "types/react-native"],
};

export const profile: Profile = {
Expand Down Expand Up @@ -38,6 +38,11 @@ export const profile: Profile = {
version: "^0.68.0",
capabilities: ["core"],
},
"types/react-native": {
name: "@types/react-native",
version: "^0.68.0",
devOnly: true,
},

"babel-preset-react-native": {
name: "metro-react-native-babel-preset",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { profile as profile_0_68 } from "./profile-0.68.ts";
const reactNative: Package = {
name: "react-native",
version: "^0.69.0",
capabilities: ["react"],
capabilities: ["react", "types/react-native"],
};

export const profile: Profile = {
Expand Down Expand Up @@ -38,6 +38,11 @@ export const profile: Profile = {
version: "^0.69.0",
capabilities: ["core"],
},
"types/react-native": {
name: "@types/react-native",
version: "^0.69.0",
devOnly: true,
},

"babel-preset-react-native": {
name: "metro-react-native-babel-preset",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { profile as profile_0_69 } from "./profile-0.69.ts";
const reactNative: Package = {
name: "react-native",
version: "^0.70.0",
capabilities: ["react"],
capabilities: ["react", "types/react-native"],
};

export const profile: Profile = {
Expand Down Expand Up @@ -38,6 +38,11 @@ export const profile: Profile = {
version: "^0.70.0",
capabilities: ["core"],
},
"types/react-native": {
name: "@types/react-native",
version: "^0.70.0",
devOnly: true,
},

"babel-preset-react-native": {
name: "metro-react-native-babel-preset",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ export const profile: Profile = {
version: "^0.71.0",
capabilities: ["core"],
},
"types/react-native": {
name: "#meta",
capabilities: [],
devOnly: true,
},

"babel-preset-react-native": {
name: "metro-react-native-babel-preset",
Expand Down
41 changes: 41 additions & 0 deletions packages/align-deps/test/capabilities.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import { preset as defaultPreset } from "../src/presets/microsoft/react-native.t
import { profile as profile_0_62 } from "../src/presets/microsoft/react-native/profile-0.62.ts";
import { profile as profile_0_63 } from "../src/presets/microsoft/react-native/profile-0.63.ts";
import { profile as profile_0_64 } from "../src/presets/microsoft/react-native/profile-0.64.ts";
import { profile as profile_0_70 } from "../src/presets/microsoft/react-native/profile-0.70.ts";
import { profile as profile_0_71 } from "../src/presets/microsoft/react-native/profile-0.71.ts";
import type { Preset } from "../src/types.ts";
import { pickPackage } from "./helpers.ts";

Expand Down Expand Up @@ -129,10 +131,12 @@ describe("resolveCapabilities()", () => {
const { name } = profile_0_64["core"];
const { name: reactName } = profile_0_64["react"];
const { name: testAppName } = profile_0_64["test-app"];
const { name: typesName } = profile_0_64["types/react-native"];
deepEqual(packages, {
[name]: [profile_0_64["core"]],
[reactName]: [profile_0_64["react"]],
[testAppName]: [profile_0_64["test-app"]],
[typesName]: [profile_0_64["types/react-native"]],
});

equal(consoleWarnSpy.mock.callCount(), 0);
Expand Down Expand Up @@ -202,6 +206,10 @@ describe("resolveCapabilities()", () => {
});

deepEqual(packages, {
"@types/react-native": [
pickPackage(profile_0_63, "types/react-native"),
pickPackage(profile_0_64, "types/react-native"),
],
react: [
pickPackage(profile_0_63, "react"),
pickPackage(profile_0_64, "react"),
Expand All @@ -219,6 +227,37 @@ describe("resolveCapabilities()", () => {
equal(consoleWarnSpy.mock.callCount(), 0);
});

it("resolves React Native community type definitions for pre-0.71 profiles", (t) => {
const consoleWarnSpy = t.mock.method(console, "warn", () => undefined);

const packages = resolveCapabilities("package.json", ["core"], {
"0.70": profile_0_70,
});

deepEqual(packages, {
"@types/react-native": [pickPackage(profile_0_70, "types/react-native")],
react: [pickPackage(profile_0_70, "react")],
"react-native": [pickPackage(profile_0_70, "core")],
});

equal(consoleWarnSpy.mock.callCount(), 0);
});

it("does not resolve React Native community type definitions for 0.71 profiles", (t) => {
const consoleWarnSpy = t.mock.method(console, "warn", () => undefined);

const packages = resolveCapabilities("package.json", ["core"], {
"0.71": profile_0_71,
});

deepEqual(packages, {
react: [pickPackage(profile_0_71, "react")],
"react-native": [pickPackage(profile_0_71, "core")],
});

equal(consoleWarnSpy.mock.callCount(), 0);
});

it("resolves meta packages", () => {
const preset = filterPreset(
mergePresets(defaultPreset, {
Expand All @@ -244,6 +283,7 @@ describe("resolveCapabilities()", () => {
);

deepEqual(packages, {
"@types/react-native": [pickPackage(profile_0_64, "types/react-native")],
react: [pickPackage(profile_0_64, "react")],
"react-native": [pickPackage(profile_0_64, "core")],
"react-native-macos": [pickPackage(profile_0_64, "core-macos")],
Expand Down Expand Up @@ -279,6 +319,7 @@ describe("resolveCapabilities()", () => {
);

deepEqual(packages, {
"@types/react-native": [pickPackage(profile_0_64, "types/react-native")],
react: [pickPackage(profile_0_64, "react")],
"react-native": [pickPackage(profile_0_64, "core")],
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
exports[`checkPackageManifest({ kitType: 'app' }) (backwards compatibility) > adds required dependencies 1`] = `
"{\\n \\"name\\": \\"awesome-repo\\",\\n \\"version\\": \\"1.0.0\\",\\n \\"dependencies\\": {\\n \\"@react-native-async-storage/async-storage\\": \\"^1.17.10\\",\\n \\"@react-native-community/netinfo\\": \\"^9.0.0\\",\\n \\"@rnx-kit/react-native-lazy-index\\": \\"^2.1.7\\",\\n \\"conan\\": \\"1.0.0\\",\\n \\"quaid\\": \\"1.0.0\\",\\n \\"react\\": \\"18.1.0\\",\\n \\"react-native\\": \\"^0.70.0\\",\\n \\"react-native-reanimated\\": \\"^2.10.0\\",\\n \\"react-native-webview\\": \\"^11.23.0\\"\\n },\\n \\"engines\\": {\\n \\"node\\": \\"Do not install; for testing purposes only\\"\\n },\\n \\"rnx-kit\\": {\\n \\"reactNativeVersion\\": \\"^0.70\\",\\n \\"kitType\\": \\"app\\",\\n \\"capabilities\\": [\\n \\"core-android\\",\\n \\"hermes\\",\\n \\"lazy-index\\"\\n ]\\n }\\n}\\n"
"{\\n \\"name\\": \\"awesome-repo\\",\\n \\"version\\": \\"1.0.0\\",\\n \\"dependencies\\": {\\n \\"@react-native-async-storage/async-storage\\": \\"^1.17.10\\",\\n \\"@react-native-community/netinfo\\": \\"^9.0.0\\",\\n \\"@rnx-kit/react-native-lazy-index\\": \\"^2.1.7\\",\\n \\"conan\\": \\"1.0.0\\",\\n \\"quaid\\": \\"1.0.0\\",\\n \\"react\\": \\"18.1.0\\",\\n \\"react-native\\": \\"^0.70.0\\",\\n \\"react-native-reanimated\\": \\"^2.10.0\\",\\n \\"react-native-webview\\": \\"^11.23.0\\"\\n },\\n \\"engines\\": {\\n \\"node\\": \\"Do not install; for testing purposes only\\"\\n },\\n \\"rnx-kit\\": {\\n \\"reactNativeVersion\\": \\"^0.70\\",\\n \\"kitType\\": \\"app\\",\\n \\"capabilities\\": [\\n \\"core-android\\",\\n \\"hermes\\",\\n \\"lazy-index\\"\\n ]\\n },\\n \\"devDependencies\\": {\\n \\"@types/react-native\\": \\"^0.70.0\\"\\n }\\n}\\n"
`;
Loading