Skip to content

Commit

Permalink
feat: implement visionos cli commands (#64)
Browse files Browse the repository at this point in the history
  • Loading branch information
okwasniewski committed Feb 13, 2024
1 parent f036021 commit 9f81dc5
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 3 deletions.
43 changes: 43 additions & 0 deletions packages/react-native/local-cli/localCommands.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
const {
buildOptions,
createBuild,
createLog,
createRun,
logOptions,
runOptions,
} = require('@react-native-community/cli-platform-apple');

const run = {
name: 'run-visionos',
description: 'builds your app and starts it on visionOS simulator',
func: createRun({platformName: 'visionos'}),
examples: [
{
desc: 'Run on a specific simulator',
cmd: 'npx @callstack/react-native-visionos run-visionos --simulator "Apple Vision Pro"',
},
],
options: runOptions,
};

const log = {
name: 'log-visionos',
description: 'starts visionOS device syslog tail',
func: createLog({platformName: 'visionos'}),
options: logOptions,
};

const build = {
name: 'build-visionos',
description: 'builds your app for visionOS platform',
func: createBuild({platformName: 'visionos'}),
examples: [
{
desc: 'Build the app for all visionOS devices in Release mode',
cmd: 'npx @callstack/react-native-visionos build-visionos --mode "Release"',
},
],
options: buildOptions,
};

module.exports = [run, log, build];
1 change: 1 addition & 0 deletions packages/react-native/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@
"@react-native-community/cli": "13.5.1",
"@react-native-community/cli-platform-android": "13.5.1",
"@react-native-community/cli-platform-ios": "13.5.1",
"@react-native-community/cli-platform-apple": "13.5.1",
"@react-native/assets-registry": "0.74.0",
"@react-native/codegen": "0.74.0",
"@react-native/community-cli-plugin": "0.74.0",
Expand Down
10 changes: 8 additions & 2 deletions packages/react-native/react-native.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,12 @@

'use strict';

const localCommands = require('./local-cli/localCommands');
const android = require('@react-native-community/cli-platform-android');
const {
getDependencyConfig,
getProjectConfig,
} = require('@react-native-community/cli-platform-apple');
const ios = require('@react-native-community/cli-platform-ios');
const {
bundleCommand,
Expand Down Expand Up @@ -52,12 +57,13 @@ module.exports = {
ramBundleCommand,
startCommand,
codegenCommand,
...localCommands,
],
platforms: {
visionos: {
npmPackageName: '@callstack/react-native-visionos',
projectConfig: ios.projectConfig,
dependencyConfig: ios.dependencyConfig,
projectConfig: getProjectConfig({platformName: 'visionos'}),
dependencyConfig: getDependencyConfig({platformName: 'visionos'}),
},
ios: {
projectConfig: ios.projectConfig,
Expand Down
1 change: 1 addition & 0 deletions packages/react-native/template/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"scripts": {
"android": "react-native run-android",
"ios": "react-native run-ios",
"visionos": "react-native run-visionos",
"lint": "eslint .",
"start": "react-native start",
"test": "jest"
Expand Down
2 changes: 1 addition & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7137,7 +7137,7 @@ metro-minify-terser@0.80.3:
dependencies:
terser "^5.15.0"

metro-resolver@0.80.3, metro-resolver@^0.80.3:
metro-resolver@0.80.3, metro-resolver@^0.80.0, metro-resolver@^0.80.3:
version "0.80.3"
resolved "https://registry.yarnpkg.com/metro-resolver/-/metro-resolver-0.80.3.tgz#f9676508583d81182c7afaabc908254dc928a345"
integrity sha512-zwa0i32rj/TI3NivcvMXHJwTG2gUgo2dXdcnAJlhEKKQvyN+7AfhNdQSlDdDqMQmU7FaLRdeWORnQJbYCrprQQ==
Expand Down

0 comments on commit 9f81dc5

Please sign in to comment.