diff --git a/packages/create-app/src/lib/__tests__/bin.test.ts b/packages/create-app/src/lib/__tests__/bin.test.ts index 1d5a09cec..ffbcd1add 100644 --- a/packages/create-app/src/lib/__tests__/bin.test.ts +++ b/packages/create-app/src/lib/__tests__/bin.test.ts @@ -4,6 +4,7 @@ import { PLATFORMS, PLUGINS } from '../templates.js'; test('formatConfig', () => { expect(formatConfig(PLATFORMS, PLUGINS)).toMatchInlineSnapshot(` "import { pluginPlatformIOS } from '@rnef/plugin-platform-ios'; + import { pluginPlatformVisionOS } from '@rnef/plugin-platform-visionos'; import { pluginPlatformAndroid } from '@rnef/plugin-platform-android'; import { pluginMetro } from '@rnef/plugin-metro'; import { pluginRepack } from '@rnef/plugin-repack'; @@ -15,6 +16,7 @@ test('formatConfig', () => { }, platforms: { ios: pluginPlatformIOS(), + visionos: pluginPlatformVisionOS(), android: pluginPlatformAndroid(), }, }; diff --git a/packages/create-app/src/lib/templates.ts b/packages/create-app/src/lib/templates.ts index 177f502de..726b2031f 100644 --- a/packages/create-app/src/lib/templates.ts +++ b/packages/create-app/src/lib/templates.ts @@ -60,6 +60,14 @@ export const PLATFORMS: TemplateInfo[] = [ directory: 'template', importName: 'pluginPlatformIOS', }, + { + type: 'npm', + name: 'visionos', + packageName: '@callstack/rnef-plugin-platform-visionos', + version: 'latest', + directory: 'template', + importName: 'pluginPlatformVisionOS', + }, { type: 'npm', name: 'android', diff --git a/packages/plugin-platform-visionos/README.md b/packages/plugin-platform-visionos/README.md new file mode 100644 index 000000000..b60dbad01 --- /dev/null +++ b/packages/plugin-platform-visionos/README.md @@ -0,0 +1,11 @@ +# plugin-platform-visionos + +This library was generated with [Nx](https://nx.dev). + +## Building + +Run `nx build plugin-platform-visionos` to build the library. + +## Running unit tests + +Run `nx test plugin-platform-visionos` to execute the unit tests via [Vitest](https://vitest.dev/). diff --git a/packages/plugin-platform-visionos/eslint.config.js b/packages/plugin-platform-visionos/eslint.config.js new file mode 100644 index 000000000..01e15a387 --- /dev/null +++ b/packages/plugin-platform-visionos/eslint.config.js @@ -0,0 +1,3 @@ +import baseConfig from '../../eslint.config.js'; + +export default baseConfig; diff --git a/packages/plugin-platform-visionos/package.json b/packages/plugin-platform-visionos/package.json new file mode 100644 index 000000000..ec641b29f --- /dev/null +++ b/packages/plugin-platform-visionos/package.json @@ -0,0 +1,27 @@ +{ + "name": "@rnef/plugin-platform-visionos", + "version": "0.0.1", + "type": "module", + "exports": { + "types": "./dist/src/index.d.ts", + "import": "./dist/src/index.js" + }, + "files": [ + "dist", + "src", + "template", + "react-native.config.ts" + ], + "scripts": { + "clean-dist": "rm -f dist/package.json", + "publish:verdaccio": "npm publish --registry http://localhost:4873 --userconfig ../../.npmrc" + }, + "dependencies": { + "@react-native-community/cli-config-apple": "^16.0.2", + "tslib": "^2.3.0", + "@callstack/rnef-plugin-platform-apple": "^0.0.1" + }, + "devDependencies": { + "@callstack/rnef-config": "^0.0.1" + } +} diff --git a/packages/plugin-platform-visionos/project.json b/packages/plugin-platform-visionos/project.json new file mode 100644 index 000000000..2c79ff189 --- /dev/null +++ b/packages/plugin-platform-visionos/project.json @@ -0,0 +1,18 @@ +{ + "name": "plugin-platform-visionos", + "$schema": "../../node_modules/nx/schemas/project-schema.json", + "sourceRoot": "packages/plugin-platform-visionos/src", + "projectType": "library", + "tags": [], + "targets": { + "build": { + "executor": "@nx/js:tsc", + "outputs": ["{options.outputPath}"], + "options": { + "outputPath": "packages/plugin-platform-visionos/dist", + "main": "packages/plugin-platform-visionos/src/index.ts", + "tsConfig": "packages/plugin-platform-visionos/tsconfig.lib.json" + } + } + } +} diff --git a/packages/plugin-platform-visionos/react-native.config.ts b/packages/plugin-platform-visionos/react-native.config.ts new file mode 100644 index 000000000..3527247fb --- /dev/null +++ b/packages/plugin-platform-visionos/react-native.config.ts @@ -0,0 +1,13 @@ +import { + getProjectConfig, + getDependencyConfig, +} from '@react-native-community/cli-config-apple'; + +export default { + platforms: { + visionos: { + projectConfig: getProjectConfig({ platformName: 'visionos' }), + dependencyConfig: getDependencyConfig({ platformName: 'visionos' }), + }, + }, +}; diff --git a/packages/plugin-platform-visionos/src/index.ts b/packages/plugin-platform-visionos/src/index.ts new file mode 100644 index 000000000..695a36d56 --- /dev/null +++ b/packages/plugin-platform-visionos/src/index.ts @@ -0,0 +1 @@ +export * from './lib/pluginPlatformVisionOS.js'; diff --git a/packages/plugin-platform-visionos/src/lib/__tests__/dummy.test.ts b/packages/plugin-platform-visionos/src/lib/__tests__/dummy.test.ts new file mode 100644 index 000000000..fbed3f744 --- /dev/null +++ b/packages/plugin-platform-visionos/src/lib/__tests__/dummy.test.ts @@ -0,0 +1,5 @@ +import { test, expect } from 'vitest'; + +test('dummy test', () => { + expect(true).toBe(true); +}); diff --git a/packages/plugin-platform-visionos/src/lib/pluginPlatformVisionOS.ts b/packages/plugin-platform-visionos/src/lib/pluginPlatformVisionOS.ts new file mode 100644 index 000000000..6fc32ad9e --- /dev/null +++ b/packages/plugin-platform-visionos/src/lib/pluginPlatformVisionOS.ts @@ -0,0 +1,58 @@ +import type { PluginOutput, PluginApi } from '@callstack/rnef-config'; +import { + createBuild, + createRun, + getRunOptions, + getBuildOptions, + RunFlags, + BuildFlags, +} from '@callstack/rnef-plugin-platform-apple'; +import { getProjectConfig } from '@react-native-community/cli-config-apple'; + +const projectConfig = getProjectConfig({ platformName: 'visionos' }); +const buildOptions = getBuildOptions({ platformName: 'visionos' }); +const runOptions = getRunOptions({ platformName: 'visionos' }); + +export const pluginPlatformVisionOS = + () => + (api: PluginApi): PluginOutput => { + api.registerCommand({ + name: 'build:visionos', + description: 'Build visionOS app.', + action: async (args) => { + const projectRoot = api.getProjectRoot(); + const config = projectConfig(projectRoot, {}); + + if (config) { + await createBuild('visionos', config, args as BuildFlags); + } else { + throw new Error('visionOS project not found.'); + } + }, + options: buildOptions, + }); + + api.registerCommand({ + name: 'run:visionos', + description: 'Run visionOS app.', + action: async (args) => { + const projectRoot = api.getProjectRoot(); + const config = projectConfig(projectRoot, {}); + + if (config) { + await createRun('visionos', config, args as RunFlags, projectRoot); + } else { + throw new Error('visionOS project not found.'); + } + }, + // @ts-expect-error: fix `simulator` is not defined in `RunFlags` + options: runOptions, + }); + + return { + name: 'plugin-platform-visionos', + description: 'RNEF plugin for everything visionOS.', + }; + }; + +export default pluginPlatformVisionOS; diff --git a/packages/plugin-platform-visionos/template/.github/actions/rnef-remote-build-visionos/action.yml b/packages/plugin-platform-visionos/template/.github/actions/rnef-remote-build-visionos/action.yml new file mode 100644 index 000000000..d0113cb49 --- /dev/null +++ b/packages/plugin-platform-visionos/template/.github/actions/rnef-remote-build-visionos/action.yml @@ -0,0 +1,103 @@ +name: 'RNEF Remote Build - visionOS Simulator' +description: 'Github implementation of the RNEF Remote Build for visionOS Simulator' + +inputs: + github-token: + description: "GitHub Token" + required: false + default: ${{ github.token }} + scheme: + description: The workspace scheme to build + required: false + default: "HelloWorld" + architectures: + description: The architectures to build for + required: false + default: "arm64 x86_64" + +outputs: + artifact-url: + description: 'URL of the relevant visionOS Simulator build artifact (could be cached)' + value: ${{ steps.cached-url.outcome == 'success' && steps.cached-url.outputs.artifact-url || steps.upload-artifact.outputs.artifact-url }} + +runs: + using: "composite" + steps: + - name: Native Fingerprint + id: fingerprint + uses: ./.github/actions/rnef-native-fingerprint + with: + platforms: visionos + + - name: Set variables + run: | + echo "ARTIFACT_NAME=${{inputs.scheme}}-${{inputs.architectures}}-${{ steps.fingerprint.outputs.hash}}.tar.gz" >> $GITHUB_ENV + shell: bash + + - name: Find artifact URL + id: cached-url + uses: ./.github/actions/find-artifact + with: + name: ${{ env.ARTIFACT_NAME }} + + - name: Post Cached Build (if found) + if: steps.cached-url.outputs.artifact-url + uses: ./.github/actions/rnef-post-build + with: + platform: visionOS Simulator + artifact-url: ${{ steps.cached-url.outputs.artifact-url }} + + - name: Install Pods + if: ${{ !steps.cached-url.outputs.artifact-url }} + run: | + cd visionos + pod install --verbose + shell: bash + + - name: Build visionOS + if: ${{ !steps.cached-url.outputs.artifact-url }} + # Taken from: https://github.com/microsoft/rnx-kit/blob/ac1cfa362ace6172a020d2b4bcdd63c398527c17/incubator/build/scripts/build-apple.sh#L49 + # @TODO replace with RNEF CLI call. + run: | + cd visionos + xcworkspace=$(find . -maxdepth 1 -name '*.xcworkspace' -type d | head -1) + xcodebuild \ + -workspace "${xcworkspace}" \ + -scheme "${{inputs.scheme}}" \ + -destination "generic/platform=visionOS Simulator" \ + -configuration Debug \ + -derivedDataPath DerivedData \ + ARCHS="${{inputs.architectures}}" \ + CODE_SIGNING_ALLOWED=NO \ + CLANG_ADDRESS_SANITIZER=NO \ + CLANG_UNDEFINED_BEHAVIOR_SANITIZER=NO \ + OTHER_CFLAGS='$(inherited) -fno-sanitize=undefined -fno-sanitize=bounds -fstack-protector-strong' \ + OTHER_LDFLAGS='$(inherited) -fno-sanitize=undefined -fno-sanitize=bounds -fstack-protector-strong' \ + COMPILER_INDEX_STORE_ENABLE=NO \ + build + shell: bash + + - name: Prepare Artifact + if: ${{ !steps.cached-url.outputs.artifact-url }} + run: | + app=$(find visionos/DerivedData/Build/Products/Debug-iphonesimulator -maxdepth 1 -name '*.app' -type d | head -1) + app_dir=$(dirname "${app}") + app_name=$(basename "${app}") + tar -C "${app_dir}" -czvf "${{ env.ARTIFACT_NAME }}" "${app_name}" + shell: bash + + - name: Upload IPA + id: upload-artifact + if: ${{ !steps.cached-url.outputs.artifact-url }} + uses: actions/upload-artifact@v4 + with: + name: ${{ env.ARTIFACT_NAME }} + path: ${{ env.ARTIFACT_NAME }} + if-no-files-found: error + + - name: Post Build + if: ${{ !steps.cached-url.outputs.artifact-url }} + uses: ./.github/actions/rnef-post-build + with: + platform: visionOS Simulator + artifact-url: ${{ steps.upload-artifact.outputs.artifact-url }} diff --git a/packages/plugin-platform-visionos/template/.github/workflows/remote-build-visionos.yml b/packages/plugin-platform-visionos/template/.github/workflows/remote-build-visionos.yml new file mode 100644 index 000000000..5cf3a9385 --- /dev/null +++ b/packages/plugin-platform-visionos/template/.github/workflows/remote-build-visionos.yml @@ -0,0 +1,35 @@ +name: Remote Build visionOS Simulator + +on: + push: + branches: + - main + pull_request: + branches: + - '**' + +concurrency: + group: remote-build-visionos-${{ github.ref }} + cancel-in-progress: true + +jobs: + build: + runs-on: macos-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup Node + uses: actions/setup-node@v4 + with: + node-version: '20' + cache: 'npm' + + - name: Install dependencies + run: npm install + + - name: RNEF Remote Build - visionOS Simulator + uses: ./.github/actions/rnef-remote-build-visionos + with: + architectures: arm64 diff --git a/packages/plugin-platform-visionos/template/package.json b/packages/plugin-platform-visionos/template/package.json new file mode 100644 index 000000000..c207fe17d --- /dev/null +++ b/packages/plugin-platform-visionos/template/package.json @@ -0,0 +1,10 @@ +{ + "name": "rnef-plugin-platform-visionos-template", + "scripts": { + "visionos": "rnef run:visionos" + }, + "devDependencies": { + "@callstack/rnef-plugin-platform-visionos": "^0.0.1", + "@callstack/react-native-visionos": "^0.77.0-rc.0" + } +} diff --git a/packages/plugin-platform-visionos/template/visionos/HelloWorld.xcodeproj/project.pbxproj b/packages/plugin-platform-visionos/template/visionos/HelloWorld.xcodeproj/project.pbxproj new file mode 100644 index 000000000..e15bcedfc --- /dev/null +++ b/packages/plugin-platform-visionos/template/visionos/HelloWorld.xcodeproj/project.pbxproj @@ -0,0 +1,514 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 54; + objects = { + +/* Begin PBXBuildFile section */ + 0C80B921A6F3F58F76C31292 /* libPods-HelloWorld.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5DCACB8F33CDC322A6C60F78 /* libPods-HelloWorld.a */; }; + 13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; }; + 767CEBBC2B582F6B000139AD /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 767CEBBB2B582F6B000139AD /* AppDelegate.swift */; }; + 767CEBBE2B582F78000139AD /* App.swift in Sources */ = {isa = PBXBuildFile; fileRef = 767CEBBD2B582F78000139AD /* App.swift */; }; + 13B07FB81A68108700A75B9A /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = PrivacyInfo.xcprivacy; path = HelloWorld/PrivacyInfo.xcprivacy; sourceTree = ""; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + 00E356F41AD99517003FC87E /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 83CBB9F71A601CBA00E9B192 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 13B07F861A680F5B00A75B9A; + remoteInfo = HelloWorld; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXFileReference section */ + 00E356F11AD99517003FC87E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 13B07F961A680F5B00A75B9A /* HelloWorld.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = HelloWorld.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 13B07FB51A68108700A75B9A /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = HelloWorld/Images.xcassets; sourceTree = ""; }; + 13B07FB61A68108700A75B9A /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = HelloWorld/Info.plist; sourceTree = ""; }; + 3B4392A12AC88292D35C810B /* Pods-HelloWorld.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-HelloWorld.debug.xcconfig"; path = "Target Support Files/Pods-HelloWorld/Pods-HelloWorld.debug.xcconfig"; sourceTree = ""; }; + 5709B34CF0A7D63546082F79 /* Pods-HelloWorld.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-HelloWorld.release.xcconfig"; path = "Target Support Files/Pods-HelloWorld/Pods-HelloWorld.release.xcconfig"; sourceTree = ""; }; + 5DCACB8F33CDC322A6C60F78 /* libPods-HelloWorld.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-HelloWorld.a"; sourceTree = BUILT_PRODUCTS_DIR; }; + 767CEBBB2B582F6B000139AD /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = AppDelegate.swift; path = HelloWorld/AppDelegate.swift; sourceTree = ""; }; + 767CEBBD2B582F78000139AD /* App.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = App.swift; path = HelloWorld/App.swift; sourceTree = ""; }; + ED297162215061F000B7C4FE /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = System/Library/Frameworks/JavaScriptCore.framework; sourceTree = SDKROOT; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 13B07F8C1A680F5B00A75B9A /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 0C80B921A6F3F58F76C31292 /* libPods-HelloWorld.a in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 00E356F01AD99517003FC87E /* Supporting Files */ = { + isa = PBXGroup; + children = ( + 00E356F11AD99517003FC87E /* Info.plist */, + ); + name = "Supporting Files"; + sourceTree = ""; + }; + 13B07FAE1A68108700A75B9A /* HelloWorld */ = { + isa = PBXGroup; + children = ( + 767CEBBB2B582F6B000139AD /* AppDelegate.swift */, + 767CEBBD2B582F78000139AD /* App.swift */, + 13B07FB51A68108700A75B9A /* Images.xcassets */, + 13B07FB61A68108700A75B9A /* Info.plist */, + 13B07FB81A68108700A75B9A /* PrivacyInfo.xcprivacy */, + ); + name = HelloWorld; + sourceTree = ""; + }; + 2D16E6871FA4F8E400B85C8A /* Frameworks */ = { + isa = PBXGroup; + children = ( + ED297162215061F000B7C4FE /* JavaScriptCore.framework */, + 5DCACB8F33CDC322A6C60F78 /* libPods-HelloWorld.a */, + ); + name = Frameworks; + sourceTree = ""; + }; + 832341AE1AAA6A7D00B99B32 /* Libraries */ = { + isa = PBXGroup; + children = ( + ); + name = Libraries; + sourceTree = ""; + }; + 83CBB9F61A601CBA00E9B192 = { + isa = PBXGroup; + children = ( + 13B07FAE1A68108700A75B9A /* HelloWorld */, + 832341AE1AAA6A7D00B99B32 /* Libraries */, + 83CBBA001A601CBA00E9B192 /* Products */, + 2D16E6871FA4F8E400B85C8A /* Frameworks */, + BBD78D7AC51CEA395F1C20DB /* Pods */, + ); + indentWidth = 2; + sourceTree = ""; + tabWidth = 2; + usesTabs = 0; + }; + 83CBBA001A601CBA00E9B192 /* Products */ = { + isa = PBXGroup; + children = ( + 13B07F961A680F5B00A75B9A /* HelloWorld.app */, + ); + name = Products; + sourceTree = ""; + }; + BBD78D7AC51CEA395F1C20DB /* Pods */ = { + isa = PBXGroup; + children = ( + 3B4392A12AC88292D35C810B /* Pods-HelloWorld.debug.xcconfig */, + 5709B34CF0A7D63546082F79 /* Pods-HelloWorld.release.xcconfig */, + ); + path = Pods; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 13B07F861A680F5B00A75B9A /* HelloWorld */ = { + isa = PBXNativeTarget; + buildConfigurationList = 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "HelloWorld" */; + buildPhases = ( + C38B50BA6285516D6DCD4F65 /* [CP] Check Pods Manifest.lock */, + 13B07F871A680F5B00A75B9A /* Sources */, + 13B07F8C1A680F5B00A75B9A /* Frameworks */, + 13B07F8E1A680F5B00A75B9A /* Resources */, + 00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */, + 00EEFC60759A1932668264C0 /* [CP] Embed Pods Frameworks */, + E235C05ADACE081382539298 /* [CP] Copy Pods Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = HelloWorld; + productName = HelloWorld; + productReference = 13B07F961A680F5B00A75B9A /* HelloWorld.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 83CBB9F71A601CBA00E9B192 /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 1210; + TargetAttributes = { + 13B07F861A680F5B00A75B9A = { + LastSwiftMigration = 1120; + }; + }; + }; + buildConfigurationList = 83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "HelloWorld" */; + compatibilityVersion = "Xcode 12.0"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 83CBB9F61A601CBA00E9B192; + productRefGroup = 83CBBA001A601CBA00E9B192 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 13B07F861A680F5B00A75B9A /* HelloWorld */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 00E356EC1AD99517003FC87E /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 13B07F8E1A680F5B00A75B9A /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + 00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "$(SRCROOT)/.xcode.env.local", + "$(SRCROOT)/.xcode.env", + ); + name = "Bundle React Native code and images"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "set -e\n\nWITH_ENVIRONMENT=\"../node_modules/@callstack/react-native-visionos/scripts/xcode/with-environment.sh\"\nREACT_NATIVE_XCODE=\"../node_modules/@callstack/react-native-visionos/scripts/react-native-xcode.sh\"\n\n/bin/sh -c \"$WITH_ENVIRONMENT $REACT_NATIVE_XCODE\"\n"; + }; + 00EEFC60759A1932668264C0 /* [CP] Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-HelloWorld/Pods-HelloWorld-frameworks-${CONFIGURATION}-input-files.xcfilelist", + ); + name = "[CP] Embed Pods Frameworks"; + outputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-HelloWorld/Pods-HelloWorld-frameworks-${CONFIGURATION}-output-files.xcfilelist", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-HelloWorld/Pods-HelloWorld-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; + C38B50BA6285516D6DCD4F65 /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-HelloWorld-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; + E235C05ADACE081382539298 /* [CP] Copy Pods Resources */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-HelloWorld/Pods-HelloWorld-resources-${CONFIGURATION}-input-files.xcfilelist", + ); + name = "[CP] Copy Pods Resources"; + outputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-HelloWorld/Pods-HelloWorld-resources-${CONFIGURATION}-output-files.xcfilelist", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-HelloWorld/Pods-HelloWorld-resources.sh\"\n"; + showEnvVarsInLog = 0; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 13B07F871A680F5B00A75B9A /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 767CEBBC2B582F6B000139AD /* AppDelegate.swift in Sources */, + 767CEBBE2B582F78000139AD /* App.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + 00E356F51AD99517003FC87E /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 13B07F861A680F5B00A75B9A /* HelloWorld */; + targetProxy = 00E356F41AD99517003FC87E /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin XCBuildConfiguration section */ + 13B07F941A680F5B00A75B9A /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 3B4392A12AC88292D35C810B /* Pods-HelloWorld.debug.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CURRENT_PROJECT_VERSION = 1; + ENABLE_BITCODE = NO; + INFOPLIST_FILE = HelloWorld/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + MARKETING_VERSION = 1.0; + OTHER_LDFLAGS = ( + "$(inherited)", + "-ObjC", + "-lc++", + ); + PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)"; + PRODUCT_NAME = HelloWorld; + SUPPORTED_PLATFORMS = "xros xrsimulator"; + SUPPORTS_MACCATALYST = NO; + SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO; + SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = NO; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = 7; + VERSIONING_SYSTEM = "apple-generic"; + }; + name = Debug; + }; + 13B07F951A680F5B00A75B9A /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 5709B34CF0A7D63546082F79 /* Pods-HelloWorld.release.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CURRENT_PROJECT_VERSION = 1; + INFOPLIST_FILE = HelloWorld/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + MARKETING_VERSION = 1.0; + OTHER_LDFLAGS = ( + "$(inherited)", + "-ObjC", + "-lc++", + ); + PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)"; + PRODUCT_NAME = HelloWorld; + SUPPORTED_PLATFORMS = "xros xrsimulator"; + SUPPORTS_MACCATALYST = NO; + SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO; + SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = NO; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = 7; + VERSIONING_SYSTEM = "apple-generic"; + }; + name = Release; + }; + 83CBBA201A601CBA00E9B192 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; + CLANG_CXX_LANGUAGE_STANDARD = "c++20"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + "EXCLUDED_ARCHS[sdk=iphonesimulator*]" = ""; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_SYMBOLS_PRIVATE_EXTERN = NO; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 13.4; + LD_RUNPATH_SEARCH_PATHS = ( + /usr/lib/swift, + "$(inherited)", + ); + LIBRARY_SEARCH_PATHS = ( + "\"$(SDKROOT)/usr/lib/swift\"", + "\"$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)\"", + "\"$(inherited)\"", + ); + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + OTHER_CPLUSPLUSFLAGS = ( + "$(OTHER_CFLAGS)", + "-DFOLLY_NO_CONFIG", + "-DFOLLY_MOBILE=1", + "-DFOLLY_USE_LIBCPP=1", + "-DFOLLY_CFG_NO_COROUTINES=1", + "-DFOLLY_HAVE_CLOCK_GETTIME=1", + ); + SDKROOT = iphoneos; + }; + name = Debug; + }; + 83CBBA211A601CBA00E9B192 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; + CLANG_CXX_LANGUAGE_STANDARD = "c++20"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = YES; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + "EXCLUDED_ARCHS[sdk=iphonesimulator*]" = ""; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 13.4; + LD_RUNPATH_SEARCH_PATHS = ( + /usr/lib/swift, + "$(inherited)", + ); + LIBRARY_SEARCH_PATHS = ( + "\"$(SDKROOT)/usr/lib/swift\"", + "\"$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)\"", + "\"$(inherited)\"", + ); + MTL_ENABLE_DEBUG_INFO = NO; + OTHER_CPLUSPLUSFLAGS = ( + "$(OTHER_CFLAGS)", + "-DFOLLY_NO_CONFIG", + "-DFOLLY_MOBILE=1", + "-DFOLLY_USE_LIBCPP=1", + "-DFOLLY_CFG_NO_COROUTINES=1", + "-DFOLLY_HAVE_CLOCK_GETTIME=1", + ); + SDKROOT = iphoneos; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "HelloWorld" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 13B07F941A680F5B00A75B9A /* Debug */, + 13B07F951A680F5B00A75B9A /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "HelloWorld" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 83CBBA201A601CBA00E9B192 /* Debug */, + 83CBBA211A601CBA00E9B192 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 83CBB9F71A601CBA00E9B192 /* Project object */; +} diff --git a/packages/plugin-platform-visionos/template/visionos/HelloWorld.xcodeproj/xcshareddata/xcschemes/HelloWorld.xcscheme b/packages/plugin-platform-visionos/template/visionos/HelloWorld.xcodeproj/xcshareddata/xcschemes/HelloWorld.xcscheme new file mode 100644 index 000000000..766cb1773 --- /dev/null +++ b/packages/plugin-platform-visionos/template/visionos/HelloWorld.xcodeproj/xcshareddata/xcschemes/HelloWorld.xcscheme @@ -0,0 +1,70 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/packages/plugin-platform-visionos/template/visionos/HelloWorld/App.swift b/packages/plugin-platform-visionos/template/visionos/HelloWorld/App.swift new file mode 100644 index 000000000..c1d601b22 --- /dev/null +++ b/packages/plugin-platform-visionos/template/visionos/HelloWorld/App.swift @@ -0,0 +1,12 @@ +import SwiftUI +import React +import React_RCTSwiftExtensions + +@main +struct HelloWorldApp: App { + @UIApplicationDelegateAdaptor var delegate: AppDelegate + + var body: some Scene { + RCTMainWindow(moduleName: "HelloWorld") + } +} diff --git a/packages/plugin-platform-visionos/template/visionos/HelloWorld/AppDelegate.swift b/packages/plugin-platform-visionos/template/visionos/HelloWorld/AppDelegate.swift new file mode 100644 index 000000000..4e68fb4c1 --- /dev/null +++ b/packages/plugin-platform-visionos/template/visionos/HelloWorld/AppDelegate.swift @@ -0,0 +1,17 @@ +import UIKit +import React +import React_RCTAppDelegate + +class AppDelegate: RCTAppDelegate { + override func sourceURL(for bridge: RCTBridge) -> URL? { + self.bundleURL() + } + + override func bundleURL() -> URL? { +#if DEBUG + RCTBundleURLProvider.sharedSettings().jsBundleURL(forBundleRoot: "index") +#else + Bundle.main.url(forResource: "main", withExtension: "jsbundle") +#endif + } +} diff --git a/packages/plugin-platform-visionos/template/visionos/HelloWorld/Images.xcassets/AppIcon.appiconset/Contents.json b/packages/plugin-platform-visionos/template/visionos/HelloWorld/Images.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 000000000..81213230d --- /dev/null +++ b/packages/plugin-platform-visionos/template/visionos/HelloWorld/Images.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,53 @@ +{ + "images" : [ + { + "idiom" : "iphone", + "scale" : "2x", + "size" : "20x20" + }, + { + "idiom" : "iphone", + "scale" : "3x", + "size" : "20x20" + }, + { + "idiom" : "iphone", + "scale" : "2x", + "size" : "29x29" + }, + { + "idiom" : "iphone", + "scale" : "3x", + "size" : "29x29" + }, + { + "idiom" : "iphone", + "scale" : "2x", + "size" : "40x40" + }, + { + "idiom" : "iphone", + "scale" : "3x", + "size" : "40x40" + }, + { + "idiom" : "iphone", + "scale" : "2x", + "size" : "60x60" + }, + { + "idiom" : "iphone", + "scale" : "3x", + "size" : "60x60" + }, + { + "idiom" : "ios-marketing", + "scale" : "1x", + "size" : "1024x1024" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/packages/plugin-platform-visionos/template/visionos/HelloWorld/Images.xcassets/Contents.json b/packages/plugin-platform-visionos/template/visionos/HelloWorld/Images.xcassets/Contents.json new file mode 100644 index 000000000..2d92bd53f --- /dev/null +++ b/packages/plugin-platform-visionos/template/visionos/HelloWorld/Images.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + } +} diff --git a/packages/plugin-platform-visionos/template/visionos/HelloWorld/Info.plist b/packages/plugin-platform-visionos/template/visionos/HelloWorld/Info.plist new file mode 100644 index 000000000..2f57133ef --- /dev/null +++ b/packages/plugin-platform-visionos/template/visionos/HelloWorld/Info.plist @@ -0,0 +1,57 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleDisplayName + Hello App Display Name + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + APPL + CFBundleShortVersionString + $(MARKETING_VERSION) + CFBundleSignature + ???? + CFBundleVersion + $(CURRENT_PROJECT_VERSION) + LSRequiresIPhoneOS + + NSAppTransportSecurity + + + NSAllowsArbitraryLoads + + NSAllowsLocalNetworking + + + NSLocationWhenInUseUsageDescription + + UIRequiredDeviceCapabilities + + armv7 + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UIViewControllerBasedStatusBarAppearance + + UIApplicationSceneManifest + + UIApplicationSupportsMultipleScenes + + UISceneConfigurations + + + + diff --git a/packages/plugin-platform-visionos/template/visionos/HelloWorld/PrivacyInfo.xcprivacy b/packages/plugin-platform-visionos/template/visionos/HelloWorld/PrivacyInfo.xcprivacy new file mode 100644 index 000000000..ef1896e70 --- /dev/null +++ b/packages/plugin-platform-visionos/template/visionos/HelloWorld/PrivacyInfo.xcprivacy @@ -0,0 +1,38 @@ + + + + + NSPrivacyCollectedDataTypes + + + NSPrivacyAccessedAPITypes + + + NSPrivacyAccessedAPIType + NSPrivacyAccessedAPICategoryFileTimestamp + NSPrivacyAccessedAPITypeReasons + + C617.1 + + + + NSPrivacyAccessedAPIType + NSPrivacyAccessedAPICategoryUserDefaults + NSPrivacyAccessedAPITypeReasons + + CA92.1 + + + + NSPrivacyAccessedAPIType + NSPrivacyAccessedAPICategorySystemBootTime + NSPrivacyAccessedAPITypeReasons + + 35F9.1 + + + + NSPrivacyTracking + + + diff --git a/packages/plugin-platform-visionos/template/visionos/Podfile b/packages/plugin-platform-visionos/template/visionos/Podfile new file mode 100644 index 000000000..ccf7f1e3f --- /dev/null +++ b/packages/plugin-platform-visionos/template/visionos/Podfile @@ -0,0 +1,35 @@ +# Resolve react_native_pods.rb with node to allow for hoisting +require Pod::Executable.execute_command('node', ['-p', + 'require.resolve( + "@callstack/react-native-visionos/scripts/react_native_pods.rb", + {paths: [process.argv[1]]}, + )', __dir__]).strip + +platform :visionos, min_visionos_version_supported +prepare_react_native_project! + +linkage = ENV['USE_FRAMEWORKS'] +if linkage != nil + Pod::UI.puts "Configuring Pod with #{linkage}ally linked Frameworks".green + use_frameworks! :linkage => linkage.to_sym +end + +target 'HelloWorld' do + config = use_native_modules!(['rnef', 'config']) + config[:reactNativePath] = '../node_modules/@callstack/react-native-visionos' + + use_react_native!( + :path => config[:reactNativePath], + # An absolute path to your application root. + :app_path => "#{Pod::Config.instance.installation_root}/.." + ) + + post_install do |installer| + # https://github.com/facebook/react-native/blob/main/packages/react-native/scripts/react_native_pods.rb#L197-L202 + react_native_post_install( + installer, + config[:reactNativePath], + :mac_catalyst_enabled => false + ) + end +end diff --git a/packages/plugin-platform-visionos/template/visionos/_xcode.env b/packages/plugin-platform-visionos/template/visionos/_xcode.env new file mode 100644 index 000000000..3d5782c71 --- /dev/null +++ b/packages/plugin-platform-visionos/template/visionos/_xcode.env @@ -0,0 +1,11 @@ +# This `.xcode.env` file is versioned and is used to source the environment +# used when running script phases inside Xcode. +# To customize your local environment, you can create an `.xcode.env.local` +# file that is not versioned. + +# NODE_BINARY variable contains the PATH to the node executable. +# +# Customize the NODE_BINARY variable here. +# For example, to use nvm with brew, add the following line +# . "$(brew --prefix nvm)/nvm.sh" --no-use +export NODE_BINARY=$(command -v node) diff --git a/packages/plugin-platform-visionos/tsconfig.json b/packages/plugin-platform-visionos/tsconfig.json new file mode 100644 index 000000000..0e8e67d56 --- /dev/null +++ b/packages/plugin-platform-visionos/tsconfig.json @@ -0,0 +1,21 @@ +{ + "extends": "../../tsconfig.base.json", + "compilerOptions": { + "forceConsistentCasingInFileNames": true, + "strict": true, + "noImplicitOverride": true, + "noPropertyAccessFromIndexSignature": true, + "noImplicitReturns": true, + "noFallthroughCasesInSwitch": true + }, + "files": [], + "include": [], + "references": [ + { + "path": "./tsconfig.lib.json" + }, + { + "path": "./tsconfig.spec.json" + } + ] +} diff --git a/packages/plugin-platform-visionos/tsconfig.lib.json b/packages/plugin-platform-visionos/tsconfig.lib.json new file mode 100644 index 000000000..ce3b531ce --- /dev/null +++ b/packages/plugin-platform-visionos/tsconfig.lib.json @@ -0,0 +1,10 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "../../dist/out-tsc", + "declaration": true, + "types": ["node"] + }, + "include": ["src/**/*.ts"], + "exclude": ["vite.config.ts", "src/**/*.spec.ts", "src/**/*.test.ts"] +} diff --git a/packages/plugin-platform-visionos/tsconfig.spec.json b/packages/plugin-platform-visionos/tsconfig.spec.json new file mode 100644 index 000000000..3c002c215 --- /dev/null +++ b/packages/plugin-platform-visionos/tsconfig.spec.json @@ -0,0 +1,26 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "../../dist/out-tsc", + "types": [ + "vitest/globals", + "vitest/importMeta", + "vite/client", + "node", + "vitest" + ] + }, + "include": [ + "vite.config.ts", + "vitest.config.ts", + "src/**/*.test.ts", + "src/**/*.spec.ts", + "src/**/*.test.tsx", + "src/**/*.spec.tsx", + "src/**/*.test.js", + "src/**/*.spec.js", + "src/**/*.test.jsx", + "src/**/*.spec.jsx", + "src/**/*.d.ts" + ] +} diff --git a/packages/plugin-platform-visionos/vite.config.ts b/packages/plugin-platform-visionos/vite.config.ts new file mode 100644 index 000000000..6fe09719f --- /dev/null +++ b/packages/plugin-platform-visionos/vite.config.ts @@ -0,0 +1,28 @@ +import { defineConfig } from 'vite'; + +import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin'; +import { nxCopyAssetsPlugin } from '@nx/vite/plugins/nx-copy-assets.plugin'; + +export default defineConfig({ + root: __dirname, + cacheDir: '../../node_modules/.vite/packages/plugin-platform-visionos', + + plugins: [nxViteTsPaths(), nxCopyAssetsPlugin(['*.md'])], + + // Uncomment this if you are using workers. + // worker: { + // plugins: [ nxViteTsPaths() ], + // }, + + test: { + watch: false, + globals: true, + environment: 'node', + include: ['src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'], + reporters: ['default'], + coverage: { + reportsDirectory: '../../coverage/packages/plugin-platform-visionos', + provider: 'v8', + }, + }, +}); diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 2af4bf46e..38e88a79e 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -250,6 +250,22 @@ importers: specifier: ^0.1.6 version: link:../config + packages/plugin-platform-visionos: + dependencies: + '@callstack/rnef-plugin-platform-apple': + specifier: workspace:* + version: link:../plugin-platform-apple + '@react-native-community/cli-config-apple': + specifier: ^16.0.2 + version: 16.0.2 + tslib: + specifier: ^2.3.0 + version: 2.8.1 + devDependencies: + '@callstack/rnef-config': + specifier: workspace:* + version: link:../config + packages/plugin-repack: dependencies: '@callstack/repack': diff --git a/tsconfig.base.json b/tsconfig.base.json index 50de7f867..6ca3e6887 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -31,7 +31,10 @@ "@rnef/tools": ["packages/tools/src/index.ts"], "@rnef/plugin-platform-apple": [ "packages/plugin-platform-apple/src/index.ts" - ] + ], + "@rnef/plugin-platform-visionos": [ + "packages/plugin-platform-visionos/src/index.ts" + ], } }, "exclude": ["node_modules", "tmp"]