Skip to content

Commit 6da95f4

Browse files
committed
feat: implement visionos cli commands (#64)
1 parent 532f944 commit 6da95f4

File tree

5 files changed

+54
-3
lines changed

5 files changed

+54
-3
lines changed
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
const {
2+
buildOptions,
3+
createBuild,
4+
createLog,
5+
createRun,
6+
logOptions,
7+
runOptions,
8+
} = require('@react-native-community/cli-platform-apple');
9+
10+
const run = {
11+
name: 'run-visionos',
12+
description: 'builds your app and starts it on visionOS simulator',
13+
func: createRun({platformName: 'visionos'}),
14+
examples: [
15+
{
16+
desc: 'Run on a specific simulator',
17+
cmd: 'npx @callstack/react-native-visionos run-visionos --simulator "Apple Vision Pro"',
18+
},
19+
],
20+
options: runOptions,
21+
};
22+
23+
const log = {
24+
name: 'log-visionos',
25+
description: 'starts visionOS device syslog tail',
26+
func: createLog({platformName: 'visionos'}),
27+
options: logOptions,
28+
};
29+
30+
const build = {
31+
name: 'build-visionos',
32+
description: 'builds your app for visionOS platform',
33+
func: createBuild({platformName: 'visionos'}),
34+
examples: [
35+
{
36+
desc: 'Build the app for all visionOS devices in Release mode',
37+
cmd: 'npx @callstack/react-native-visionos build-visionos --mode "Release"',
38+
},
39+
],
40+
options: buildOptions,
41+
};
42+
43+
module.exports = [run, log, build];

packages/react-native/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@
9999
"@react-native-community/cli": "13.5.1",
100100
"@react-native-community/cli-platform-android": "13.5.1",
101101
"@react-native-community/cli-platform-ios": "13.5.1",
102+
"@react-native-community/cli-platform-apple": "13.5.1",
102103
"@react-native/assets-registry": "0.74.0",
103104
"@react-native/codegen": "0.74.0",
104105
"@react-native/community-cli-plugin": "0.74.0",

packages/react-native/react-native.config.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,12 @@
99

1010
'use strict';
1111

12+
const localCommands = require('./local-cli/localCommands');
1213
const android = require('@react-native-community/cli-platform-android');
14+
const {
15+
getDependencyConfig,
16+
getProjectConfig,
17+
} = require('@react-native-community/cli-platform-apple');
1318
const ios = require('@react-native-community/cli-platform-ios');
1419
const {
1520
bundleCommand,
@@ -52,12 +57,13 @@ module.exports = {
5257
ramBundleCommand,
5358
startCommand,
5459
codegenCommand,
60+
...localCommands,
5561
],
5662
platforms: {
5763
visionos: {
5864
npmPackageName: '@callstack/react-native-visionos',
59-
projectConfig: ios.projectConfig,
60-
dependencyConfig: ios.dependencyConfig,
65+
projectConfig: getProjectConfig({platformName: 'visionos'}),
66+
dependencyConfig: getDependencyConfig({platformName: 'visionos'}),
6167
},
6268
ios: {
6369
projectConfig: ios.projectConfig,

packages/react-native/template/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"scripts": {
66
"android": "react-native run-android",
77
"ios": "react-native run-ios",
8+
"visionos": "react-native run-visionos",
89
"lint": "eslint .",
910
"start": "react-native start",
1011
"test": "jest"

yarn.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7125,7 +7125,7 @@ [email protected]:
71257125
dependencies:
71267126
terser "^5.15.0"
71277127

7128-
[email protected], metro-resolver@^0.80.3:
7128+
[email protected], metro-resolver@^0.80.0, metro-resolver@^0.80.3:
71297129
version "0.80.3"
71307130
resolved "https://registry.yarnpkg.com/metro-resolver/-/metro-resolver-0.80.3.tgz#f9676508583d81182c7afaabc908254dc928a345"
71317131
integrity sha512-zwa0i32rj/TI3NivcvMXHJwTG2gUgo2dXdcnAJlhEKKQvyN+7AfhNdQSlDdDqMQmU7FaLRdeWORnQJbYCrprQQ==

0 commit comments

Comments
 (0)