Skip to content

Commit

Permalink
fix(visionos): declare support for 0.74 (#1933)
Browse files Browse the repository at this point in the history
* fix(visionos): declare support for 0.74

* fixup! fix(visionos): declare support for 0.74

* fix: remove --no-packager as it is currently broken

---------

Co-authored-by: Lorenzo Sciandra <lsciandra@microsoft.com>
  • Loading branch information
tido64 and kelset committed Mar 25, 2024
1 parent 0c31391 commit de07231
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 14 deletions.
1 change: 1 addition & 0 deletions example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"macos": "react-native run-macos --no-packager --scheme Example",
"set-react-version": "yarn workspace react-native-test-app set-react-version",
"start": "react-native start",
"visionos": "react-native run-visionos",
"windows": "react-native run-windows --no-packager"
},
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
"yoctocolors": "^2.0.0"
},
"peerDependencies": {
"@callstack/react-native-visionos": "0.73",
"@callstack/react-native-visionos": "0.73 - 0.74",
"@expo/config-plugins": ">=5.0",
"react": "17.0.1 - 18.2",
"react-native": "0.66 - 0.74 || >=0.75.0-0 <0.75.0",
Expand Down
37 changes: 25 additions & 12 deletions scripts/set-react-version.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -348,22 +348,35 @@ async function getProfile(v, coreOnly) {
}

default: {
const [reactNative, { version: rnmVersion }, { version: rnwVersion }] =
await Promise.all([
fetchPackageInfo(`react-native@^${v}.0-0`),
coreOnly
? Promise.resolve({ version: undefined })
: fetchPackageInfo(`react-native-macos@^${v}.0-0`),
coreOnly
? Promise.resolve({ version: undefined })
: fetchPackageInfo(`react-native-windows@^${v}.0-0`),
]);
const manifest = /** @type {Manifest} */ (readJSONFile("package.json"));
const visionos = manifest.defaultPlatformPackages?.["visionos"];
if (!visionos) {
throw new Error("Missing platform package for visionOS");
}

const versions = {
core: fetchPackageInfo(`react-native@^${v}.0-0`),
macos: coreOnly
? Promise.resolve({ version: undefined })
: fetchPackageInfo(`react-native-macos@^${v}.0-0`),
visionos: coreOnly
? Promise.resolve({ version: undefined })
: fetchPackageInfo(`${visionos}@^${v}.0-0`),
windows: coreOnly
? Promise.resolve({ version: undefined })
: fetchPackageInfo(`react-native-windows@^${v}.0-0`),
};
const reactNative = await versions.core;
const commonDeps = await resolveCommonDependencies(v, reactNative);

/** @type {(manifest: Manifest) => string | undefined} */
const getVersion = ({ version }) => version;
return {
...commonDeps,
"react-native": reactNative.version,
"react-native-macos": rnmVersion,
"react-native-windows": rnwVersion,
"react-native-macos": await versions.macos.then(getVersion),
"react-native-windows": await versions.windows.then(getVersion),
[visionos]: await versions.visionos.then(getVersion),
};
}
}
Expand Down
2 changes: 1 addition & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -12276,7 +12276,7 @@ __metadata:
uuid: "npm:^9.0.0"
yoctocolors: "npm:^2.0.0"
peerDependencies:
"@callstack/react-native-visionos": 0.73
"@callstack/react-native-visionos": 0.73 - 0.74
"@expo/config-plugins": ">=5.0"
react: 17.0.1 - 18.2
react-native: 0.66 - 0.74 || >=0.75.0-0 <0.75.0
Expand Down

0 comments on commit de07231

Please sign in to comment.