Skip to content

Commit

Permalink
fix(align-deps): add profile for 0.74 (#2992)
Browse files Browse the repository at this point in the history
  • Loading branch information
tido64 committed Apr 15, 2024
1 parent 4fc7aeb commit 4b8a674
Show file tree
Hide file tree
Showing 9 changed files with 223 additions and 77 deletions.
5 changes: 5 additions & 0 deletions .changeset/forty-peas-change.md
@@ -0,0 +1,5 @@
---
"@rnx-kit/align-deps": patch
---

Added profile for react-native 0.74
98 changes: 49 additions & 49 deletions packages/align-deps/README.md

Large diffs are not rendered by default.

54 changes: 29 additions & 25 deletions packages/align-deps/scripts/update-profile.mjs
@@ -1,7 +1,6 @@
#!/usr/bin/env node
// @ts-check

import { markdownTable } from "markdown-table";
import * as fs from "node:fs";
import * as path from "node:path";
import { URL } from "node:url";
Expand All @@ -23,6 +22,13 @@ import semverCompare from "semver/functions/compare.js";
* dependencies?: Record<string, string>;
* peerDependencies?: Record<string, string>;
* }} PackageInfo
*
* @typedef {{
* Name: string;
* Version: string;
* Latest: string;
* Homepage?: string;
* }} TableRow
*/

/**
Expand Down Expand Up @@ -470,11 +476,15 @@ async function main({

const ignoredCapabilities = [
"babel-preset-react-native",
"community/cli",
"community/cli-android",
"community/cli-ios",
"core",
"core-android",
"core-ios",
"core-macos",
"core-windows",
"core/metro-config",
"hermes",
"metro",
"metro-config",
Expand All @@ -487,40 +497,34 @@ async function main({
"react-test-renderer",
];

/** @type {Record<string, PackageInfo>} */
const delta = {};
/** @type {[string, TableRow][]} */
const delta = [];
await Promise.all(
Object.entries(latestProfile)
.filter(([capability]) => {
return !ignoredCapabilities.includes(capability);
})
.filter(([capability]) => !ignoredCapabilities.includes(capability))
.map(async ([capability, pkg]) => {
await fetchPackageInfo(pkg).then((info) => {
if (info) {
delta[capability] = info;
const { name, version, latest, modified, homepage } = info;
delta.push([
capability,
{
Name: name,
Version: version,
Latest: version.endsWith(latest)
? "="
: `${latest} (${modified.split("T")[0]})`,
Homepage: homepage,
},
]);
}
});
})
);

const table = markdownTable([
["Capability", "Name", "Version", "Latest", "Homepage"],
...Object.keys(delta)
.sort()
.map((capability) => {
const { name, version, latest, modified, homepage } = delta[capability];
return [
capability,
name,
version,
version.endsWith(latest)
? "="
: `${latest} (${modified.split("T")[0]})`,
homepage,
];
}),
]);
console.log(table);
const collator = new Intl.Collator();
delta.sort((lhs, rhs) => collator.compare(lhs[0], rhs[0]));
console.table(Object.fromEntries(delta));
}

const options = (() => {
Expand Down
2 changes: 2 additions & 0 deletions packages/align-deps/src/presets/microsoft/react-native.ts
Expand Up @@ -12,6 +12,7 @@ import { profile as profile_0_70 } from "./react-native/profile-0.70";
import { profile as profile_0_71 } from "./react-native/profile-0.71";
import { profile as profile_0_72 } from "./react-native/profile-0.72";
import { profile as profile_0_73 } from "./react-native/profile-0.73";
import { profile as profile_0_74 } from "./react-native/profile-0.74";

// 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
Expand All @@ -30,4 +31,5 @@ export const preset: Readonly<Preset> = {
"0.71": profile_0_71,
"0.72": profile_0_72,
"0.73": profile_0_73,
"0.74": profile_0_74,
};
Expand Up @@ -108,6 +108,11 @@ export const profile: Profile = {
name: "@react-native-masked-view/masked-view",
version: "^0.3.0",
},
"navigation/stack": {
name: "@react-navigation/stack",
version: "^6.3.21",
capabilities: ["navigation/native"],
},
netinfo: {
name: "@react-native-community/netinfo",
version: "^11.0.1",
Expand Down Expand Up @@ -135,6 +140,6 @@ export const profile: Profile = {
},
webview: {
name: "react-native-webview",
version: "^13.6.1",
version: "^13.7.2",
},
};
127 changes: 127 additions & 0 deletions packages/align-deps/src/presets/microsoft/react-native/profile-0.74.ts
@@ -0,0 +1,127 @@
import type { Package, Profile } from "../../../types";
import { profile as profile_0_73 } from "./profile-0.73";

const reactNative: Package = {
name: "react-native",
version: "^0.74.0",
capabilities: ["react", "core/metro-config"],
};

export const profile: Profile = {
...profile_0_73,
react: {
name: "react",
version: "18.2.0",
},
"react-dom": {
name: "react-dom",
version: "^18.2.0",
capabilities: ["react"],
},
"react-test-renderer": {
name: "react-test-renderer",
version: "18.2.0",
capabilities: ["react"],
devOnly: true,
},

core: reactNative,
"core-android": reactNative,
"core-ios": reactNative,
"core-macos": {
name: "react-native-macos",
version: "^0.74.0",
capabilities: ["react"],
},
"core-windows": {
name: "react-native-windows",
version: "^0.74.0",
capabilities: ["core"],
},
"core/metro-config": {
name: "@react-native/metro-config",
version: "^0.74.0",
devOnly: true,
},

"babel-preset-react-native": {
name: "@react-native/babel-preset",
version: "^0.74.0",
devOnly: true,
},
"community/cli": {
name: "@react-native-community/cli",
version: "^13.6.4",
capabilities: ["community/cli-android", "community/cli-ios"],
devOnly: true,
},
"community/cli-android": {
name: "@react-native-community/cli-platform-android",
version: "^13.6.4",
devOnly: true,
},
"community/cli-ios": {
name: "@react-native-community/cli-platform-ios",
version: "^13.6.4",
devOnly: true,
},
metro: {
name: "metro",
version: "^0.80.3",
devOnly: true,
},
"metro-config": {
name: "metro-config",
version: "^0.80.3",
devOnly: true,
},
"metro-core": {
name: "metro-core",
version: "^0.80.3",
devOnly: true,
},
"metro-react-native-babel-transformer": {
name: "@react-native/metro-babel-transformer",
version: "^0.74.0",
devOnly: true,
},
"metro-resolver": {
name: "metro-resolver",
version: "^0.80.3",
devOnly: true,
},
"metro-runtime": {
name: "metro-runtime",
version: "^0.80.3",
devOnly: true,
},

"datetime-picker": {
name: "@react-native-community/datetimepicker",
version: "^7.6.4",
},
netinfo: {
name: "@react-native-community/netinfo",
version: "^11.3.1",
},
screens: {
name: "react-native-screens",
version: "^3.31.0",
},
storage: {
name: "@react-native-async-storage/async-storage",
version: "^1.22.3",
},
svg: {
name: "react-native-svg",
version: "^15.2.0",
},
"test-app": {
name: "react-native-test-app",
version: "^3.5.0",
},
webview: {
name: "react-native-webview",
version: "^13.8.4",
},
};
3 changes: 3 additions & 0 deletions packages/align-deps/test/preset.test.ts
Expand Up @@ -6,6 +6,7 @@ import { profile as profile_0_70 } from "../src/presets/microsoft/react-native/p
import { profile as profile_0_71 } from "../src/presets/microsoft/react-native/profile-0.71";
import { profile as profile_0_72 } from "../src/presets/microsoft/react-native/profile-0.72";
import { profile as profile_0_73 } from "../src/presets/microsoft/react-native/profile-0.73";
import { profile as profile_0_74 } from "../src/presets/microsoft/react-native/profile-0.74";

describe("filterPreset()", () => {
test("returns no profiles if requirements cannot be satisfied", () => {
Expand Down Expand Up @@ -35,6 +36,7 @@ describe("filterPreset()", () => {
"0.71": profile_0_71,
"0.72": profile_0_72,
"0.73": profile_0_73,
"0.74": profile_0_74,
});
});

Expand All @@ -46,6 +48,7 @@ describe("filterPreset()", () => {
"0.71": profile_0_71,
"0.72": profile_0_72,
"0.73": profile_0_73,
"0.74": profile_0_74,
});
});

Expand Down
2 changes: 1 addition & 1 deletion packages/react-native-auth/package.json
Expand Up @@ -33,7 +33,7 @@
},
"peerDependencies": {
"react": "16.11.0 || 16.13.1 || 17.0.1 || 17.0.2 || 18.0.0 || 18.1.0 || 18.2.0",
"react-native": "^0.62.3 || ^0.63.2 || ^0.64.2 || ^0.65.0 || ^0.66.0 || ^0.67.0 || ^0.68.0 || ^0.69.0 || ^0.70.0 || ^0.71.0 || ^0.72.0 || ^0.73.0"
"react-native": "^0.62.3 || ^0.63.2 || ^0.64.2 || ^0.65.0 || ^0.66.0 || ^0.67.0 || ^0.68.0 || ^0.69.0 || ^0.70.0 || ^0.71.0 || ^0.72.0 || ^0.73.0 || ^0.74.0"
},
"devDependencies": {
"@babel/core": "^7.20.0",
Expand Down
2 changes: 1 addition & 1 deletion yarn.lock
Expand Up @@ -4223,7 +4223,7 @@ __metadata:
typescript: "npm:^5.0.0"
peerDependencies:
react: 16.11.0 || 16.13.1 || 17.0.1 || 17.0.2 || 18.0.0 || 18.1.0 || 18.2.0
react-native: ^0.62.3 || ^0.63.2 || ^0.64.2 || ^0.65.0 || ^0.66.0 || ^0.67.0 || ^0.68.0 || ^0.69.0 || ^0.70.0 || ^0.71.0 || ^0.72.0 || ^0.73.0
react-native: ^0.62.3 || ^0.63.2 || ^0.64.2 || ^0.65.0 || ^0.66.0 || ^0.67.0 || ^0.68.0 || ^0.69.0 || ^0.70.0 || ^0.71.0 || ^0.72.0 || ^0.73.0 || ^0.74.0
languageName: unknown
linkType: soft

Expand Down

0 comments on commit 4b8a674

Please sign in to comment.