Skip to content

Commit 21ec934

Browse files
fix sim version detection(apple)
1 parent e790a37 commit 21ec934

File tree

11 files changed

+203
-56
lines changed

11 files changed

+203
-56
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@
127127
},
128128
"private": true,
129129
"resolutions": {
130-
"@react-native-community/cli-platform-ios": "12.3.6"
130+
"@react-native-community/cli-platform-ios": "15.0.1"
131131
},
132132
"title": "ReNative",
133133
"husky": {

packages/app-harness/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
"dependencies": {
4343
"@lightningjs/cli": "2.13.0",
4444
"@lightningjs/sdk": "5.5.1",
45+
"@react-native-community/cli": "15.0.1",
4546
"@react-native-community/push-notification-ios": "1.11.0",
4647
"@react-native-firebase/app": "20.0.0",
4748
"@rnv/renative": "1.8.0-rc.0",
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"overrides": {
3+
"build/tools/listDevices.js": {
4+
"const parsedSimctlOutput = Object.keys(simctlOutput.devices).map(key => simctlOutput.devices[key]).reduce((acc, val) => acc.concat(val), []);": "const parsedSimctlOutput = Object.keys(simctlOutput.devices)\n .map(key => {\n const runtimeVersionMatch = key.match(/-(\\d+-\\d+)/);\n const runtimeVersion = runtimeVersionMatch ? runtimeVersionMatch[1].replace('-', '.') : null;\n return simctlOutput.devices[key].map(sim => ({ ...sim, version: runtimeVersion, }));\n }).reduce((acc, val) => acc.concat(val), []); // <= PATCHED BY RENATIVE"
5+
}
6+
}
7+
}
8+

packages/config-templates/pluginTemplates/@react-native-community/cli-platform-ios/overrides.json

Lines changed: 0 additions & 13 deletions
This file was deleted.

packages/config-templates/renative.templates.json

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -455,16 +455,21 @@
455455
},
456456
"@react-native-community/cli": {
457457
"disableNpm": false,
458-
"version": "^15.0.1",
458+
"version": "15.0.1",
459+
"supportedPlatforms": ["tvos", "ios"]
460+
},
461+
"@react-native-community/cli-platform-apple": {
462+
"disableNpm": true,
463+
"version": "15.0.1",
459464
"supportedPlatforms": ["tvos", "ios"]
460465
},
461466
"@react-native-community/cli-platform-android": {
462467
"version": "^15.0.1"
463468
},
464469
"@react-native-community/cli-platform-ios": {
465-
"version": "12.3.6",
470+
"version": "15.0.1",
466471
"disablePluginTemplateOverrides": false,
467-
"disableNpm": false,
472+
"disableNpm": true,
468473
"supportedPlatforms": ["tvos", "ios"],
469474
"nodeModuleOverrides": {
470475
"^12.3.6": {

packages/sdk-apple/package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,9 @@
3838
"xcode": "3.0.1"
3939
},
4040
"peerDependencies": {
41-
"@react-native-community/cli": "^15.0.1",
42-
"@react-native-community/cli-platform-ios": "^12.3.6",
41+
"@react-native-community/cli": "15.0.1",
42+
"@react-native-community/cli-platform-apple": "15.0.1",
43+
"@react-native-community/cli-platform-ios": "15.0.1",
4344
"@rnv/core": "^1.8.0-rc.0"
4445
},
4546
"publishConfig": {

packages/sdk-apple/src/__tests__/deviceManager.test.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
import { createRnvContext, getContext } from '@rnv/core';
22
import { getAppleDevices } from '../deviceManager';
3-
import listIOSDevices from '@react-native-community/cli-platform-ios/build/tools/listIOSDevices';
3+
import listIOSDevices from '@react-native-community/cli-platform-apple/build/tools/listDevices';
44
import { DeviceType } from '../types';
55

66
const devices: DeviceType[] = [
77
{
8-
modelName: 'MacBook Pro',
98
isAvailable: true,
109
name: 'My Mac',
1110
udid: 'D9B9188D-C38B-59D9-A1BD-5E4081F6EDA1',
@@ -14,7 +13,6 @@ const devices: DeviceType[] = [
1413
type: 'device',
1514
},
1615
{
17-
modelName: 'iPhone 15',
1816
isAvailable: true,
1917
name: 'iPhone 15',
2018
udid: 'ABF470AF-2538-4047-94A8-D72E22EB15BF',
@@ -23,7 +21,6 @@ const devices: DeviceType[] = [
2321
type: 'device',
2422
},
2523
{
26-
modelName: 'iPhone 15 Pro',
2724
isAvailable: true,
2825
name: 'iPhone 15 Pro',
2926
udid: '04264D6F-0223-4AC6-9D05-8449DFDC6C3B',
@@ -32,7 +29,6 @@ const devices: DeviceType[] = [
3229
type: 'simulator',
3330
},
3431
{
35-
modelName: 'iPad Pro (11-inch) (4th generation)',
3632
isAvailable: true,
3733
name: 'iPad Pro (11-inch) (4th generation)',
3834
udid: '59853D87-6F6C-4A6E-9F9C-A9C335F86647',
@@ -42,7 +38,7 @@ const devices: DeviceType[] = [
4238
},
4339
];
4440

45-
jest.mock('@react-native-community/cli-platform-ios/build/tools/listIOSDevices');
41+
jest.mock('@react-native-community/cli-platform-apple/build/tools/listDevices');
4642
jest.mock('@rnv/core');
4743

4844
beforeEach(() => {

packages/sdk-apple/src/deviceManager.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ const ERROR_MSG = {
1818
};
1919

2020
export const getAppleDevices = async (ignoreDevices?: boolean, ignoreSimulators?: boolean) => {
21-
const listIOSDevices = require('@react-native-community/cli-platform-ios/build/tools/listIOSDevices.js').default;
21+
const listIOSDevices = require('@react-native-community/cli-platform-apple/build/tools/listDevices.js').default;
2222

2323
const c = getContext();
2424
const { platform } = c;
@@ -56,28 +56,28 @@ export const getAppleDevices = async (ignoreDevices?: boolean, ignoreSimulators?
5656

5757
const _parseNewIOSDevicesList = (rawDevices: Array<DeviceType>) => {
5858
const decideIcon = (device: DeviceType) => {
59-
const { modelName } = device;
60-
if (modelName?.includes('iPhone') || modelName?.includes('iPod')) {
59+
const { name } = device;
60+
if (name?.includes('iPhone') || name?.includes('iPod')) {
6161
return 'Phone 📱';
6262
}
63-
if (modelName?.includes('iPad')) {
63+
if (name?.includes('iPad')) {
6464
return 'Tablet 💊';
6565
}
66-
if (modelName?.includes('Apple TV')) {
66+
if (name?.includes('Apple TV')) {
6767
return 'TV 📺';
6868
}
6969
return 'Apple Device';
7070
};
7171

7272
return rawDevices.map((device): AppleDevice => {
73-
const { name, version, udid, type, modelName } = device;
73+
const { name, version, udid, type } = device;
7474
const icon = decideIcon(device);
7575
return {
7676
udid,
7777
name,
7878
icon,
7979
version,
80-
modelName,
80+
// modelName,
8181
isDevice: type === 'device',
8282
};
8383
});

packages/sdk-apple/src/types.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { ConfigPluginPlatformSchema } from '@rnv/core';
2-
import { Device } from '@react-native-community/cli-platform-ios/build/types';
2+
import { Device } from '@react-native-community/cli-platform-apple/build/types';
33

44
export type AppleDevice = {
55
udid?: string;
@@ -11,7 +11,7 @@ export type AppleDevice = {
1111
modelName?: string;
1212
};
1313

14-
export type DeviceType = Device & { modelName: string };
14+
export type DeviceType = Device;
1515

1616
export type Payload = {
1717
pluginConfigiOS: {

packages/template-starter/renative.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@
119119
"react-dom": "source:rnv",
120120
"react-native-gesture-handler": "source:rnv",
121121
"@react-native-community/cli-platform-ios": "source:rnv",
122+
"@react-native-community/cli-platform-apple": "source:rnv",
122123
"@react-native-community/cli": "source:rnv",
123124
"react-native": "source:rnv",
124125
"next": "source:rnv",

0 commit comments

Comments
 (0)