diff --git a/.github/actions/gradle/action.yml b/.github/actions/gradle/action.yml index b32e4c189..f3cd9e61c 100644 --- a/.github/actions/gradle/action.yml +++ b/.github/actions/gradle/action.yml @@ -12,9 +12,18 @@ runs: steps: - name: Configure Gradle wrapper run: | - node --eval "require('./android/gradle-wrapper.js').configureGradleWrapper('${{ inputs.project-root }}/android')" + node --eval "require('./packages/app/android/gradle-wrapper.js').configureGradleWrapper('${{ inputs.project-root }}/android')" shell: bash - name: Build + if: ${{ runner.os != 'Windows' }} + run: ./gradlew ${{ inputs.arguments }} + shell: bash + working-directory: ${{ inputs.project-root }}/android + - name: Build (Windows) + if: ${{ runner.os == 'Windows' }} + env: + # https://github.com/ninja-build/ninja/issues/1900 + CMAKE_MAKE_PROGRAM: "C:\\ProgramData\\Chocolatey\\bin\\ninja.exe" run: ./gradlew ${{ inputs.arguments }} shell: bash working-directory: ${{ inputs.project-root }}/android diff --git a/.github/actions/init-test-app/action.yml b/.github/actions/init-test-app/action.yml index 9ed265ca6..ba5a72028 100644 --- a/.github/actions/init-test-app/action.yml +++ b/.github/actions/init-test-app/action.yml @@ -9,7 +9,7 @@ runs: steps: - name: Install run: | - scripts/build/install-test-template.sh ${{ inputs.platform }} + scripts/install-test-template.sh ${{ inputs.platform }} shell: bash - name: Initialize a new app run: | diff --git a/.github/actions/setup-react-native/action.yml b/.github/actions/setup-react-native/action.yml index 8f0b6ab6e..f503c304d 100644 --- a/.github/actions/setup-react-native/action.yml +++ b/.github/actions/setup-react-native/action.yml @@ -14,3 +14,4 @@ runs: rm example/visionos/Podfile.lock npm run set-react-version -- ${{ inputs.version }} shell: bash + working-directory: packages/app diff --git a/.github/actions/setup-toolchain/action.yml b/.github/actions/setup-toolchain/action.yml index 18fbb9302..e78560521 100644 --- a/.github/actions/setup-toolchain/action.yml +++ b/.github/actions/setup-toolchain/action.yml @@ -21,6 +21,11 @@ inputs: runs: using: composite steps: + - name: Enable long paths (Windows) + if: ${{ runner.os == 'Windows' }} + run: | + New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem" -Name "LongPathsEnabled" -Value 1 -PropertyType DWORD -Force + shell: powershell - name: Set up Ccache id: setup-ccache if: ${{ inputs.platform == 'ios' || inputs.platform == 'macos' || inputs.platform == 'visionos' }} diff --git a/.github/labeler.yml b/.github/labeler.yml index 423a363f5..437e800e8 100644 --- a/.github/labeler.yml +++ b/.github/labeler.yml @@ -5,17 +5,17 @@ - .github/actions/init-test-app/* - .github/actions/setup-toolchain/* - .github/workflows/build.yml - - android/**/* - - common/**/* - - example/android/**/* - - scripts/*.js - - scripts/configure.mjs - - scripts/embed-manifest/kotlin.mjs - - scripts/embed-manifest/main.mjs - - scripts/embed-manifest/validate.mjs - - scripts/init.mjs - - scripts/template.mjs - - test-app.gradle + - packages/app/android/**/* + - packages/app/common/**/* + - packages/app/example/android/**/* + - packages/app/scripts/*.js + - packages/app/scripts/configure.mjs + - packages/app/scripts/embed-manifest/kotlin.mjs + - packages/app/scripts/embed-manifest/main.mjs + - packages/app/scripts/embed-manifest/validate.mjs + - packages/app/scripts/init.mjs + - packages/app/scripts/template.mjs + - packages/app/test-app.gradle "platform: iOS": - changed-files: - any-glob-to-any-file: @@ -24,19 +24,19 @@ - .github/actions/setup-toolchain/* - .github/workflows/build.yml - Gemfile* - - ReactTestApp-DevSupport.podspec - - common/**/* - - example/ios/**/* - - ios/**/* - - scripts/*.js - - scripts/configure.mjs - - scripts/embed-manifest/main.mjs - - scripts/embed-manifest/swift.mjs - - scripts/embed-manifest/validate.mjs - - scripts/init.mjs - - scripts/template.mjs - - scripts/build/xcodebuild.sh - - test_app.rb + - packages/app/ReactTestApp-DevSupport.podspec + - packages/app/common/**/* + - packages/app/example/ios/**/* + - packages/app/ios/**/* + - packages/app/scripts/*.js + - packages/app/scripts/configure.mjs + - packages/app/scripts/embed-manifest/main.mjs + - packages/app/scripts/embed-manifest/swift.mjs + - packages/app/scripts/embed-manifest/validate.mjs + - packages/app/scripts/init.mjs + - packages/app/scripts/template.mjs + - packages/app/scripts/build/xcodebuild.sh + - packages/app/test_app.rb "platform: macOS": - changed-files: - any-glob-to-any-file: @@ -45,25 +45,25 @@ - .github/actions/setup-toolchain/* - .github/workflows/build.yml - Gemfile* - - ReactTestApp-DevSupport.podspec - - common/**/* - - example/macos/**/* - - ios/*.rb - - ios/ReactTestApp/Manifest.swift - - ios/ReactTestApp/React+Compatibility.{h,m} - - ios/ReactTestApp/ReactInstance.swift - - ios/ReactTestApp/ReactTestApp-Bridging-Header.h - - ios/ReactTestApp/Session.swift - - ios/ReactTestApp/UIViewController+ReactTestApp.{h,m} - - macos/**/* - - scripts/*.js - - scripts/configure.mjs - - scripts/embed-manifest/main.mjs - - scripts/embed-manifest/swift.mjs - - scripts/embed-manifest/validate.mjs - - scripts/init.mjs - - scripts/template.mjs - - scripts/build/xcodebuild.sh + - packages/app/ReactTestApp-DevSupport.podspec + - packages/app/common/**/* + - packages/app/example/macos/**/* + - packages/app/ios/*.rb + - packages/app/ios/ReactTestApp/Manifest.swift + - packages/app/ios/ReactTestApp/React+Compatibility.{h,m} + - packages/app/ios/ReactTestApp/ReactInstance.swift + - packages/app/ios/ReactTestApp/ReactTestApp-Bridging-Header.h + - packages/app/ios/ReactTestApp/Session.swift + - packages/app/ios/ReactTestApp/UIViewController+ReactTestApp.{h,m} + - packages/app/macos/**/* + - packages/app/scripts/*.js + - packages/app/scripts/configure.mjs + - packages/app/scripts/embed-manifest/main.mjs + - packages/app/scripts/embed-manifest/swift.mjs + - packages/app/scripts/embed-manifest/validate.mjs + - packages/app/scripts/init.mjs + - packages/app/scripts/template.mjs + - packages/app/scripts/build/xcodebuild.sh "platform: visionOS": - changed-files: - any-glob-to-any-file: @@ -72,34 +72,34 @@ - .github/actions/setup-toolchain/* - .github/workflows/build.yml - Gemfile* - - ReactTestApp-DevSupport.podspec - - common/**/* - - example/visionos/**/* - - ios/*.rb - - ios/ReactTestApp/*.{h,m,mm,swift} - - scripts/*.js - - scripts/configure.mjs - - scripts/embed-manifest/main.mjs - - scripts/embed-manifest/swift.mjs - - scripts/embed-manifest/validate.mjs - - scripts/init.mjs - - scripts/template.mjs - - scripts/build/xcodebuild.sh - - visionos/**/* + - packages/app/ReactTestApp-DevSupport.podspec + - packages/app/common/**/* + - packages/app/example/visionos/**/* + - packages/app/ios/*.rb + - packages/app/ios/ReactTestApp/*.{h,m,mm,swift} + - packages/app/scripts/*.js + - packages/app/scripts/configure.mjs + - packages/app/scripts/embed-manifest/main.mjs + - packages/app/scripts/embed-manifest/swift.mjs + - packages/app/scripts/embed-manifest/validate.mjs + - packages/app/scripts/init.mjs + - packages/app/scripts/template.mjs + - packages/app/scripts/build/xcodebuild.sh + - packages/app/visionos/**/* "platform: Windows": - changed-files: - any-glob-to-any-file: - .github/actions/init-test-app/* - .github/actions/setup-toolchain/* - .github/workflows/build.yml - - common/**/* - - example/windows/**/* - - scripts/*.ps1 - - scripts/*.js - - scripts/configure.mjs - - scripts/embed-manifest/cpp.mjs - - scripts/embed-manifest/main.mjs - - scripts/embed-manifest/validate.mjs - - scripts/init.mjs - - scripts/template.mjs - - windows/**/* + - packages/app/common/**/* + - packages/app/example/windows/**/* + - packages/app/scripts/*.ps1 + - packages/app/scripts/*.js + - packages/app/scripts/configure.mjs + - packages/app/scripts/embed-manifest/cpp.mjs + - packages/app/scripts/embed-manifest/main.mjs + - packages/app/scripts/embed-manifest/validate.mjs + - packages/app/scripts/init.mjs + - packages/app/scripts/template.mjs + - packages/app/windows/**/* diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d747bc82b..4fe21750b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -71,6 +71,7 @@ jobs: fi git diff --exit-code shell: bash + working-directory: packages/app - name: ClangFormat if: ${{ github.event_name == 'pull_request' && runner.os == 'macOS' }} env: @@ -79,7 +80,7 @@ jobs: # TODO: GITHUB_TOKEN is not set if a PR comes from a forked repo. # Ignore errors until we can create a GitHub PAT from a system # account. - scripts/build/clang-format-diff.sh || true + scripts/clang-format-diff.sh || true - name: CocoaPods if: ${{ runner.os == 'macOS' }} run: | @@ -89,13 +90,12 @@ jobs: echo "::add-matcher::.github/minitest.json" yarn test:rb echo "::remove-matcher owner=minitest::" - - name: Validate Gradle wrapper - uses: gradle/actions/wrapper-validation@v4 + working-directory: packages/app - name: Populate Gradle cache uses: ./.github/actions/gradle with: arguments: clean - project-root: example + project-root: packages/app/example - name: JavaScript env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -118,6 +118,7 @@ jobs: yarn tsc yarn test:js shell: bash + working-directory: packages/app - name: ktlint if: ${{ github.event_name == 'pull_request' && runner.os == 'macOS' }} run: | @@ -125,12 +126,14 @@ jobs: echo "::add-matcher::.github/ktlint.json" yarn lint:kt echo "::remove-matcher owner=ktlint::" + working-directory: packages/app - name: SwiftFormat if: ${{ github.event_name == 'pull_request' && runner.os == 'macOS' }} run: | echo "::add-matcher::.github/swiftformat.json" yarn format:swift --lint echo "::remove-matcher owner=swiftformat::" + working-directory: packages/app - name: SwiftLint if: ${{ runner.os == 'macOS' }} run: | @@ -138,9 +141,10 @@ jobs: echo "::add-matcher::.github/swiftlint.json" swiftlint echo "::remove-matcher owner=swiftlint::" + working-directory: packages/app - name: Smoke test `npx --package react-native-test-app@latest init` run: | - node ./react-native-test-app/scripts/init.mjs --destination app --name App -p android -p ios -p macos -p windows + node ./react-native-test-app/packages/app/scripts/init.mjs --destination app --name App -p android -p ios -p macos -p windows working-directory: .. - name: Smoke test `setup-react-native` action uses: ./.github/actions/setup-react-native @@ -161,7 +165,7 @@ jobs: uses: ./.github/actions/setup-toolchain with: platform: ios - project-root: example + project-root: packages/app/example cache-key-prefix: example xcode-developer-dir: /Applications/Xcode_16.4.app/Contents/Developer - name: Set up react-native@nightly @@ -175,8 +179,8 @@ jobs: immutable: ${{ github.event_name != 'schedule' }} - name: Bundle JavaScript run: | - yarn build:ios || yarn build:ios - working-directory: example + yarn build:ios + working-directory: packages/app/example - name: Determine whether the iOS app needs to be built id: affected uses: ./.github/actions/affected @@ -185,22 +189,22 @@ jobs: uses: ./.github/actions/cocoapods with: project-directory: ios - working-directory: example + working-directory: packages/app/example - name: Build if: ${{ steps.affected.outputs.ios != '' }} run: | - ../scripts/build/xcodebuild.sh ios/Example.xcworkspace build-for-testing - working-directory: example + ../../../scripts/xcodebuild.sh ios/Example.xcworkspace build-for-testing + working-directory: packages/app/example - name: Test `react-native config` if: ${{ steps.affected.outputs.ios != '' }} run: | node --test test/config.test.mjs - working-directory: example + working-directory: packages/app/example - name: Test if: ${{ steps.affected.outputs.ios != '' }} run: | - ../scripts/build/xcodebuild.sh ios/Example.xcworkspace test-without-building - working-directory: example + ../../../scripts/xcodebuild.sh ios/Example.xcworkspace test-without-building + working-directory: packages/app/example timeout-minutes: 60 ios-template: name: "iOS [template]" @@ -220,7 +224,7 @@ jobs: uses: ./.github/actions/setup-toolchain with: platform: ios - project-root: example + project-root: packages/app/example cache-key-prefix: template-${{ matrix.template }} xcode-developer-dir: /Applications/Xcode_16.4.app/Contents/Developer - name: Initialize test app @@ -229,7 +233,7 @@ jobs: platform: ${{ matrix.template }} - name: Bundle JavaScript run: | - yarn build:ios || yarn build:ios + yarn build:ios working-directory: template-example - name: Determine whether the iOS app needs to be built id: affected @@ -242,12 +246,12 @@ jobs: - name: Build if: ${{ steps.affected.outputs.ios != '' }} run: | - ../scripts/build/xcodebuild.sh ios/TemplateExample.xcworkspace build + ../scripts/xcodebuild.sh ios/TemplateExample.xcworkspace build working-directory: template-example - name: react-native run-ios if: ${{ steps.affected.outputs.ios != '' }} run: | - ../scripts/testing/react-native.mts run-ios + ../scripts/react-native.mts run-ios working-directory: template-example timeout-minutes: 60 android: @@ -278,15 +282,15 @@ jobs: - name: Test `react-native config` run: | node --test test/config.test.mjs - working-directory: example + working-directory: packages/app/example - name: Bundle JavaScript # Metro on nightlies currently fails with "SHA-1 for file index.js is # not computed" so we'll skip this step for now. if: ${{ github.event_name != 'schedule' || runner.os != 'Windows' }} run: | - yarn build:android || yarn build:android + yarn build:android shell: bash - working-directory: example + working-directory: packages/app/example - name: Determine whether the Android app needs to be built id: affected # Nightlies currently fail on Windows because of wrong path separators. @@ -296,7 +300,7 @@ jobs: if: ${{ steps.affected.outputs.android != '' }} uses: ./.github/actions/gradle with: - project-root: example + project-root: packages/app/example timeout-minutes: 60 android-template: name: "Android [template]" @@ -322,7 +326,7 @@ jobs: platform: ${{ matrix.template }} - name: Bundle JavaScript run: | - yarn build:android || yarn build:android + yarn build:android shell: bash working-directory: template-example - name: Determine whether the Android app needs to be built @@ -336,7 +340,7 @@ jobs: - name: react-native run-android if: ${{ steps.affected.outputs.android != '' }} run: | - ../scripts/testing/react-native.mts run-android + ../scripts/react-native.mts run-android working-directory: template-example timeout-minutes: 60 macos: @@ -354,7 +358,7 @@ jobs: uses: ./.github/actions/setup-toolchain with: platform: macos - project-root: example + project-root: packages/app/example cache-key-prefix: example xcode-developer-dir: /Applications/Xcode_16.4.app/Contents/Developer - name: Set up react-native@canary @@ -368,8 +372,8 @@ jobs: immutable: ${{ github.event_name != 'schedule' }} - name: Bundle JavaScript run: | - yarn build:macos || yarn build:macos - working-directory: example + yarn build:macos + working-directory: packages/app/example - name: Determine whether the macOS app needs to be built id: affected uses: ./.github/actions/affected @@ -378,22 +382,22 @@ jobs: uses: ./.github/actions/cocoapods with: project-directory: macos - working-directory: example + working-directory: packages/app/example - name: Build if: ${{ steps.affected.outputs.macos != '' }} run: | - ../scripts/build/xcodebuild.sh macos/Example.xcworkspace build-for-testing - working-directory: example + ../../../scripts/xcodebuild.sh macos/Example.xcworkspace build-for-testing + working-directory: packages/app/example - name: Test `react-native config` if: ${{ steps.affected.outputs.macos != '' }} run: | node --test test/config.test.mjs - working-directory: example + working-directory: packages/app/example - name: Test if: ${{ steps.affected.outputs.macos != '' && github.event_name != 'schedule' }} run: | - ../scripts/build/xcodebuild.sh macos/Example.xcworkspace test-without-building - working-directory: example + ../../../scripts/xcodebuild.sh macos/Example.xcworkspace test-without-building + working-directory: packages/app/example timeout-minutes: 60 macos-template: name: "macOS [template]" @@ -413,7 +417,7 @@ jobs: uses: ./.github/actions/setup-toolchain with: platform: macos - project-root: example + project-root: packages/app/example cache-key-prefix: template-${{ matrix.template }} xcode-developer-dir: /Applications/Xcode_16.4.app/Contents/Developer - name: Initialize test app @@ -422,7 +426,7 @@ jobs: platform: ${{ matrix.template }} - name: Bundle JavaScript run: | - yarn build:macos || yarn build:macos + yarn build:macos working-directory: template-example - name: Determine whether the macOS app needs to be built id: affected @@ -438,7 +442,7 @@ jobs: - name: Build if: ${{ steps.affected.outputs.macos != '' }} run: | - ../scripts/build/xcodebuild.sh macos/TemplateExample.xcworkspace build + ../scripts/xcodebuild.sh macos/TemplateExample.xcworkspace build working-directory: template-example timeout-minutes: 60 visionos: @@ -456,7 +460,7 @@ jobs: uses: ./.github/actions/setup-toolchain with: platform: visionos - project-root: example + project-root: packages/app/example cache-key-prefix: example xcode-developer-dir: /Applications/Xcode_16.4.app/Contents/Developer - name: Set up react-native@nightly @@ -470,8 +474,8 @@ jobs: immutable: ${{ github.event_name != 'schedule' }} - name: Bundle JavaScript run: | - yarn build:visionos || yarn build:visionos - working-directory: example + yarn build:visionos + working-directory: packages/app/example - name: Determine whether the visionOS app needs to be built id: affected uses: ./.github/actions/affected @@ -480,17 +484,17 @@ jobs: uses: ./.github/actions/cocoapods with: project-directory: visionos - working-directory: example + working-directory: packages/app/example - name: Build if: ${{ steps.affected.outputs.visionos != '' }} run: | - ../scripts/build/xcodebuild.sh visionos/Example.xcworkspace build-for-testing - working-directory: example + ../../../scripts/xcodebuild.sh visionos/Example.xcworkspace build-for-testing + working-directory: packages/app/example - name: Test `react-native config` if: ${{ steps.affected.outputs.visionos != '' }} run: | node --test test/config.test.mjs - working-directory: example + working-directory: packages/app/example timeout-minutes: 60 visionos-template: name: "visionOS [template]" @@ -510,7 +514,7 @@ jobs: uses: ./.github/actions/setup-toolchain with: platform: visionos - project-root: example + project-root: packages/app/example cache-key-prefix: template-${{ matrix.template }} xcode-developer-dir: /Applications/Xcode_16.4.app/Contents/Developer - name: Initialize test app @@ -519,7 +523,7 @@ jobs: platform: ${{ matrix.template }} - name: Bundle JavaScript run: | - yarn build:visionos || yarn build:visionos + yarn build:visionos working-directory: template-example - name: Determine whether the visionOS app needs to be built id: affected @@ -532,7 +536,7 @@ jobs: - name: Build if: ${{ steps.affected.outputs.visionos != '' }} run: | - ../scripts/build/xcodebuild.sh visionos/TemplateExample.xcworkspace build + ../scripts/xcodebuild.sh visionos/TemplateExample.xcworkspace build working-directory: template-example timeout-minutes: 60 windows: @@ -567,12 +571,12 @@ jobs: yarn build:windows - name: Generate Visual Studio solution run: | - yarn install-windows-test-app --use-nuget --msbuildprops WindowsTargetPlatformVersion=10.0.26100.0 - working-directory: example + node ../windows/app.mjs --use-nuget --msbuildprops WindowsTargetPlatformVersion=10.0.26100.0 + working-directory: packages/app/example - name: Test `react-native config` run: | node --test test/config.test.mjs - working-directory: example + working-directory: packages/app/example - name: Determine whether the Windows app needs to be built id: affected uses: ./.github/actions/affected @@ -584,13 +588,13 @@ jobs: } else { yarn ci:windows --arch ${{ matrix.platform }} } - working-directory: example/windows + working-directory: packages/app/example/windows - name: Test if: ${{ steps.affected.outputs.windows != '' && matrix.platform == 'x64' }} run: | ../../../scripts/build/MSBuild.ps1 -Configuration ${{ matrix.configuration }} -Platform ${{ matrix.platform }} -Target Build ReactAppTests.vcxproj ../../../scripts/build/VSTest.ps1 ${{ matrix.platform }}\${{ matrix.configuration }}\ReactAppTests.dll - working-directory: example/windows/ReactAppTests + working-directory: packages/app/example/windows/ReactAppTests timeout-minutes: 60 windows-template: name: "Windows [template]" @@ -617,6 +621,7 @@ jobs: - name: Bundle JavaScript run: | yarn build:windows + working-directory: template-example - name: Generate Visual Studio solution run: | yarn install-windows-test-app --use-nuget --msbuildprops WindowsTargetPlatformVersion=10.0.26100.0 @@ -659,6 +664,7 @@ jobs: - name: Verify tarball content run: | yarn test test/pack.test.ts + working-directory: packages/app - name: Release (dry run) if: ${{ github.ref != 'refs/heads/trunk' }} run: | diff --git a/.gitignore b/.gitignore index ff63f2341..12a90f89a 100644 --- a/.gitignore +++ b/.gitignore @@ -18,17 +18,17 @@ !.yarn/plugins/ !.yarn/releases/ Pods/ -android/**/build/ clang-format-diff.py coverage/ -example/*/DerivedData/ -example/*/build/ -example/Screenshot-*.png local.properties msbuild.binlog node_modules/ !test/__fixtures__/**/node_modules/ package-lock.json +packages/app/android/**/build/ +packages/app/example/*/DerivedData/ +packages/app/example/*/build/ +packages/app/example/Screenshot-*.png report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json template-example/ xcuserdata/ diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index eee4a157c..000000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "editor.formatOnSave": true, - "files.associations": { - "any": "cpp", - "fstream": "cpp", - "iostream": "cpp", - "map": "cpp", - "optional": "cpp", - "string": "cpp", - "vector": "cpp" - }, - "react-native-tools.projectRoot": "./example" -} diff --git a/.yarn/plugins/clean.cjs b/.yarn/plugins/clean.cjs index 492967646..dc8df6cec 100644 --- a/.yarn/plugins/clean.cjs +++ b/.yarn/plugins/clean.cjs @@ -9,17 +9,28 @@ module.exports = { factory: (require) => { // @ts-expect-error Yarn internal package const { BaseCommand } = require("@yarnpkg/cli"); + // @ts-expect-error Yarn internal package + const { Configuration, Project } = require("@yarnpkg/core"); + // @ts-expect-error Yarn internal package + const { npath } = require("@yarnpkg/fslib"); class CleanCommand extends BaseCommand { static paths = [["clean"]]; async execute() { - const projectRoot = path.dirname(path.dirname(__dirname)); + const configuration = await Configuration.find( + this.context.cwd, + this.context.plugins + ); + const { project } = await Project.find(configuration, this.context.cwd); + const projectRoot = npath.fromPortablePath(project.cwd); // Remove the symlink first. On Windows, `git clean` resolves/traverses // the symlink, causing an infinite loop. const symlink = path.join( projectRoot, + "packages", + "app", "example", "node_modules", "react-native-test-app" diff --git a/.yarn/plugins/undo-bin-sorting.cjs b/.yarn/plugins/undo-bin-sorting.cjs index c4013dda3..670effba1 100644 --- a/.yarn/plugins/undo-bin-sorting.cjs +++ b/.yarn/plugins/undo-bin-sorting.cjs @@ -34,11 +34,25 @@ module.exports = { /** @type {(project: Project) => void} */ validateProject(project) { const projectRoot = npath.fromPortablePath(project.cwd); - manifestPath = path.join(projectRoot, "package.json"); + if (!fs.existsSync(path.join(projectRoot, ".git"))) { + // Nested workspaces inherit plugins, even if they don't need them + return; + } + + manifestPath = path.join( + projectRoot, + "packages", + "app", + "package.json" + ); orig_rawManifest = fs.readFileSync(manifestPath, asText); }, /** @type {(project: Project, options: InstallOptions) => void} */ afterAllInstalled() { + if (!manifestPath) { + return; + } + const rawManifest = fs.readFileSync(manifestPath, asText); if (rawManifest === orig_rawManifest) { return; diff --git a/.yarnrc.yml b/.yarnrc.yml index 1205031cc..8607f3b79 100644 --- a/.yarnrc.yml +++ b/.yarnrc.yml @@ -2,6 +2,7 @@ compressionLevel: 0 enableGlobalCache: false enableScripts: false enableTelemetry: false +globalFolder: .yarn/berry # Workaround for 'EXDEV: cross-device link not permitted' errors on GHA logFilters: - code: YN0007 # X must be built because it never has been before or the last one failed level: discard @@ -11,10 +12,27 @@ logFilters: level: discard - code: YN0069 # This rule seems redundant when applied on the original package level: error -nodeLinker: node-modules +nodeLinker: pnpm npmRegistryServer: "https://registry.npmjs.org" packageExtensions: - react-native-windows@*: + "@callstack/react-native-visionos@0.78": + dependencies: + "@react-native-community/cli": ^15.0.1 + "@react-native-community/cli-platform-apple": ^15.0.1 + "@react-native-community/cli-platform-ios": ^15.0.1 + react-native@0.78: + dependencies: + # https://github.com/facebook/react-native/pull/47304 + "@react-native-community/cli": ^15.0.1 + # https://github.com/facebook/react-native/pull/47308 + "@react-native-community/cli-platform-android": ^15.0.1 + "@react-native-community/cli-platform-ios": ^15.0.1 + react-native-macos@0.78: + dependencies: + "@react-native-community/cli": ^15.0.1 + "@react-native-community/cli-platform-apple": ^15.0.1 + "@react-native-community/cli-platform-ios": ^15.0.1 + react-native-windows@0.78: peerDependenciesMeta: "@types/react": optional: true @@ -22,7 +40,6 @@ plugins: - path: .yarn/plugins/@yarnpkg/plugin-compat.cjs spec: "@yarnpkg/plugin-compat" - path: .yarn/plugins/clean.cjs - - path: .yarn/plugins/link-project.cjs - path: .yarn/plugins/boost-workaround.cjs - path: .yarn/plugins/npm-workaround.cjs - path: .yarn/plugins/undo-bin-sorting.cjs diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ac68d5b69..72abaa537 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -189,10 +189,10 @@ node --test test/pack.test.mjs ## Testing Specific React Native Versions `react-native-test-app` supports multiple versions of React Native. Use -`set-react-version` to set the version, e.g. to use 0.73: +`set-react-version` to set the version, e.g. to use 0.80: ```sh -npm run set-react-version 0.73 +npm run set-react-version 0.80 ``` This will modify both `package.json` and `example/package.json` to use packages @@ -218,11 +218,11 @@ update the title and fill out all the required fields. You can find the relevant discussion link at [`react-native-releases`][]. Use the [`test:matrix`][] script to both test and capture screenshots. We'll -need the screenshots for the PR we'll create later. For instance, to test 0.73, +need the screenshots for the PR we'll create later. For instance, to test 0.80, run: ```sh -npm run test:matrix 0.73 +npm run test:matrix 0.80 ``` At the minimum, we should be testing the lowest supported version (0.66 at the @@ -257,13 +257,13 @@ If the test script succeeds, we are ready to open a PR: - The test script we ran should have generated screenshots for the table ```markdown -| Configuration | JSC | Hermes | Fabric | Fabric + Hermes | -| :------------ | :-: | :----: | :----: | :-------------: | -| Android | n/a | TODO | n/a | TODO | -| iOS | n/a | TODO | n/a | TODO | -| macOS | n/a | TODO | n/a | TODO | -| visionOS | n/a | TODO | n/a | TODO | -| Windows | n/a | TODO | n/a | TODO | +| Configuration | Fabric | Fabric + Hermes | +| :------------ | :----: | :-------------: | +| Android | n/a | TODO | +| iOS | n/a | TODO | +| macOS | n/a | TODO | +| visionOS | n/a | TODO | +| Windows | n/a | TODO | ``` While the PR is open: diff --git a/android/app/build.gradle b/android/app/build.gradle deleted file mode 100644 index 14b9142aa..000000000 --- a/android/app/build.gradle +++ /dev/null @@ -1,318 +0,0 @@ -buildscript { - def androidDir = "${buildscript.sourceFile.getParent()}/../" - apply(from: "${androidDir}/autolink.gradle") - apply(from: "${androidDir}/dependencies.gradle") - apply(from: "${androidDir}/manifest.gradle") -} - -plugins { - id("com.android.application") - id("org.jetbrains.kotlin.android") -} - -// `react-native run-android` is hard-coded to look for the output APK at a very -// specific location. See -// https://github.com/react-native-community/cli/blob/6cf12b00c02aca6d4bc843446394331d71a9749e/packages/platform-android/src/commands/runAndroid/index.ts#L180 -buildDir = "${rootDir}/${name}/build" - -def reactNativePath = file(findNodeModulesPath("react-native", rootDir)) - -if (autodetectReactNativeVersion || enableNewArchitecture) { - apply(plugin: "com.facebook.react") - - react { - reactNativeDir = reactNativePath - codegenDir = file( - reactNativeVersion >= v(0, 72, 0) - ? findNodeModulesPath("@react-native/codegen", reactNativePath) - : findNodeModulesPath("react-native-codegen", reactNativePath) - ) - } - - // We don't want the React plugin to bundle. - tasks.whenTaskAdded { task -> - // The task name can be found in `react-native-gradle-plugin`: - // https://github.com/facebook/react-native/blob/0.71-stable/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/TaskConfiguration.kt#L54 - if (task.name.startsWith("createBundle") && task.name.endsWith("JsAndAssets")) { - task.enabled = false - } - } -} - -repositories { - maven { - url = uri("${reactNativePath}/android") - } - - mavenCentral() - google() - - // https://github.com/AzureAD/microsoft-authentication-library-for-android#step-1-declare-dependency-on-msal - maven { - url = uri("https://pkgs.dev.azure.com/MicrosoftDeviceSDK/DuoSDK-Public/_packaging/Duo-SDK-Feed/maven/v1") - } -} - -apply(from: "${projectDir}/../../test-app.gradle") -applyTestAppModule(project) - -project.ext.react = [ - abiSplit : false, - appName : getAppName(), - applicationId : getApplicationId(), - architectures : getArchitectures(project), - bundleInRelease : false, - enableCamera : !getSingleAppMode(), - enableHermes : true, - enableNewArchitecture: enableNewArchitecture, -] - -project.ext.signingConfigs = getSigningConfigs() - -android { - namespace = "com.microsoft.reacttestapp" - - compileSdkVersion = project.ext.compileSdkVersion - - if (project.hasProperty("ndkVersion")) { - ndkVersion = project.ext.ndkVersion - } - - if (usePrefabs) { - buildFeatures { - prefab = true - } - } - - kotlinOptions { - allWarningsAsErrors = true - } - - defaultConfig { - applicationId = project.ext.react.applicationId - minSdkVersion = project.ext.minSdkVersion - targetSdkVersion = project.ext.targetSdkVersion - versionCode = project.ext.getVersionCode() - versionName = project.ext.getVersionName() - - def singleApp = getSingleAppMode() - buildConfigField("String", "REACTAPP_SINGLE_APP", singleApp ? "\"${singleApp}\"" : "null") - - buildConfigField("boolean", "REACTAPP_USE_FABRIC", enableNewArchitecture.toString()) - buildConfigField("boolean", "REACTAPP_USE_BRIDGELESS", enableBridgeless.toString()) - - manifestPlaceholders = [ - rntaEnableCamera: project.ext.react.enableCamera ? "1000000" : "1" - ] - - resValue("string", "app_name", project.ext.react.appName) - - def cppStd = reactNativeVersion >= v(0, 74, 0) ? "-std=c++20" : "-std=c++17" - if (enableNewArchitecture) { - externalNativeBuild { - cmake { - arguments("-DANDROID_STL=c++_shared", - "-DNODE_MODULES_DIR=${reactNativePath}/..", - "-DPROJECT_BUILD_DIR=${buildDir}", - "-DREACT_ANDROID_BUILD_DIR=${reactNativePath}/ReactAndroid/build", - "-DREACT_ANDROID_DIR=${reactNativePath}/ReactAndroid") - cppFlags(cppStd, "-frtti", "-fexceptions", "-DWITH_INSPECTOR=1") - } - } - if (!project.ext.react.abiSplit) { - ndk { - abiFilters(*project.ext.react.architectures) - } - } - } else { - externalNativeBuild { - cmake { - arguments("-DANDROID_STL=c++_shared", - "-DREACT_COMMON_DIR=${reactNativePath}/ReactCommon", - "-DREACT_JNILIBS_DIR=${buildDir}/outputs/jniLibs") - cppFlags(cppStd, "-Wall", "-Werror", "-frtti", "-fexceptions", "-DWITH_INSPECTOR=1") - } - } - } - } - - externalNativeBuild { - cmake { - path = "${projectDir}/src/main/jni/CMakeLists.txt" - } - } - - if (!enableNewArchitecture && !usePrefabs) { - def version = getPackageVersion("react-native", rootDir) - def allAar = file("${reactNativePath}/android/com/facebook/react/react-native/${version}/react-native-${version}.aar") - - def prepareDebugJSI = tasks.register("prepareDebugJSI", Copy) { - def debugAar = file("${reactNativePath}/android/com/facebook/react/react-native/${version}/react-native-${version}-debug.aar") - from(zipTree(debugAar.exists() ? debugAar : allAar).matching({ it.include "**/libjsi.so" })) - into("${buildDir}/outputs/jniLibs/debug") - } - - def prepareReleaseJSI = tasks.register("prepareReleaseJSI", Copy) { - def releaseAar = file("${reactNativePath}/android/com/facebook/react/react-native/${version}/react-native-${version}-release.aar") - from(zipTree(releaseAar.exists() ? releaseAar : allAar).matching({ it.include "**/libjsi.so" })) - into("${buildDir}/outputs/jniLibs/release") - } - - afterEvaluate { - preDebugBuild.dependsOn(prepareDebugJSI) - preReleaseBuild.dependsOn(prepareReleaseJSI) - } - } - - lintOptions { - lintConfig = file("lint.xml") - } - - packagingOptions { - pickFirst("lib/armeabi-v7a/libc++_shared.so") - pickFirst("lib/arm64-v8a/libc++_shared.so") - pickFirst("lib/x86_64/libc++_shared.so") - pickFirst("lib/x86/libc++_shared.so") - } - - project.ext.signingConfigs.each { name, config -> - def signingConfig = signingConfigs.findByName(name) ?: signingConfigs.create(name) - signingConfig.keyAlias = config["keyAlias"] - signingConfig.keyPassword = config["keyPassword"] - signingConfig.storeFile = config["storeFile"] - signingConfig.storePassword = config["storePassword"] - - def buildType = buildTypes.findByName(name) ?: buildTypes.create(name) - buildType.signingConfig = signingConfigs[name] - } - if (buildTypes.release.signingConfig == null) { - logger.warn("Signing config for 'release' build type not found; reusing debug config") - buildTypes.release.signingConfig = signingConfigs.debug - } - - sourceSets { - main.java.srcDirs += [ - project.ext.react.enableCamera ? "src/camera/java" : "src/no-camera/java", - - !enableNewArchitecture - ? "src/old-arch/java" - : reactNativeVersion >= v(0, 81, 0) - ? "src/new-arch-0.81/java" - : reactNativeVersion >= v(0, 73, 0) - ? "src/new-arch-0.73/java" - : "src/new-arch/java", - - // TODO: Remove this block when we drop support for 0.74 - // https://github.com/facebook/react-native/commit/3283202248a36dbda553745afc46a3e3e2ab41a6 - reactNativeVersion >= v(0, 75, 0) - ? "src/reactactivitydelegate-0.75/java" - // TODO: Remove this block when we drop support for 0.73 - : reactNativeVersion >= v(0, 74, 0) - ? "src/reactactivitydelegate-0.74/java" - // TODO: Remove this block when we drop support for 0.71 - // https://github.com/facebook/react-native/commit/e5dd9cdc6688e63e75a7e0bebf380be1a9a5fe2b - : reactNativeVersion >= v(0, 72, 0) - ? "src/reactactivitydelegate-0.72/java" - : "src/reactactivitydelegate-pre-0.72/java", - - // TODO: Remove this block when we drop support for 0.74 - // https://github.com/facebook/react-native/commit/a1e81185416a53c7c7d0cfc67e40079fd0073e7c - reactNativeVersion >= v(0, 75, 0) - ? "src/devserverhelper-0.75/java" - // TODO: Remove this block when we drop support for 0.73 - // https://github.com/facebook/react-native/commit/cfa02eec50469059542ccbacbc51643b525ad461 - : reactNativeVersion >= v(0, 74, 0) - ? "src/devserverhelper-0.74/java" - // TODO: Remove this block when we drop support for 0.72 - // https://github.com/facebook/react-native/commit/da358d0ec7a492edb804b9cdce70e7516ee518ae - : reactNativeVersion >= v(0, 73, 0) - ? "src/devserverhelper-0.73/java" - : "src/devserverhelper-pre-0.73/java", - - // TODO: Remove this block when we drop support for 0.75 - // https://github.com/react-native-community/template/commit/f738a366b194dd21d4d2bc14c9215b630714dd70 - reactNativeVersion >= v(0, 76, 0) - ? "src/reactapplication-0.76/java" - // TODO: Remove this block when we drop support for 0.72 - // https://github.com/facebook/react-native/commit/c3f672cef7d4f287d3d729d33650f917ed132a0c - : reactNativeVersion < v(0, 73, 0) - ? "src/reactapplication-pre-0.73/java" - : "src/reactapplication-0.73/java", - - // TODO: Remove this block when we drop support for 0.75 - // https://github.com/react-native-community/template/commit/f738a366b194dd21d4d2bc14c9215b630714dd70 - reactNativeVersion >= v(0, 76, 0) - ? "src/reacthost-0.76/java" - : "src/reacthost-legacy/java", - ] - } - - splits { - abi { - reset() - enable = project.ext.react.abiSplit - universalApk = false - include(*project.ext.react.architectures) - } - } -} - -dependencies { - implementation project(":support") - - if (project.ext.react.enableHermes) { - if (autodetectReactNativeVersion) { - implementation("com.facebook.react:hermes-android") - } else { - implementation("com.facebook.react:hermes-engine:+") { - exclude(group: "com.facebook.fbjni") - } - } - } - - if (autodetectReactNativeVersion) { - implementation("com.facebook.react:react-android") - } else { - def version = getPackageVersion("react-native", rootDir) - implementation("com.facebook.react:react-native:${version}") - } - - implementation(libraries.androidAppCompat) - implementation(libraries.androidCoreKotlinExtensions) - implementation(libraries.androidRecyclerView) - implementation(libraries.materialComponents) - - if (project.ext.react.enableCamera) { - implementation(libraries.androidCamera) - implementation(libraries.androidCameraMlKitVision) - implementation(libraries.mlKitBarcodeScanning) - } - - if (reactNativeVersion == 0 || reactNativeVersion >= v(0, 75, 0)) { - // https://github.com/facebook/react-native/blob/b0c0bb45911434ea654ba7e2feff4686061eba7a/packages/react-native-gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/ReactExtension.kt#L162 - def dependencies = autolinkingInfo(buildDir) - dependencies.each { path, info -> - info.configurations.each { configuration -> - add(configuration, project(path)) - } - } - } -} - -if (!enableNewArchitecture && !usePrefabs) { - configurations.all { - resolutionStrategy { - // Force version here otherwise Gradle will pick up a newer version: - // https://github.com/facebook/react-native/issues/35210 - def version = getPackageVersion("react-native", rootDir) - force("com.facebook.react:react-native:${version}") - force("com.facebook.react:hermes-engine:${version}") - } - } -} - -// `@react-native-community/cli` currently requires this function to be defined. -// See https://github.com/react-native-community/cli/blob/a87fb9014635fe84ab19a1a88d6ecbbc530eb4e2/packages/platform-android/native_modules.gradle#L497 -def isNewArchitectureEnabled() { - return isFabricEnabled(project) -} diff --git a/android/app/src/devserverhelper-0.73/java/com/microsoft/reacttestapp/react/DevServerHelperCompat.kt b/android/app/src/devserverhelper-0.73/java/com/microsoft/reacttestapp/react/DevServerHelperCompat.kt deleted file mode 100644 index 73038e639..000000000 --- a/android/app/src/devserverhelper-0.73/java/com/microsoft/reacttestapp/react/DevServerHelperCompat.kt +++ /dev/null @@ -1,15 +0,0 @@ -package com.microsoft.reacttestapp.react - -import android.content.Context -import com.facebook.react.devsupport.DevServerHelper -import com.facebook.react.devsupport.InspectorPackagerConnection.BundleStatus -import com.facebook.react.modules.debug.interfaces.DeveloperSettings -import com.facebook.react.packagerconnection.PackagerConnectionSettings - -fun createDevServerHelper(context: Context, developerSettings: DeveloperSettings): DevServerHelper = - DevServerHelper( - developerSettings, - context.packageName, - { BundleStatus() }, - PackagerConnectionSettings(context) - ) diff --git a/android/app/src/devserverhelper-0.74/java/com/microsoft/reacttestapp/react/DevServerHelperCompat.kt b/android/app/src/devserverhelper-0.74/java/com/microsoft/reacttestapp/react/DevServerHelperCompat.kt deleted file mode 100644 index 05c8d1b5f..000000000 --- a/android/app/src/devserverhelper-0.74/java/com/microsoft/reacttestapp/react/DevServerHelperCompat.kt +++ /dev/null @@ -1,13 +0,0 @@ -package com.microsoft.reacttestapp.react - -import android.content.Context -import com.facebook.react.devsupport.DevServerHelper -import com.facebook.react.modules.debug.interfaces.DeveloperSettings -import com.facebook.react.packagerconnection.PackagerConnectionSettings - -fun createDevServerHelper(context: Context, developerSettings: DeveloperSettings): DevServerHelper = - DevServerHelper( - developerSettings, - context.packageName, - PackagerConnectionSettings(context) - ) diff --git a/android/app/src/devserverhelper-pre-0.73/java/com/microsoft/reacttestapp/react/DevServerHelperCompat.kt b/android/app/src/devserverhelper-pre-0.73/java/com/microsoft/reacttestapp/react/DevServerHelperCompat.kt deleted file mode 100644 index d02d1dda5..000000000 --- a/android/app/src/devserverhelper-pre-0.73/java/com/microsoft/reacttestapp/react/DevServerHelperCompat.kt +++ /dev/null @@ -1,16 +0,0 @@ -package com.microsoft.reacttestapp.react - -import android.content.Context -import com.facebook.react.devsupport.DevInternalSettings -import com.facebook.react.devsupport.DevServerHelper -import com.facebook.react.devsupport.InspectorPackagerConnection.BundleStatus -import com.facebook.react.modules.debug.interfaces.DeveloperSettings - -fun createDevServerHelper( - context: Context, - @Suppress("UNUSED_PARAMETER") developerSettings: DeveloperSettings -): DevServerHelper = DevServerHelper( - DevInternalSettings(context) {}, - context.packageName, - { BundleStatus() } -) diff --git a/android/app/src/new-arch/java/com/microsoft/reacttestapp/compat/ReactNativeHostCompat.kt b/android/app/src/new-arch/java/com/microsoft/reacttestapp/compat/ReactNativeHostCompat.kt deleted file mode 100644 index 5de8f8d0d..000000000 --- a/android/app/src/new-arch/java/com/microsoft/reacttestapp/compat/ReactNativeHostCompat.kt +++ /dev/null @@ -1,29 +0,0 @@ -package com.microsoft.reacttestapp.compat - -import android.app.Application -import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint -import com.facebook.react.defaults.DefaultReactNativeHost -import com.facebook.soloader.SoLoader -import com.microsoft.reacttestapp.BuildConfig - -abstract class ReactNativeHostCompat(application: Application) : - DefaultReactNativeHost(application) { - - companion object { - init { - try { - DefaultNewArchitectureEntryPoint.load( - turboModulesEnabled = BuildConfig.REACTAPP_USE_FABRIC, - fabricEnabled = BuildConfig.REACTAPP_USE_FABRIC - ) - } catch (e: UnsatisfiedLinkError) { - // Older versions of `DefaultNewArchitectureEntryPoint` is - // hard coded to load `libappmodules.so` - } - SoLoader.loadLibrary("reacttestapp_appmodules") - } - } - - override val isNewArchEnabled: Boolean = BuildConfig.REACTAPP_USE_FABRIC - override val isHermesEnabled: Boolean? = true -} diff --git a/android/app/src/new-arch/java/com/microsoft/reacttestapp/fabric/ComponentsRegistry.kt b/android/app/src/new-arch/java/com/microsoft/reacttestapp/fabric/ComponentsRegistry.kt deleted file mode 100644 index e36c0d44a..000000000 --- a/android/app/src/new-arch/java/com/microsoft/reacttestapp/fabric/ComponentsRegistry.kt +++ /dev/null @@ -1,34 +0,0 @@ -package com.microsoft.reacttestapp.fabric - -import com.facebook.jni.HybridData -import com.facebook.proguard.annotations.DoNotStrip -import com.facebook.react.fabric.ComponentFactory -import com.facebook.soloader.SoLoader - -/** - * The corresponding C++ implementation is in `android/app/src/main/jni/ComponentsRegistry.cpp` - */ -@DoNotStrip -class ComponentsRegistry @DoNotStrip private constructor(componentFactory: ComponentFactory) { - - companion object { - @DoNotStrip - fun register(componentFactory: ComponentFactory): ComponentsRegistry = - ComponentsRegistry(componentFactory) - - init { - SoLoader.loadLibrary("fabricjni") - SoLoader.loadLibrary("reacttestapp_appmodules") - } - } - - @DoNotStrip - private val mHybridData: HybridData - - @DoNotStrip - private external fun initHybrid(componentFactory: ComponentFactory): HybridData - - init { - mHybridData = initHybrid(componentFactory) - } -} diff --git a/android/app/src/new-arch/java/com/microsoft/reacttestapp/turbomodule/TurboModuleManagerDelegate.kt b/android/app/src/new-arch/java/com/microsoft/reacttestapp/turbomodule/TurboModuleManagerDelegate.kt deleted file mode 100644 index 1f000981c..000000000 --- a/android/app/src/new-arch/java/com/microsoft/reacttestapp/turbomodule/TurboModuleManagerDelegate.kt +++ /dev/null @@ -1,37 +0,0 @@ -package com.microsoft.reacttestapp.turbomodule - -import com.facebook.jni.HybridData -import com.facebook.react.ReactPackage -import com.facebook.react.ReactPackageTurboModuleManagerDelegate -import com.facebook.react.bridge.ReactApplicationContext - -/** - * These type aliases are here to prevent `@react-native-community/cli` from - * marking them as native modules to autolink. - * - * See also `matchClassName` in - * https://github.com/react-native-community/cli/blob/8.x/packages/platform-android/src/config/findPackageClassName.ts#L25 - */ -typealias PackagesList = List -typealias ReactTurboModuleManagerDelegate = ReactPackageTurboModuleManagerDelegate -typealias ReactTurboModuleManagerDelegateBuilder = ReactPackageTurboModuleManagerDelegate.Builder - -/** - * The corresponding C++ implementation is in `android/app/src/main/jni/TurboModuleManagerDelegate.cpp` - */ -class TurboModuleManagerDelegate protected constructor( - reactApplicationContext: ReactApplicationContext?, - packages: PackagesList? -) : ReactTurboModuleManagerDelegate(reactApplicationContext, packages) { - - external override fun initHybrid(): HybridData - - external fun canCreateTurboModule(moduleName: String?): Boolean - - class Builder : ReactTurboModuleManagerDelegateBuilder() { - override fun build( - context: ReactApplicationContext?, - packages: PackagesList? - ): TurboModuleManagerDelegate = TurboModuleManagerDelegate(context, packages) - } -} diff --git a/android/app/src/reactactivitydelegate-0.72/java/com/microsoft/reacttestapp/component/ComponentActivityDelegate.kt b/android/app/src/reactactivitydelegate-0.72/java/com/microsoft/reacttestapp/component/ComponentActivityDelegate.kt deleted file mode 100644 index bc60daed1..000000000 --- a/android/app/src/reactactivitydelegate-0.72/java/com/microsoft/reacttestapp/component/ComponentActivityDelegate.kt +++ /dev/null @@ -1,27 +0,0 @@ -package com.microsoft.reacttestapp.component - -import android.os.Bundle -import com.facebook.react.ReactActivity -import com.facebook.react.ReactActivityDelegate -import com.facebook.react.ReactRootView -import com.microsoft.reacttestapp.BuildConfig - -class ComponentActivityDelegate(activity: ReactActivity, mainComponentName: String?) : - ReactActivityDelegate(activity, mainComponentName) { - - override fun getLaunchOptions(): Bundle? = plainActivity.intent.extras?.getBundle( - ComponentActivity.COMPONENT_INITIAL_PROPERTIES - ) - - override fun createRootView(): ReactRootView { - val rootView = super.createRootView() - rootView.setIsFabric(BuildConfig.REACTAPP_USE_FABRIC) - return rootView - } - - override fun createRootView(bundle: Bundle?): ReactRootView { - val rootView = super.createRootView(bundle) - rootView.setIsFabric(BuildConfig.REACTAPP_USE_FABRIC) - return rootView - } -} diff --git a/android/app/src/reactactivitydelegate-0.74/java/com/microsoft/reacttestapp/component/ComponentActivityDelegate.kt b/android/app/src/reactactivitydelegate-0.74/java/com/microsoft/reacttestapp/component/ComponentActivityDelegate.kt deleted file mode 100644 index fde3488a2..000000000 --- a/android/app/src/reactactivitydelegate-0.74/java/com/microsoft/reacttestapp/component/ComponentActivityDelegate.kt +++ /dev/null @@ -1,23 +0,0 @@ -package com.microsoft.reacttestapp.component - -import android.os.Bundle -import com.facebook.react.ReactActivity -import com.facebook.react.ReactActivityDelegate -import com.facebook.react.ReactRootView -import com.microsoft.reacttestapp.BuildConfig - -class ComponentActivityDelegate(activity: ReactActivity, mainComponentName: String?) : - ReactActivityDelegate(activity, mainComponentName) { - - override fun getLaunchOptions(): Bundle? = plainActivity.intent.extras?.getBundle( - ComponentActivity.COMPONENT_INITIAL_PROPERTIES - ) - - override fun isFabricEnabled(): Boolean = BuildConfig.REACTAPP_USE_FABRIC - - override fun createRootView(): ReactRootView = - ReactRootView(context).apply { setIsFabric(BuildConfig.REACTAPP_USE_FABRIC) } - - override fun createRootView(bundle: Bundle?): ReactRootView = - ReactRootView(context).apply { setIsFabric(BuildConfig.REACTAPP_USE_FABRIC) } -} diff --git a/android/app/src/reactactivitydelegate-pre-0.72/java/com/microsoft/reacttestapp/component/ComponentActivityDelegate.kt b/android/app/src/reactactivitydelegate-pre-0.72/java/com/microsoft/reacttestapp/component/ComponentActivityDelegate.kt deleted file mode 100644 index 40b65799a..000000000 --- a/android/app/src/reactactivitydelegate-pre-0.72/java/com/microsoft/reacttestapp/component/ComponentActivityDelegate.kt +++ /dev/null @@ -1,21 +0,0 @@ -package com.microsoft.reacttestapp.component - -import android.os.Bundle -import com.facebook.react.ReactActivity -import com.facebook.react.ReactActivityDelegate -import com.facebook.react.ReactRootView -import com.microsoft.reacttestapp.BuildConfig - -class ComponentActivityDelegate(activity: ReactActivity, mainComponentName: String?) : - ReactActivityDelegate(activity, mainComponentName) { - - override fun getLaunchOptions(): Bundle? = plainActivity.intent.extras?.getBundle( - ComponentActivity.COMPONENT_INITIAL_PROPERTIES - ) - - override fun createRootView(): ReactRootView { - val rootView = super.createRootView() - rootView.setIsFabric(BuildConfig.REACTAPP_USE_FABRIC) - return rootView - } -} diff --git a/android/app/src/reactapplication-0.73/java/com/microsoft/reacttestapp/TestApp.kt b/android/app/src/reactapplication-0.73/java/com/microsoft/reacttestapp/TestApp.kt deleted file mode 100644 index 768f155f6..000000000 --- a/android/app/src/reactapplication-0.73/java/com/microsoft/reacttestapp/TestApp.kt +++ /dev/null @@ -1,68 +0,0 @@ -package com.microsoft.reacttestapp - -import android.app.Activity -import android.app.Application -import android.content.Context -import com.facebook.react.PackageList -import com.facebook.react.ReactApplication -import com.facebook.react.ReactHost -import com.facebook.react.defaults.DefaultReactHost.getDefaultReactHost -import com.facebook.soloader.SoLoader -import com.microsoft.reacttestapp.manifest.Manifest -import com.microsoft.reacttestapp.manifest.ManifestProvider -import com.microsoft.reacttestapp.react.MainReactNativeHost -import com.microsoft.reacttestapp.react.ReactBundleNameProvider -import com.microsoft.reacttestapp.support.ReactTestAppLifecycleEvents - -class TestApp : - Application(), - ReactApplication { - - val bundleNameProvider: ReactBundleNameProvider - get() = reactNativeBundleNameProvider - - val manifest: Manifest by lazy { - ManifestProvider.manifest() - } - - override val reactHost: ReactHost - get() = getDefaultReactHost(this.applicationContext, reactNativeHost) - - override val reactNativeHost: MainReactNativeHost - get() = reactNativeHostInternal - - private lateinit var reactNativeBundleNameProvider: ReactBundleNameProvider - private lateinit var reactNativeHostInternal: MainReactNativeHost - - fun reloadJSFromServer(activity: Activity, bundleURL: String) { - reactNativeHostInternal.reloadJSFromServer(activity, bundleURL) - } - - override fun onCreate() { - super.onCreate() - - @Suppress("DEPRECATION") - SoLoader.init(this, false) - - reactNativeBundleNameProvider = ReactBundleNameProvider(this, manifest.bundleRoot) - reactNativeHostInternal = MainReactNativeHost(this, reactNativeBundleNameProvider) - - val eventConsumers = PackageList(this).packages - .filter { it is ReactTestAppLifecycleEvents } - .map { it as ReactTestAppLifecycleEvents } - - eventConsumers.forEach { it.onTestAppInitialized() } - - reactNativeHostInternal.init( - beforeReactNativeInit = { - eventConsumers.forEach { it.onTestAppWillInitializeReactNative() } - }, - afterReactNativeInit = { - eventConsumers.forEach { it.onTestAppDidInitializeReactNative() } - } - ) - } -} - -val Context.testApp: TestApp - get() = applicationContext as TestApp diff --git a/android/app/src/reactapplication-pre-0.73/java/com/microsoft/reacttestapp/TestApp.kt b/android/app/src/reactapplication-pre-0.73/java/com/microsoft/reacttestapp/TestApp.kt deleted file mode 100644 index be9e56932..000000000 --- a/android/app/src/reactapplication-pre-0.73/java/com/microsoft/reacttestapp/TestApp.kt +++ /dev/null @@ -1,62 +0,0 @@ -package com.microsoft.reacttestapp - -import android.app.Activity -import android.app.Application -import android.content.Context -import com.facebook.react.PackageList -import com.facebook.react.ReactApplication -import com.facebook.soloader.SoLoader -import com.microsoft.reacttestapp.manifest.Manifest -import com.microsoft.reacttestapp.manifest.ManifestProvider -import com.microsoft.reacttestapp.react.MainReactNativeHost -import com.microsoft.reacttestapp.react.ReactBundleNameProvider -import com.microsoft.reacttestapp.support.ReactTestAppLifecycleEvents - -class TestApp : - Application(), - ReactApplication { - - val bundleNameProvider: ReactBundleNameProvider - get() = reactNativeBundleNameProvider - - val manifest: Manifest by lazy { - ManifestProvider.manifest() - } - - private lateinit var reactNativeBundleNameProvider: ReactBundleNameProvider - private lateinit var reactNativeHostInternal: MainReactNativeHost - - fun reloadJSFromServer(activity: Activity, bundleURL: String) { - reactNativeHostInternal.reloadJSFromServer(activity, bundleURL) - } - - override fun onCreate() { - super.onCreate() - - @Suppress("DEPRECATION") - SoLoader.init(this, false) - - reactNativeBundleNameProvider = ReactBundleNameProvider(this, manifest.bundleRoot) - reactNativeHostInternal = MainReactNativeHost(this, reactNativeBundleNameProvider) - - val eventConsumers = PackageList(this).packages - .filter { it is ReactTestAppLifecycleEvents } - .map { it as ReactTestAppLifecycleEvents } - - eventConsumers.forEach { it.onTestAppInitialized() } - - reactNativeHostInternal.init( - beforeReactNativeInit = { - eventConsumers.forEach { it.onTestAppWillInitializeReactNative() } - }, - afterReactNativeInit = { - eventConsumers.forEach { it.onTestAppDidInitializeReactNative() } - } - ) - } - - override fun getReactNativeHost() = reactNativeHostInternal -} - -val Context.testApp: TestApp - get() = applicationContext as TestApp diff --git a/android/app/src/reacthost-legacy/java/com/microsoft/reacttetapp/react/MainReactNativeHost.kt b/android/app/src/reacthost-legacy/java/com/microsoft/reacttetapp/react/MainReactNativeHost.kt deleted file mode 100644 index c4e3003c0..000000000 --- a/android/app/src/reacthost-legacy/java/com/microsoft/reacttetapp/react/MainReactNativeHost.kt +++ /dev/null @@ -1,172 +0,0 @@ -package com.microsoft.reacttestapp.react - -import android.app.Activity -import android.app.Application -import android.content.Context -import android.content.Intent -import androidx.core.net.toUri -import com.facebook.hermes.reactexecutor.HermesExecutorFactory -import com.facebook.react.PackageList -import com.facebook.react.ReactInstanceEventListener -import com.facebook.react.ReactInstanceManager -import com.facebook.react.ReactPackage -import com.facebook.react.bridge.JavaScriptExecutorFactory -import com.facebook.react.bridge.ReactContext -import com.facebook.react.devsupport.interfaces.DevSupportManager -import com.facebook.react.packagerconnection.PackagerConnectionSettings -import com.microsoft.reacttestapp.BuildConfig -import com.microsoft.reacttestapp.MainActivity -import com.microsoft.reacttestapp.R -import java.util.Collections.synchronizedList -import java.util.concurrent.CountDownLatch - -@Suppress("TYPEALIAS_EXPANSION_DEPRECATION") -class MainReactNativeHost( - application: Application, - private val reactBundleNameProvider: ReactBundleNameProvider -) : com.microsoft.reacttestapp.compat.ReactNativeHostCompat(application) { - val jsExecutorName: String - get() = javaScriptExecutorFactory.toString() - - var source: BundleSource = - if (reactBundleNameProvider.bundleName == null || isPackagerRunning(application)) { - BundleSource.Server - } else { - BundleSource.Disk - } - - var onBundleSourceChanged: ((newSource: BundleSource) -> Unit)? = null - - private var currentActivityTracker = CurrentActivityTracker() - - private val reactInstanceEventListeners = - synchronizedList(arrayListOf()) - - fun init(beforeReactNativeInit: () -> Unit, afterReactNativeInit: () -> Unit) { - if (BuildConfig.DEBUG && hasInstance()) { - error("init() can only be called once on startup") - } - - application.registerActivityLifecycleCallbacks(currentActivityTracker) - - // When we reference `reactInstanceManager` below, `ReactNativeHost` will start creating a - // `ReactInstanceManager` instance. - beforeReactNativeInit() - - val reactInstanceListener = object : ReactInstanceEventListener { - override fun onReactContextInitialized(context: ReactContext) { - afterReactNativeInit() - - // proactively removing the listener to avoid leaking memory - // and to avoid dupe calls to afterReactNativeInit() - reactInstanceManager.removeReactInstanceEventListener(this) - } - } - - reactInstanceManager.addReactInstanceEventListener(reactInstanceListener) - } - - fun addReactInstanceEventListener(listener: ReactInstanceEventListener) { - reactInstanceEventListeners.add(listener) - reactInstanceManager.addReactInstanceEventListener(listener) - } - - fun reload(activity: Activity, newSource: BundleSource) { - val action = source.moveTo(newSource) - source = newSource - - when (action) { - BundleSource.Action.RELOAD -> { - reactInstanceManager.devSupportManager.handleReloadJS() - } - BundleSource.Action.RESTART -> { - if (activity !is MainActivity) { - activity.navigateUpTo(Intent(application, MainActivity.Companion::class.java)) - } - clear() - } - } - - onBundleSourceChanged?.invoke(newSource) - } - - fun reloadJSFromServer(activity: Activity, bundleURL: String) { - val uri = bundleURL.toUri() - PackagerConnectionSettings(activity).debugServerHost = - if (uri.port > 0) { - "${uri.host}:${uri.port}" - } else { - uri.host ?: "localhost" - } - reload(activity, BundleSource.Server) - } - - override fun createReactInstanceManager(): ReactInstanceManager { - val reactInstanceManager = super.createReactInstanceManager() - addCustomDevOptions(reactInstanceManager.devSupportManager) - - synchronized(reactInstanceEventListeners) { - val i = reactInstanceEventListeners.iterator() - while (i.hasNext()) { - reactInstanceManager.addReactInstanceEventListener(i.next()) - } - } - - return reactInstanceManager - } - - override fun getJavaScriptExecutorFactory(): JavaScriptExecutorFactory = HermesExecutorFactory() - - override fun getJSMainModuleName() = "index" - - // We may not always have (or need) a JS bundle, but - // `ReactNativeHost.createReactInstanceManager` asserts it so we need to - // return something. - override fun getBundleAssetName() = reactBundleNameProvider.bundleName ?: "main.android.bundle" - - override fun getUseDeveloperSupport() = source == BundleSource.Server - - override fun getPackages(): List = PackageList(application).packages - - private fun addCustomDevOptions(devSupportManager: DevSupportManager) { - val bundleOption = application.resources.getString( - if (source == BundleSource.Disk) { - R.string.load_from_dev_server - } else { - R.string.load_embedded_js_bundle - } - ) - devSupportManager.addCustomDevOption(bundleOption) { - currentActivityTracker.get()?.let { - when (source) { - BundleSource.Disk -> reload(it, BundleSource.Server) - BundleSource.Server -> reload(it, BundleSource.Disk) - } - } - } - } - - private fun isPackagerRunning(context: Context): Boolean { - if (!hasInstance()) { - // Return early otherwise we will get in an initialization loop. - // `source` may be initialized by calling this function. Without - // this check, the `getReactInstanceManager()` call below will - // instantiate `ReactInstanceManager`, which in turn will try to - // access `source`. - return BuildConfig.DEBUG - } - - val latch = CountDownLatch(1) - var packagerIsRunning = false - - reactInstanceManager.devSupportManager.devSettings?.let { devSettings -> - createDevServerHelper(context, devSettings).isPackagerRunning { - packagerIsRunning = it - latch.countDown() - } - } - - latch.await() - return packagerIsRunning - } -} diff --git a/android/react-native.gradle b/android/react-native.gradle deleted file mode 100644 index a7e913beb..000000000 --- a/android/react-native.gradle +++ /dev/null @@ -1,71 +0,0 @@ -ext.rnta_react_native_gradle = true - -if (!hasProperty("rnta_node_gradle")) { - apply(from: "${buildscript.sourceFile.getParent()}/node.gradle") -} - -ext.isBridgelessEnabled = { Project project, boolean isNewArchEnabled -> - if (isNewArchEnabled) { - def bridgelessEnabled = project.findProperty("react.bridgelessEnabled") - ?: project.findProperty("bridgelessEnabled") - - def version = getPackageVersionNumber("react-native", project.rootDir) - if (version >= v(0, 82, 0)) { - if (bridgelessEnabled != null) { - logger.warn("WARNING: As of 0.82, bridgeless can no longer be disabled") - } - return true - } - - if (bridgelessEnabled != "false") { - def isSupported = version == 0 || version >= v(0, 73, 0) - - if (bridgelessEnabled == "true") { - if (!isSupported) { - logger.warn([ - "WARNING: react-native 0.73 or greater is required for", - "Bridgeless Mode — disable `bridgelessEnabled` in your", - "`gradle.properties` or upgrade `react-native`" - ].join(" ")) - } - return isSupported - } - - // https://github.com/facebook/react-native/commit/fe337f25be65b67dc3d8d99d26a61ffd26985dd8 - def isEnabledByDefault = version == 0 || version >= v(0, 74, 0) - return isSupported && isEnabledByDefault - } - } - return false -} - -ext.isFabricEnabled = { Project project -> - return isNewArchitectureEnabled(project) -} - -ext.isNewArchitectureEnabled = { Project project -> - def newArchEnabled = project.findProperty("react.newArchEnabled") - ?: project.findProperty("newArchEnabled") - - def version = getPackageVersionNumber("react-native", project.rootDir) - if (version >= v(0, 82, 0)) { - if (newArchEnabled != null) { - logger.warn("WARNING: As of 0.82, New Architecture can no longer be disabled") - } - return true - } - - if (newArchEnabled == "true") { - def isSupported = version == 0 || version >= v(0, 71, 0) - if (!isSupported) { - throw new GradleException([ - "react-native 0.71 or greater is required for New Architecture", - "— disable `newArchEnabled` in your `gradle.properties` or", - "upgrade `react-native`" - ].join(" ")) - } - return isSupported - } - - return false -} diff --git a/example/babel.config.js b/example/babel.config.js deleted file mode 100644 index 4d3f37339..000000000 --- a/example/babel.config.js +++ /dev/null @@ -1,10 +0,0 @@ -module.exports = { - presets: (() => { - try { - return [require.resolve("@react-native/babel-preset")]; - } catch (_) { - return ["module:metro-react-native-babel-preset"]; - } - })(), - plugins: [[require("@rnx-kit/polyfills")]], -}; diff --git a/ios/use_react_native-0.70.rb b/ios/use_react_native-0.70.rb deleted file mode 100644 index 0f3f40598..000000000 --- a/ios/use_react_native-0.70.rb +++ /dev/null @@ -1,29 +0,0 @@ -require 'open3' - -require_relative('pod_helpers') - -def include_react_native!(options) - react_native, project_root = options.values_at(:path, :rta_project_root) - - require_relative(File.join(project_root, react_native, 'scripts', 'react_native_pods')) - - use_react_native!( - path: react_native, - production: options.key?(:production) ? options[:production] : ENV['PRODUCTION'] == '1', - hermes_enabled: use_hermes?(options), - app_path: options[:app_path] || '..', - config_file_dir: options[:config_file_dir] || '' - ) - - # If we're using react-native@main, we'll also need to prepare - # `react-native-codegen`. - codegen = File.join(project_root, react_native, 'packages', 'react-native-codegen') - Open3.popen3('node scripts/build.js', :chdir => codegen) if File.directory?(codegen) - - lambda { |installer| - react_native_post_install(installer, react_native) - if defined?(__apply_Xcode_12_5_M1_post_install_workaround) - __apply_Xcode_12_5_M1_post_install_workaround(installer) - end - } -end diff --git a/nx.json b/nx.json index 8f44c6e5f..14e205302 100644 --- a/nx.json +++ b/nx.json @@ -1,6 +1,14 @@ { "$schema": "./node_modules/nx/schemas/nx-schema.json", "defaultBase": "trunk", + "targetDefaults": { + "format:js": { + "cache": true + }, + "lint": { + "cache": true + } + }, "release": { "projects": ["react-native-test-app"], "projectsRelationship": "independent", @@ -25,5 +33,13 @@ "git": { "commit": false } + }, + "tui": { + "enabled": false + }, + "pluginsConfig": { + "@nx/js": { + "analyzeSourceFiles": false + } } } diff --git a/package.json b/package.json index f5cadca5f..e41501a70 100644 --- a/package.json +++ b/package.json @@ -1,164 +1,43 @@ { - "name": "react-native-test-app", + "private": true, + "name": "@microsoft/root", "version": "0.0.1-dev", - "description": "react-native-test-app provides a test app for all supported platforms as a package", - "keywords": [ - "android", - "app", - "ios", - "macos", - "react", - "react-native", - "test", - "test-app", - "testing", - "windows" - ], "homepage": "https://github.com/microsoft/react-native-test-app", "license": "MIT", "author": { "name": "Microsoft Open Source", "email": "microsoftopensource@users.noreply.github.com" }, - "files": [ - "*.md", - "ReactTestApp-DevSupport.podspec", - "android/**/*.gradle", - "android/android-manifest.js", - "android/app/lint.xml", - "android/app/src", - "!android/app/src/test", - "android/autolink.mjs", - "android/gradle-wrapper.js", - "android/support/src", - "common", - "example/_gitignore", - "example/android/gradle", - "example/android/gradle.properties", - "example/android/gradlew*", - "example/windows/_gitignore", - "example/{metro,react-native}.config.js", - "ios", - "macos", - "plugins", - "react-native.config.js", - "schema.json", - "scripts/*.js", - "scripts/*.mjs", - "scripts/config-plugins", - "scripts/embed-manifest", - "scripts/utils", - "test-app.gradle", - "test_app.rb", - "visionos", - "windows", - "!.clang-format" - ], - "main": "scripts/configure-projects.js", - "bin": { - "init": "scripts/init.mjs", - "init-test-app": "scripts/init.mjs", - "configure-test-app": "scripts/configure.mjs", - "install-windows-test-app": "windows/app.mjs" - }, "repository": { "type": "git", "url": "https://github.com/microsoft/react-native-test-app.git" }, "scripts": { - "format:c": "clang-format -i $(git ls-files '*.cpp' '*.h' '*.m' '*.mm')", - "format:js": "prettier --write --log-level error $(git ls-files '*.[cm][jt]s' '*.[jt]s' '*.tsx' '*.yml' '.github/*.json' 'CONTRIBUTING.md' 'README.md' 'nx.json' 'test/**/*.json' ':!:.yarn/releases')", - "format:swift": "swiftformat $(git ls-files '*.swift')", - "generate:code": "node scripts/internal/generate-manifest.mts", - "generate:docs": "node scripts/internal/generate-manifest-docs.mts", - "generate:schema": "node scripts/internal/generate-schema.mts", + "format": "nx run-many --target format:c,format:js,format:swift", + "lint": "nx run-many --target lint:js,lint:kt,lint:rb,lint:swift", + "format:js": "prettier --write --log-level error $(git ls-files '.github/*.json' '.github/*.yml' '.yarn/plugins/*' '.yarnrc.yml' 'CONTRIBUTING.md' 'README.md' 'nx.json')", "lint:commit": "git log --format='%s' origin/trunk..HEAD | tail -1 | npx @rnx-kit/commitlint-lite@2.0.0", - "lint:js": "eslint $(git ls-files '*.[cm][jt]s' '*.[jt]s' '*.tsx' ':!:*.config.js' ':!:.yarn/releases') && tsc && tsc --project tsconfig.cjs.json", - "lint:kt": "ktlint --relative 'android/app/src/**/*.kt'", - "lint:rb": "bundle exec rubocop", - "lint:swift": "swiftlint", - "prepack": "node scripts/internal/pack.mts pre", - "postpack": "node scripts/internal/pack.mts post", - "release-notes": "node scripts/internal/release-notes.mts", - "set-react-version": "node scripts/internal/set-react-version.mts", - "show-affected": "node scripts/build/affected.mts", - "test": "node scripts/internal/test.mts", - "test:js": "node --test $(git ls-files '*.test.ts')", - "test:matrix": "node scripts/testing/test-matrix.mts", - "test:rb": "bundle exec ruby -Ilib:test -e \"Dir.glob('./test/test_*.rb').each { |file| require(file) }\"" - }, - "dependencies": { - "@rnx-kit/react-native-host": "^0.5.11", - "@rnx-kit/tools-react-native": "^2.1.0", - "ajv": "^8.0.0", - "cliui": "^8.0.0", - "fast-xml-parser": "^4.0.0", - "prompts": "^2.4.0", - "semver": "^7.3.5", - "uuid": "^11.0.0" - }, - "peerDependencies": { - "@callstack/react-native-visionos": "0.73 - 0.79", - "@expo/config-plugins": ">=5.0", - "react": "18.1 - 19.1", - "react-native": "0.70 - 0.81 || >=0.82.0-0 <0.82.0", - "react-native-macos": "^0.0.0-0 || 0.71 - 0.79", - "react-native-windows": "^0.0.0-0 || 0.70 - 0.79" - }, - "peerDependenciesMeta": { - "@callstack/react-native-visionos": { - "optional": true - }, - "@expo/config-plugins": { - "optional": true - }, - "react-native-macos": { - "optional": true - }, - "react-native-windows": { - "optional": true - } + "show-affected": "node scripts/affected.mts" }, "devDependencies": { - "@babel/core": "^7.20.0", - "@babel/preset-env": "^7.20.0", - "@expo/config-plugins": "^10.0.0", - "@microsoft/eslint-plugin-sdl": "^1.0.0", "@nx/js": "^21.0.0", - "@react-native-community/cli": "^15.0.1", - "@react-native-community/template": "^0.78.0", - "@rnx-kit/eslint-plugin": "^0.8.0", "@rnx-kit/lint-lockfile": "^0.1.0", - "@rnx-kit/tsconfig": "^2.0.0", - "@swc-node/register": "^1.10.0", - "@swc/core": "^1.11.0", "@types/js-yaml": "^4.0.5", - "@types/mustache": "^4.0.0", "@types/node": "^22.0.0", - "@types/prompts": "~2.4.0", - "@types/semver": "^7.3.6", - "eslint": "^9.12.0", - "eslint-plugin-wdio": "^9.0.0", "js-yaml": "^4.1.0", - "memfs": "^4.0.0", "minimatch": "^9.0.0", "nx": "^21.0.0", "prettier": "^3.0.0", "prettier-plugin-organize-imports": "^4.1.0", - "react": "19.0.0", - "react-native": "^0.78.0", - "react-native-macos": "^0.78.0", - "react-native-windows": "^0.78.0", - "suggestion-bot": "^4.0.0", "typescript": "^5.0.0" }, "engines": { - "node": ">=16.17" + "node": ">=22.18" }, "packageManager": "yarn@4.9.4", "resolutions": { "@appium/base-driver/axios": "^1.8.3", - "@appium/docutils": "link:./example", + "@appium/docutils": "link:./packages/null", "@appium/support/archiver": "^7.0.1", "@appium/support/axios": "^1.8.3", "@appium/support/form-data": "^4.0.2", @@ -201,15 +80,9 @@ }, "workspaces": [ ".", - "example" + "packages/app", + "packages/app/example" ], - "defaultPlatformPackages": { - "android": "react-native", - "ios": "react-native", - "macos": "react-native-macos", - "visionos": "@callstack/react-native-visionos", - "windows": "react-native-windows" - }, "prettier": "./.github/prettierrc.json", "rnx-kit": { "lint": { diff --git a/.rubocop.yml b/packages/app/.rubocop.yml similarity index 100% rename from .rubocop.yml rename to packages/app/.rubocop.yml diff --git a/.swiftformat b/packages/app/.swiftformat similarity index 100% rename from .swiftformat rename to packages/app/.swiftformat diff --git a/.swiftlint.yml b/packages/app/.swiftlint.yml similarity index 100% rename from .swiftlint.yml rename to packages/app/.swiftlint.yml diff --git a/packages/app/LICENSE b/packages/app/LICENSE new file mode 100644 index 000000000..9e841e7a2 --- /dev/null +++ b/packages/app/LICENSE @@ -0,0 +1,21 @@ + MIT License + + Copyright (c) Microsoft Corporation. + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE diff --git a/packages/app/README.md b/packages/app/README.md new file mode 100644 index 000000000..b8e51d7e4 --- /dev/null +++ b/packages/app/README.md @@ -0,0 +1,149 @@ +# React Native Test App + +![Contributions Welcome](https://img.shields.io/badge/contributions-welcome-brightgreen) +[![Open in Visual Studio Code](https://img.shields.io/static/v1?logo=visualstudiocode&label=&message=Open%20in%20Visual%20Studio%20Code&color=007acc&labelColor=444444&logoColor=007acc)](https://vscode.dev/github/microsoft/react-native-test-app) +[![build](https://github.com/microsoft/react-native-test-app/actions/workflows/build.yml/badge.svg?event=push)](https://github.com/microsoft/react-native-test-app/actions/workflows/build.yml) +[![npm version](https://img.shields.io/npm/v/react-native-test-app)](https://www.npmjs.com/package/react-native-test-app) + +> React Native Test App (RNTA) provides test apps for all platforms as a +> package. It handles the native bits for you so you can focus on what's +> important: your product. + +- [Quick Start ⚡](#quick-start-) +- [Migrate an Existing Test App 📖](https://github.com/microsoft/react-native-test-app/wiki/Migrate-an-Existing-Test-App) +- [Configuring the Test App 📖](https://github.com/microsoft/react-native-test-app/wiki/Manifest-%28app.json%29) +- [Upgrading the Test App 📖](https://github.com/microsoft/react-native-test-app/wiki/Upgrading) +- [Learn More 🔍](#learn-more-) +- [Libraries Using RNTA 📚](#libraries-using-rnta-) +- [Known Issues ⚠️](#known-issues-️) +- [Contributing 🤝](#contributing-) +- [License 📝](#license-) + +## Quick Start ⚡ + +_If you want to migrate an existing test app for a library, follow the +[dedicated guide in the wiki](https://github.com/microsoft/react-native-test-app/wiki/Migrate-an-Existing-Test-App)._ + +You can generate a new project using `npx`: + +```sh +npx --package react-native-test-app@ init +# For example: npx --package react-native-test-app@4.2.3 init +``` + +You can always find the latest version here: +https://github.com/microsoft/react-native-test-app/releases + +Alternatively, if you're using a Bash-compatible shell: + +```sh +npx --package react-native-test-app@$(npm view react-native-test-app version) init +``` + +> [!NOTE] +> +> We don't recommend using `@latest` because npm may not always use the latest +> version. See https://github.com/npm/cli/issues/5262 for more details. + +In this example, we will create a project named "sample" in `sample` with apps +for all platforms: + +``` +✔ What is the name of your test app? … sample +? Which platforms do you need test apps for? › +Instructions: + ↑/↓: Highlight option + ←/→/[space]: Toggle selection + a: Toggle all + enter/return: Complete answer +◉ Android +◉ iOS +◉ macOS +◯ visionOS +◉ Windows +✔ Where should we create the new project? … sample +``` + +Install npm dependencies inside the new project folder: + +**Yarn:** + +```sh +cd sample +yarn +``` + +**npm:** + +```sh +cd sample +npm install +``` + +Once the dependencies are installed, follow the +[platform specific instructions](https://github.com/microsoft/react-native-test-app/wiki/Quick-Start#platform-specific-instructions) +in the wiki. + +## Learn More 🔍 + +- 🗣️ If you want to learn how RNTA is used at Microsoft, check out the following + talks: + - ["Improve all the repos – exploring Microsoft’s DevExp"](https://youtu.be/DAEnPV78rQc) + by [@kelset](https://github.com/kelset) and + [@tido64](https://github.com/tido64) from React Native Europe 2021. + - ["Our Journey of Making React Native a Preferred Choice"](https://www.youtube.com/watch?v=PYMMxfttOug) + by [@kelset](https://github.com/kelset) and + [@tido64](https://github.com/tido64) from React Native Europe 2023. +- 📖 In the wiki, you can read more about + [the motivation](https://github.com/microsoft/react-native-test-app/wiki#motivation) + and + [the design](https://github.com/microsoft/react-native-test-app/wiki/Design) + of this tool. + +## Libraries Using RNTA 📚 + + +[microsoft/fluentui-react-native](https://github.com/microsoft/fluentui-react-native) • +[microsoft/rnx-kit](https://github.com/microsoft/rnx-kit) • +[BabylonReactNative](https://github.com/BabylonJS/BabylonReactNative) • +[callstack/repack](https://github.com/callstack/repack) • +[lottie-react-native](https://github.com/lottie-react-native/lottie-react-native) • +[react-native-add-calendar-event](https://github.com/vonovak/react-native-add-calendar-event) • +[react-native-apple-authentication](https://github.com/invertase/react-native-apple-authentication) • +[react-native-async-storage](https://github.com/react-native-async-storage/async-storage) • +[react-native-blur](https://github.com/Kureev/react-native-blur) • +[react-native-clipboard](https://github.com/react-native-clipboard/clipboard) • +[react-native-datetimepicker](https://github.com/react-native-datetimepicker/datetimepicker) • +[react-native-google-signin](https://github.com/react-native-google-signin/google-signin) • +[react-native-image-editor](https://github.com/callstack/react-native-image-editor) • +[react-native-keychain](https://github.com/oblador/react-native-keychain) • +[react-native-masked-view](https://github.com/react-native-masked-view/masked-view) • +[react-native-menu](https://github.com/react-native-menu/menu) • +[react-native-netinfo](https://github.com/react-native-netinfo/react-native-netinfo) • +[react-native-pager-view](https://github.com/callstack/react-native-pager-view) • +[react-native-safe-area-context](https://github.com/AppAndFlow/react-native-safe-area-context) • +[react-native-segmented-control](https://github.com/react-native-segmented-control/segmented-control) • +[react-native-video](https://github.com/TheWidlarzGroup/react-native-video) • +[react-native-webview](https://github.com/react-native-webview/react-native-webview) • +[realm-js](https://github.com/realm/realm-js) • +[shopify/restyle](https://github.com/Shopify/restyle) • +[sparkfabrik-react-native-idfa-aaid](https://github.com/sparkfabrik/sparkfabrik-react-native-idfa-aaid) • +[and many more…](https://github.com/microsoft/react-native-test-app/network/dependents) + +_Are you using RNTA? Submit a PR to add it to the list!_ + +## Known Issues ⚠️ + +For a list of known issues and workarounds, please refer to the +[Troubleshooting wiki](https://github.com/microsoft/react-native-test-app/wiki/Troubleshooting). + +## Contributing 🤝 + +Thank you for your interest in this project! We welcome all contributions and +suggestions! + +Take a look at [CONTRIBUTING.md](CONTRIBUTING.md) for details. + +## License 📝 + +`react-native-test-app` is [MIT licensed](./LICENSE). diff --git a/ReactTestApp-DevSupport.podspec b/packages/app/ReactTestApp-DevSupport.podspec similarity index 100% rename from ReactTestApp-DevSupport.podspec rename to packages/app/ReactTestApp-DevSupport.podspec diff --git a/android/android-manifest.js b/packages/app/android/android-manifest.js similarity index 100% rename from android/android-manifest.js rename to packages/app/android/android-manifest.js diff --git a/packages/app/android/app/build.gradle b/packages/app/android/app/build.gradle new file mode 100644 index 000000000..6ecb246a4 --- /dev/null +++ b/packages/app/android/app/build.gradle @@ -0,0 +1,234 @@ +buildscript { + def androidDir = "${buildscript.sourceFile.getParent()}/../" + apply(from: "${androidDir}/autolink.gradle") + apply(from: "${androidDir}/dependencies.gradle") + apply(from: "${androidDir}/manifest.gradle") +} + +plugins { + id("com.android.application") + id("org.jetbrains.kotlin.android") +} + +// `react-native run-android` is hard-coded to look for the output APK at a very +// specific location. See +// https://github.com/react-native-community/cli/blob/6cf12b00c02aca6d4bc843446394331d71a9749e/packages/platform-android/src/commands/runAndroid/index.ts#L180 +buildDir = "${rootDir}/${name}/build" + +def reactNativePath = file(findNodeModulesPath("react-native", rootDir)) + +apply(plugin: "com.facebook.react") + +react { + reactNativeDir = reactNativePath + codegenDir = file(findNodeModulesPath("@react-native/codegen", reactNativePath)) +} + +// We don't want the React plugin to bundle. +tasks.whenTaskAdded { task -> + // The task name can be found in `react-native-gradle-plugin`: + // https://github.com/facebook/react-native/blob/0.71-stable/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/TaskConfiguration.kt#L54 + if (task.name.startsWith("createBundle") && task.name.endsWith("JsAndAssets")) { + task.enabled = false + } +} + +repositories { + maven { + url = uri("${reactNativePath}/android") + } + + mavenCentral() + google() + + // https://github.com/AzureAD/microsoft-authentication-library-for-android#step-1-declare-dependency-on-msal + maven { + url = uri("https://pkgs.dev.azure.com/MicrosoftDeviceSDK/DuoSDK-Public/_packaging/Duo-SDK-Feed/maven/v1") + } +} + +apply(from: "${projectDir}/../../test-app.gradle") +applyTestAppModule(project) + +project.ext.react = [ + abiSplit : false, + appName : getAppName(), + applicationId : getApplicationId(), + architectures : getArchitectures(project), + bundleInRelease : false, + enableCamera : !getSingleAppMode(), + enableHermes : true, + enableNewArchitecture: enableNewArchitecture, +] + +project.ext.signingConfigs = getSigningConfigs() + +android { + namespace = "com.microsoft.reacttestapp" + + compileSdkVersion = project.ext.compileSdkVersion + + if (project.hasProperty("ndkVersion")) { + ndkVersion = project.ext.ndkVersion + } + + buildFeatures { + prefab = true + } + + kotlinOptions { + allWarningsAsErrors = true + } + + defaultConfig { + applicationId = project.ext.react.applicationId + minSdkVersion = project.ext.minSdkVersion + targetSdkVersion = project.ext.targetSdkVersion + versionCode = project.ext.getVersionCode() + versionName = project.ext.getVersionName() + + def singleApp = getSingleAppMode() + buildConfigField("String", "REACTAPP_SINGLE_APP", singleApp ? "\"${singleApp}\"" : "null") + + buildConfigField("boolean", "REACTAPP_USE_FABRIC", enableNewArchitecture.toString()) + buildConfigField("boolean", "REACTAPP_USE_BRIDGELESS", enableBridgeless.toString()) + + manifestPlaceholders = [ + rntaEnableCamera: project.ext.react.enableCamera ? "1000000" : "1" + ] + + resValue("string", "app_name", project.ext.react.appName) + + def cppStd = "-std=c++20" + def androidStl = "-DANDROID_STL=c++_shared" + def cmakeMakeProgram = System.getenv("CMAKE_MAKE_PROGRAM") + def projectBuildDir = "-DPROJECT_BUILD_DIR=${buildDir}" + def reactAndroidDir = "-DREACT_ANDROID_DIR=${reactNativePath}/ReactAndroid" + + if (enableNewArchitecture) { + externalNativeBuild { + cmake { + if (cmakeMakeProgram != null) { + arguments(androidStl, + "-DCMAKE_MAKE_PROGRAM=${cmakeMakeProgram}", + projectBuildDir, + reactAndroidDir) + } else { + arguments(androidStl, projectBuildDir, reactAndroidDir) + } + cppFlags(cppStd, "-frtti", "-fexceptions", "-DWITH_INSPECTOR=1") + } + } + if (!project.ext.react.abiSplit) { + ndk { + abiFilters(*project.ext.react.architectures) + } + } + } else { + externalNativeBuild { + cmake { + def reactCommonDir = "-DREACT_COMMON_DIR=${reactNativePath}/ReactCommon" + def reactJniLibsDir = "-DREACT_JNILIBS_DIR=${buildDir}/outputs/jniLibs" + if (cmakeMakeProgram != null) { + arguments(androidStl, + "-DCMAKE_MAKE_PROGRAM=${cmakeMakeProgram}", + reactCommonDir, + reactJniLibsDir) + } else { + arguments(androidStl, reactCommonDir, reactJniLibsDir) + } + cppFlags(cppStd, "-Wall", "-Werror", "-frtti", "-fexceptions", "-DWITH_INSPECTOR=1") + } + } + } + } + + externalNativeBuild { + cmake { + path = "${projectDir}/src/main/jni/CMakeLists.txt" + } + } + + lintOptions { + lintConfig = file("lint.xml") + } + + packagingOptions { + pickFirst("lib/armeabi-v7a/libc++_shared.so") + pickFirst("lib/arm64-v8a/libc++_shared.so") + pickFirst("lib/x86_64/libc++_shared.so") + pickFirst("lib/x86/libc++_shared.so") + } + + project.ext.signingConfigs.each { name, config -> + def signingConfig = signingConfigs.findByName(name) ?: signingConfigs.create(name) + signingConfig.keyAlias = config["keyAlias"] + signingConfig.keyPassword = config["keyPassword"] + signingConfig.storeFile = config["storeFile"] + signingConfig.storePassword = config["storePassword"] + + def buildType = buildTypes.findByName(name) ?: buildTypes.create(name) + buildType.signingConfig = signingConfigs[name] + } + if (buildTypes.release.signingConfig == null) { + logger.warn("Signing config for 'release' build type not found; reusing debug config") + buildTypes.release.signingConfig = signingConfigs.debug + } + + sourceSets { + main.java.srcDirs += [ + project.ext.react.enableCamera ? "src/camera/java" : "src/no-camera/java", + + !enableNewArchitecture + ? "src/old-arch/java" + : reactNativeVersion >= v(0, 81, 0) + ? "src/new-arch-0.81/java" + : "src/new-arch-0.73/java", + + "src/devserverhelper-0.75/java", + "src/reactactivitydelegate-0.75/java", + "src/reactapplication-0.76/java", + "src/reacthost-0.76/java", + ] + } + + splits { + abi { + reset() + enable = project.ext.react.abiSplit + universalApk = false + include(*project.ext.react.architectures) + } + } +} + +dependencies { + implementation project(":support") + + implementation("com.facebook.react:hermes-android") + implementation("com.facebook.react:react-android") + + implementation(libraries.androidAppCompat) + implementation(libraries.androidCoreKotlinExtensions) + implementation(libraries.androidRecyclerView) + implementation(libraries.materialComponents) + + if (project.ext.react.enableCamera) { + implementation(libraries.androidCamera) + implementation(libraries.androidCameraMlKitVision) + implementation(libraries.mlKitBarcodeScanning) + } + + // https://github.com/facebook/react-native/blob/b0c0bb45911434ea654ba7e2feff4686061eba7a/packages/react-native-gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/ReactExtension.kt#L162 + autolinkingInfo(buildDir).each { path, info -> + info.configurations.each { configuration -> + add(configuration, project(path)) + } + } +} + +// `@react-native-community/cli` currently requires this function to be defined. +// See https://github.com/react-native-community/cli/blob/a87fb9014635fe84ab19a1a88d6ecbbc530eb4e2/packages/platform-android/native_modules.gradle#L497 +def isNewArchitectureEnabled() { + return isFabricEnabled(project) +} diff --git a/android/app/lint.xml b/packages/app/android/app/lint.xml similarity index 100% rename from android/app/lint.xml rename to packages/app/android/app/lint.xml diff --git a/android/app/src/camera/java/com/microsoft/reacttestapp/camera/MainActivityExtensions.kt b/packages/app/android/app/src/camera/java/com/microsoft/reacttestapp/camera/MainActivityExtensions.kt similarity index 100% rename from android/app/src/camera/java/com/microsoft/reacttestapp/camera/MainActivityExtensions.kt rename to packages/app/android/app/src/camera/java/com/microsoft/reacttestapp/camera/MainActivityExtensions.kt diff --git a/android/app/src/camera/java/com/microsoft/reacttestapp/camera/QRCodeScannerFragment.kt b/packages/app/android/app/src/camera/java/com/microsoft/reacttestapp/camera/QRCodeScannerFragment.kt similarity index 100% rename from android/app/src/camera/java/com/microsoft/reacttestapp/camera/QRCodeScannerFragment.kt rename to packages/app/android/app/src/camera/java/com/microsoft/reacttestapp/camera/QRCodeScannerFragment.kt diff --git a/android/app/src/devserverhelper-0.75/java/com/microsoft/reacttestapp/react/DevServerHelperCompat.kt b/packages/app/android/app/src/devserverhelper-0.75/java/com/microsoft/reacttestapp/react/DevServerHelperCompat.kt similarity index 100% rename from android/app/src/devserverhelper-0.75/java/com/microsoft/reacttestapp/react/DevServerHelperCompat.kt rename to packages/app/android/app/src/devserverhelper-0.75/java/com/microsoft/reacttestapp/react/DevServerHelperCompat.kt diff --git a/android/app/src/main/AndroidManifest.xml b/packages/app/android/app/src/main/AndroidManifest.xml similarity index 100% rename from android/app/src/main/AndroidManifest.xml rename to packages/app/android/app/src/main/AndroidManifest.xml diff --git a/android/app/src/main/java/com/microsoft/reacttestapp/MainActivity.kt b/packages/app/android/app/src/main/java/com/microsoft/reacttestapp/MainActivity.kt similarity index 100% rename from android/app/src/main/java/com/microsoft/reacttestapp/MainActivity.kt rename to packages/app/android/app/src/main/java/com/microsoft/reacttestapp/MainActivity.kt diff --git a/android/app/src/main/java/com/microsoft/reacttestapp/Session.kt b/packages/app/android/app/src/main/java/com/microsoft/reacttestapp/Session.kt similarity index 100% rename from android/app/src/main/java/com/microsoft/reacttestapp/Session.kt rename to packages/app/android/app/src/main/java/com/microsoft/reacttestapp/Session.kt diff --git a/android/app/src/main/java/com/microsoft/reacttestapp/component/ComponentActivity.kt b/packages/app/android/app/src/main/java/com/microsoft/reacttestapp/component/ComponentActivity.kt similarity index 100% rename from android/app/src/main/java/com/microsoft/reacttestapp/component/ComponentActivity.kt rename to packages/app/android/app/src/main/java/com/microsoft/reacttestapp/component/ComponentActivity.kt diff --git a/android/app/src/main/java/com/microsoft/reacttestapp/component/ComponentBottomSheetDialogFragment.kt b/packages/app/android/app/src/main/java/com/microsoft/reacttestapp/component/ComponentBottomSheetDialogFragment.kt similarity index 100% rename from android/app/src/main/java/com/microsoft/reacttestapp/component/ComponentBottomSheetDialogFragment.kt rename to packages/app/android/app/src/main/java/com/microsoft/reacttestapp/component/ComponentBottomSheetDialogFragment.kt diff --git a/android/app/src/main/java/com/microsoft/reacttestapp/component/ComponentListAdapter.kt b/packages/app/android/app/src/main/java/com/microsoft/reacttestapp/component/ComponentListAdapter.kt similarity index 100% rename from android/app/src/main/java/com/microsoft/reacttestapp/component/ComponentListAdapter.kt rename to packages/app/android/app/src/main/java/com/microsoft/reacttestapp/component/ComponentListAdapter.kt diff --git a/android/app/src/main/java/com/microsoft/reacttestapp/component/ComponentViewModel.kt b/packages/app/android/app/src/main/java/com/microsoft/reacttestapp/component/ComponentViewModel.kt similarity index 100% rename from android/app/src/main/java/com/microsoft/reacttestapp/component/ComponentViewModel.kt rename to packages/app/android/app/src/main/java/com/microsoft/reacttestapp/component/ComponentViewModel.kt diff --git a/android/app/src/main/java/com/microsoft/reacttestapp/manifest/Manifest.kt b/packages/app/android/app/src/main/java/com/microsoft/reacttestapp/manifest/Manifest.kt similarity index 100% rename from android/app/src/main/java/com/microsoft/reacttestapp/manifest/Manifest.kt rename to packages/app/android/app/src/main/java/com/microsoft/reacttestapp/manifest/Manifest.kt diff --git a/android/app/src/main/java/com/microsoft/reacttestapp/react/AppRegistry.kt b/packages/app/android/app/src/main/java/com/microsoft/reacttestapp/react/AppRegistry.kt similarity index 100% rename from android/app/src/main/java/com/microsoft/reacttestapp/react/AppRegistry.kt rename to packages/app/android/app/src/main/java/com/microsoft/reacttestapp/react/AppRegistry.kt diff --git a/android/app/src/main/java/com/microsoft/reacttestapp/react/BundleSource.kt b/packages/app/android/app/src/main/java/com/microsoft/reacttestapp/react/BundleSource.kt similarity index 100% rename from android/app/src/main/java/com/microsoft/reacttestapp/react/BundleSource.kt rename to packages/app/android/app/src/main/java/com/microsoft/reacttestapp/react/BundleSource.kt diff --git a/android/app/src/main/java/com/microsoft/reacttestapp/react/CurrentActivityTracker.kt b/packages/app/android/app/src/main/java/com/microsoft/reacttestapp/react/CurrentActivityTracker.kt similarity index 100% rename from android/app/src/main/java/com/microsoft/reacttestapp/react/CurrentActivityTracker.kt rename to packages/app/android/app/src/main/java/com/microsoft/reacttestapp/react/CurrentActivityTracker.kt diff --git a/android/app/src/main/java/com/microsoft/reacttestapp/react/ReactBundleNameProvider.kt b/packages/app/android/app/src/main/java/com/microsoft/reacttestapp/react/ReactBundleNameProvider.kt similarity index 100% rename from android/app/src/main/java/com/microsoft/reacttestapp/react/ReactBundleNameProvider.kt rename to packages/app/android/app/src/main/java/com/microsoft/reacttestapp/react/ReactBundleNameProvider.kt diff --git a/android/app/src/main/jni/AppRegistry.cpp b/packages/app/android/app/src/main/jni/AppRegistry.cpp similarity index 100% rename from android/app/src/main/jni/AppRegistry.cpp rename to packages/app/android/app/src/main/jni/AppRegistry.cpp diff --git a/android/app/src/main/jni/AppRegistry.h b/packages/app/android/app/src/main/jni/AppRegistry.h similarity index 100% rename from android/app/src/main/jni/AppRegistry.h rename to packages/app/android/app/src/main/jni/AppRegistry.h diff --git a/android/app/src/main/jni/AutolinkingCompat.h b/packages/app/android/app/src/main/jni/AutolinkingCompat.h similarity index 65% rename from android/app/src/main/jni/AutolinkingCompat.h rename to packages/app/android/app/src/main/jni/AutolinkingCompat.h index 608abf7a4..1cede2240 100644 --- a/android/app/src/main/jni/AutolinkingCompat.h +++ b/packages/app/android/app/src/main/jni/AutolinkingCompat.h @@ -13,22 +13,10 @@ #endif // __has_include() // >= 0.81 -#if __has_include() // >= 0.75 - #include #define autolinking_ModuleProvider facebook::react::autolinking_ModuleProvider #define autolinking_cxxModuleProvider facebook::react::autolinking_cxxModuleProvider #define autolinking_registerProviders facebook::react::autolinking_registerProviders -#else // < 0.75 - -#include - -#define autolinking_ModuleProvider facebook::react::rncli_ModuleProvider -#define autolinking_cxxModuleProvider facebook::react::rncli_cxxModuleProvider -#define autolinking_registerProviders facebook::react::rncli_registerProviders - -#endif // __has_include() - #endif // REACTAPP_JNI_AUTOLINKINGCOMPAT_H_ diff --git a/android/app/src/main/jni/CMakeLists.txt b/packages/app/android/app/src/main/jni/CMakeLists.txt similarity index 92% rename from android/app/src/main/jni/CMakeLists.txt rename to packages/app/android/app/src/main/jni/CMakeLists.txt index 050d06b5e..7f358b3d4 100644 --- a/android/app/src/main/jni/CMakeLists.txt +++ b/packages/app/android/app/src/main/jni/CMakeLists.txt @@ -12,8 +12,6 @@ set(REACTTESTAPP_SOURCE_FILES # Suppress 'Manually-specified variables were not used by the project' warning set(UNUSED_VARIABLES - ${NODE_MODULES_DIR} # TODO: No longer used in 0.72 - ${REACT_ANDROID_BUILD_DIR} # TODO: No longer used in 0.72 ${REACT_COMMON_DIR} ${REACT_JNILIBS_DIR} ) diff --git a/android/app/src/main/jni/ComponentsRegistry.cpp b/packages/app/android/app/src/main/jni/ComponentsRegistry.cpp similarity index 92% rename from android/app/src/main/jni/ComponentsRegistry.cpp rename to packages/app/android/app/src/main/jni/ComponentsRegistry.cpp index 83fa11687..8d42b14f9 100644 --- a/android/app/src/main/jni/ComponentsRegistry.cpp +++ b/packages/app/android/app/src/main/jni/ComponentsRegistry.cpp @@ -2,16 +2,13 @@ #if !__has_include() +// clang-format off #include "AutolinkingCompat.h" - -#if __has_include() // >= 0.71 -#include -#else // < 0.71 -#include -#endif // __has_include() +// clang-format on #include +#include #include #include #include diff --git a/android/app/src/main/jni/ComponentsRegistry.h b/packages/app/android/app/src/main/jni/ComponentsRegistry.h similarity index 87% rename from android/app/src/main/jni/ComponentsRegistry.h rename to packages/app/android/app/src/main/jni/ComponentsRegistry.h index a694be1ce..c82c80ded 100644 --- a/android/app/src/main/jni/ComponentsRegistry.h +++ b/packages/app/android/app/src/main/jni/ComponentsRegistry.h @@ -3,11 +3,7 @@ #include -#if __has_include() // >= 0.71 #include -#else // < 0.71 -#include -#endif namespace ReactTestApp { diff --git a/android/app/src/main/jni/OnLoad.cpp b/packages/app/android/app/src/main/jni/OnLoad.cpp similarity index 96% rename from android/app/src/main/jni/OnLoad.cpp rename to packages/app/android/app/src/main/jni/OnLoad.cpp index 31201b7ad..fc1717a7e 100644 --- a/android/app/src/main/jni/OnLoad.cpp +++ b/packages/app/android/app/src/main/jni/OnLoad.cpp @@ -31,12 +31,10 @@ namespace std::shared_ptr javaModuleProvider(const std::string &name, const JavaTurboModule::InitParams ¶ms) { -#if __has_include() // >= 0.75 // We first try to look up core modules if (auto module = rncore_ModuleProvider(name, params)) { return module; } -#endif // __has_include() // And we fallback to the module providers autolinked by RN CLI return autolinking_ModuleProvider(name, params); diff --git a/android/app/src/main/jni/TurboModuleManagerDelegate.cpp b/packages/app/android/app/src/main/jni/TurboModuleManagerDelegate.cpp similarity index 100% rename from android/app/src/main/jni/TurboModuleManagerDelegate.cpp rename to packages/app/android/app/src/main/jni/TurboModuleManagerDelegate.cpp diff --git a/android/app/src/main/jni/TurboModuleManagerDelegate.h b/packages/app/android/app/src/main/jni/TurboModuleManagerDelegate.h similarity index 100% rename from android/app/src/main/jni/TurboModuleManagerDelegate.h rename to packages/app/android/app/src/main/jni/TurboModuleManagerDelegate.h diff --git a/android/app/src/main/res-launcher/drawable-v24/ic_launcher_foreground.xml b/packages/app/android/app/src/main/res-launcher/drawable-v24/ic_launcher_foreground.xml similarity index 100% rename from android/app/src/main/res-launcher/drawable-v24/ic_launcher_foreground.xml rename to packages/app/android/app/src/main/res-launcher/drawable-v24/ic_launcher_foreground.xml diff --git a/android/app/src/main/res-launcher/drawable/ic_launcher_background.xml b/packages/app/android/app/src/main/res-launcher/drawable/ic_launcher_background.xml similarity index 100% rename from android/app/src/main/res-launcher/drawable/ic_launcher_background.xml rename to packages/app/android/app/src/main/res-launcher/drawable/ic_launcher_background.xml diff --git a/android/app/src/main/res-launcher/mipmap-anydpi-v26/ic_launcher.xml b/packages/app/android/app/src/main/res-launcher/mipmap-anydpi-v26/ic_launcher.xml similarity index 100% rename from android/app/src/main/res-launcher/mipmap-anydpi-v26/ic_launcher.xml rename to packages/app/android/app/src/main/res-launcher/mipmap-anydpi-v26/ic_launcher.xml diff --git a/android/app/src/main/res-launcher/mipmap-anydpi-v26/ic_launcher_round.xml b/packages/app/android/app/src/main/res-launcher/mipmap-anydpi-v26/ic_launcher_round.xml similarity index 100% rename from android/app/src/main/res-launcher/mipmap-anydpi-v26/ic_launcher_round.xml rename to packages/app/android/app/src/main/res-launcher/mipmap-anydpi-v26/ic_launcher_round.xml diff --git a/android/app/src/main/res-launcher/mipmap-hdpi/ic_launcher.png b/packages/app/android/app/src/main/res-launcher/mipmap-hdpi/ic_launcher.png similarity index 100% rename from android/app/src/main/res-launcher/mipmap-hdpi/ic_launcher.png rename to packages/app/android/app/src/main/res-launcher/mipmap-hdpi/ic_launcher.png diff --git a/android/app/src/main/res-launcher/mipmap-hdpi/ic_launcher_round.png b/packages/app/android/app/src/main/res-launcher/mipmap-hdpi/ic_launcher_round.png similarity index 100% rename from android/app/src/main/res-launcher/mipmap-hdpi/ic_launcher_round.png rename to packages/app/android/app/src/main/res-launcher/mipmap-hdpi/ic_launcher_round.png diff --git a/android/app/src/main/res-launcher/mipmap-mdpi/ic_launcher.png b/packages/app/android/app/src/main/res-launcher/mipmap-mdpi/ic_launcher.png similarity index 100% rename from android/app/src/main/res-launcher/mipmap-mdpi/ic_launcher.png rename to packages/app/android/app/src/main/res-launcher/mipmap-mdpi/ic_launcher.png diff --git a/android/app/src/main/res-launcher/mipmap-mdpi/ic_launcher_round.png b/packages/app/android/app/src/main/res-launcher/mipmap-mdpi/ic_launcher_round.png similarity index 100% rename from android/app/src/main/res-launcher/mipmap-mdpi/ic_launcher_round.png rename to packages/app/android/app/src/main/res-launcher/mipmap-mdpi/ic_launcher_round.png diff --git a/android/app/src/main/res-launcher/mipmap-xhdpi/ic_launcher.png b/packages/app/android/app/src/main/res-launcher/mipmap-xhdpi/ic_launcher.png similarity index 100% rename from android/app/src/main/res-launcher/mipmap-xhdpi/ic_launcher.png rename to packages/app/android/app/src/main/res-launcher/mipmap-xhdpi/ic_launcher.png diff --git a/android/app/src/main/res-launcher/mipmap-xhdpi/ic_launcher_round.png b/packages/app/android/app/src/main/res-launcher/mipmap-xhdpi/ic_launcher_round.png similarity index 100% rename from android/app/src/main/res-launcher/mipmap-xhdpi/ic_launcher_round.png rename to packages/app/android/app/src/main/res-launcher/mipmap-xhdpi/ic_launcher_round.png diff --git a/android/app/src/main/res-launcher/mipmap-xxhdpi/ic_launcher.png b/packages/app/android/app/src/main/res-launcher/mipmap-xxhdpi/ic_launcher.png similarity index 100% rename from android/app/src/main/res-launcher/mipmap-xxhdpi/ic_launcher.png rename to packages/app/android/app/src/main/res-launcher/mipmap-xxhdpi/ic_launcher.png diff --git a/android/app/src/main/res-launcher/mipmap-xxhdpi/ic_launcher_round.png b/packages/app/android/app/src/main/res-launcher/mipmap-xxhdpi/ic_launcher_round.png similarity index 100% rename from android/app/src/main/res-launcher/mipmap-xxhdpi/ic_launcher_round.png rename to packages/app/android/app/src/main/res-launcher/mipmap-xxhdpi/ic_launcher_round.png diff --git a/android/app/src/main/res-launcher/mipmap-xxxhdpi/ic_launcher.png b/packages/app/android/app/src/main/res-launcher/mipmap-xxxhdpi/ic_launcher.png similarity index 100% rename from android/app/src/main/res-launcher/mipmap-xxxhdpi/ic_launcher.png rename to packages/app/android/app/src/main/res-launcher/mipmap-xxxhdpi/ic_launcher.png diff --git a/android/app/src/main/res-launcher/mipmap-xxxhdpi/ic_launcher_round.png b/packages/app/android/app/src/main/res-launcher/mipmap-xxxhdpi/ic_launcher_round.png similarity index 100% rename from android/app/src/main/res-launcher/mipmap-xxxhdpi/ic_launcher_round.png rename to packages/app/android/app/src/main/res-launcher/mipmap-xxxhdpi/ic_launcher_round.png diff --git a/android/app/src/main/res/layout/activity_main.xml b/packages/app/android/app/src/main/res/layout/activity_main.xml similarity index 100% rename from android/app/src/main/res/layout/activity_main.xml rename to packages/app/android/app/src/main/res/layout/activity_main.xml diff --git a/android/app/src/main/res/layout/camera_view.xml b/packages/app/android/app/src/main/res/layout/camera_view.xml similarity index 100% rename from android/app/src/main/res/layout/camera_view.xml rename to packages/app/android/app/src/main/res/layout/camera_view.xml diff --git a/android/app/src/main/res/layout/recyclerview_item_component.xml b/packages/app/android/app/src/main/res/layout/recyclerview_item_component.xml similarity index 100% rename from android/app/src/main/res/layout/recyclerview_item_component.xml rename to packages/app/android/app/src/main/res/layout/recyclerview_item_component.xml diff --git a/android/app/src/main/res/menu/top_app_bar.xml b/packages/app/android/app/src/main/res/menu/top_app_bar.xml similarity index 100% rename from android/app/src/main/res/menu/top_app_bar.xml rename to packages/app/android/app/src/main/res/menu/top_app_bar.xml diff --git a/android/app/src/main/res/values/colors.xml b/packages/app/android/app/src/main/res/values/colors.xml similarity index 100% rename from android/app/src/main/res/values/colors.xml rename to packages/app/android/app/src/main/res/values/colors.xml diff --git a/android/app/src/main/res/values/strings.xml b/packages/app/android/app/src/main/res/values/strings.xml similarity index 100% rename from android/app/src/main/res/values/strings.xml rename to packages/app/android/app/src/main/res/values/strings.xml diff --git a/android/app/src/main/res/values/styles.xml b/packages/app/android/app/src/main/res/values/styles.xml similarity index 100% rename from android/app/src/main/res/values/styles.xml rename to packages/app/android/app/src/main/res/values/styles.xml diff --git a/android/app/src/new-arch-0.73/java/com/microsoft/reacttestapp/compat/ReactNativeHostCompat.kt b/packages/app/android/app/src/new-arch-0.73/java/com/microsoft/reacttestapp/compat/ReactNativeHostCompat.kt similarity index 100% rename from android/app/src/new-arch-0.73/java/com/microsoft/reacttestapp/compat/ReactNativeHostCompat.kt rename to packages/app/android/app/src/new-arch-0.73/java/com/microsoft/reacttestapp/compat/ReactNativeHostCompat.kt diff --git a/android/app/src/new-arch-0.73/java/com/microsoft/reacttestapp/fabric/ComponentsRegistry.kt b/packages/app/android/app/src/new-arch-0.73/java/com/microsoft/reacttestapp/fabric/ComponentsRegistry.kt similarity index 100% rename from android/app/src/new-arch-0.73/java/com/microsoft/reacttestapp/fabric/ComponentsRegistry.kt rename to packages/app/android/app/src/new-arch-0.73/java/com/microsoft/reacttestapp/fabric/ComponentsRegistry.kt diff --git a/android/app/src/new-arch-0.73/java/com/microsoft/reacttestapp/turbomodule/TurboModuleManagerDelegate.kt b/packages/app/android/app/src/new-arch-0.73/java/com/microsoft/reacttestapp/turbomodule/TurboModuleManagerDelegate.kt similarity index 100% rename from android/app/src/new-arch-0.73/java/com/microsoft/reacttestapp/turbomodule/TurboModuleManagerDelegate.kt rename to packages/app/android/app/src/new-arch-0.73/java/com/microsoft/reacttestapp/turbomodule/TurboModuleManagerDelegate.kt diff --git a/android/app/src/new-arch-0.81/java/com/microsoft/reacttestapp/compat/ReactNativeHostCompat.kt b/packages/app/android/app/src/new-arch-0.81/java/com/microsoft/reacttestapp/compat/ReactNativeHostCompat.kt similarity index 100% rename from android/app/src/new-arch-0.81/java/com/microsoft/reacttestapp/compat/ReactNativeHostCompat.kt rename to packages/app/android/app/src/new-arch-0.81/java/com/microsoft/reacttestapp/compat/ReactNativeHostCompat.kt diff --git a/android/app/src/new-arch-0.81/java/com/microsoft/reacttestapp/fabric/ComponentsRegistry.kt b/packages/app/android/app/src/new-arch-0.81/java/com/microsoft/reacttestapp/fabric/ComponentsRegistry.kt similarity index 100% rename from android/app/src/new-arch-0.81/java/com/microsoft/reacttestapp/fabric/ComponentsRegistry.kt rename to packages/app/android/app/src/new-arch-0.81/java/com/microsoft/reacttestapp/fabric/ComponentsRegistry.kt diff --git a/android/app/src/new-arch-0.81/java/com/microsoft/reacttestapp/turbomodule/TurboModuleManagerDelegate.kt b/packages/app/android/app/src/new-arch-0.81/java/com/microsoft/reacttestapp/turbomodule/TurboModuleManagerDelegate.kt similarity index 100% rename from android/app/src/new-arch-0.81/java/com/microsoft/reacttestapp/turbomodule/TurboModuleManagerDelegate.kt rename to packages/app/android/app/src/new-arch-0.81/java/com/microsoft/reacttestapp/turbomodule/TurboModuleManagerDelegate.kt diff --git a/android/app/src/no-camera/java/com/microsoft/reacttestapp/camera/MainActivityExtensions.kt b/packages/app/android/app/src/no-camera/java/com/microsoft/reacttestapp/camera/MainActivityExtensions.kt similarity index 100% rename from android/app/src/no-camera/java/com/microsoft/reacttestapp/camera/MainActivityExtensions.kt rename to packages/app/android/app/src/no-camera/java/com/microsoft/reacttestapp/camera/MainActivityExtensions.kt diff --git a/android/app/src/old-arch/java/com/microsoft/reacttestapp/compat/ReactNativeHostCompat.kt b/packages/app/android/app/src/old-arch/java/com/microsoft/reacttestapp/compat/ReactNativeHostCompat.kt similarity index 100% rename from android/app/src/old-arch/java/com/microsoft/reacttestapp/compat/ReactNativeHostCompat.kt rename to packages/app/android/app/src/old-arch/java/com/microsoft/reacttestapp/compat/ReactNativeHostCompat.kt diff --git a/android/app/src/reactactivitydelegate-0.75/java/com/microsoft/reacttestapp/component/ComponentActivityDelegate.kt b/packages/app/android/app/src/reactactivitydelegate-0.75/java/com/microsoft/reacttestapp/component/ComponentActivityDelegate.kt similarity index 100% rename from android/app/src/reactactivitydelegate-0.75/java/com/microsoft/reacttestapp/component/ComponentActivityDelegate.kt rename to packages/app/android/app/src/reactactivitydelegate-0.75/java/com/microsoft/reacttestapp/component/ComponentActivityDelegate.kt diff --git a/android/app/src/reactapplication-0.76/java/com/microsoft/reacttestapp/TestApp.kt b/packages/app/android/app/src/reactapplication-0.76/java/com/microsoft/reacttestapp/TestApp.kt similarity index 100% rename from android/app/src/reactapplication-0.76/java/com/microsoft/reacttestapp/TestApp.kt rename to packages/app/android/app/src/reactapplication-0.76/java/com/microsoft/reacttestapp/TestApp.kt diff --git a/android/app/src/reacthost-0.76/java/com/microsoft/reacttetapp/react/MainReactNativeHost.kt b/packages/app/android/app/src/reacthost-0.76/java/com/microsoft/reacttetapp/react/MainReactNativeHost.kt similarity index 100% rename from android/app/src/reacthost-0.76/java/com/microsoft/reacttetapp/react/MainReactNativeHost.kt rename to packages/app/android/app/src/reacthost-0.76/java/com/microsoft/reacttetapp/react/MainReactNativeHost.kt diff --git a/android/autolink.gradle b/packages/app/android/autolink.gradle similarity index 100% rename from android/autolink.gradle rename to packages/app/android/autolink.gradle diff --git a/android/autolink.mjs b/packages/app/android/autolink.mjs similarity index 100% rename from android/autolink.mjs rename to packages/app/android/autolink.mjs diff --git a/android/config-plugins.gradle b/packages/app/android/config-plugins.gradle similarity index 100% rename from android/config-plugins.gradle rename to packages/app/android/config-plugins.gradle diff --git a/android/dependencies.gradle b/packages/app/android/dependencies.gradle similarity index 58% rename from android/dependencies.gradle rename to packages/app/android/dependencies.gradle index f637a8f3f..a39708acf 100644 --- a/android/dependencies.gradle +++ b/packages/app/android/dependencies.gradle @@ -5,22 +5,6 @@ if (!hasProperty("rnta_react_native_gradle")) { apply(from: "${buildscript.sourceFile.getParent()}/react-native.gradle") } -/** - * Returns the recommended Gradle plugin version for the specified React Native - * version. - */ -def getDefaultGradlePluginVersion = { int reactNativeVersion -> - // Gradle plugin version can be found in the template: - // https://github.com/facebook/react-native/blob/main/packages/react-native/template/android/build.gradle - if (reactNativeVersion == 0 || reactNativeVersion >= v(0, 73, 0)) { - return "" - } else if (reactNativeVersion >= v(0, 71, 0)) { - return "7.3.1" - } else { - return "7.2.2" - } -} - def getDependencyVersionFromCatalog = { String versionCatalog, String dependency, String fallback -> if (versionCatalog == null) { return fallback @@ -63,32 +47,19 @@ ext { targetSdkVersion = rootProject.findProperty("react.targetSdkVersion") ?: getDependencyVersionNumberFromCatalog(versionCatalog, "targetSdk", 33) - autodetectReactNativeVersion = reactNativeVersion == 0 || reactNativeVersion >= v(0, 71, 0) enableNewArchitecture = isNewArchitectureEnabled(project) enableBridgeless = isBridgelessEnabled(project, enableNewArchitecture) - usePrefabs = reactNativeVersion == 0 || reactNativeVersion >= v(0, 71, 0) - androidPluginVersion = getDefaultGradlePluginVersion(reactNativeVersion) kotlinVersion = rootProject.findProperty("KOTLIN_VERSION") ?: getKotlinVersion(versionCatalog) // We need only set `ndkVersion` when building react-native from source. if (rootProject.hasProperty("ANDROID_NDK_VERSION")) { ndkVersion = rootProject.properties["ANDROID_NDK_VERSION"] - } else if (reactNativeVersion >= v(0, 74, 0)) { + } else { // https://github.com/facebook/react-native/commit/9ce7b564131c5b2075489c09ff05325ddc28014a ndkVersion = getDependencyVersionFromCatalog(versionCatalog, "ndkVersion", "26.1.10909125") - } else if (System.properties["os.arch"] == "aarch64" && androidPluginVersion == "7.2.2") { - // NDK r23c has been patched to support Apple M1 and is default in AGP - // 7.3.0. Prior to 0.71, we still need to set `ndkVersion` because we'll - // be using AGP 7.2.2 (see `androidPluginVersion` above). - // Note that even though newer 23.x versions exist, we'll stick to AGP's - // default. See also - // https://developer.android.com/build/releases/past-releases/agp-7-3-0-release-notes - ndkVersion = "23.1.7779620" } - def kotlinVersionNumber = toVersionNumber(kotlinVersion) - /** * Dependabot requires a `dependencies.gradle` to evaluate Java * dependencies. It is also very particular about the formatting and cannot @@ -109,33 +80,14 @@ ext { mlKitBarcodeScanning : "com.google.mlkit:barcode-scanning:17.3.0", ] - // Separate block so bots can parse this file properly - if (compileSdkVersion < 35) { - libraries.androidCoreKotlinExtensions = ["androidx.core", "core-ktx", "1.13.1"].join(":") - libraries.androidRecyclerView = ["androidx.recyclerview", "recyclerview", "1.3.2"].join(":") - } - if (kotlinVersionNumber < v(1, 8, 0)) { - libraries.androidAppCompat = ["androidx.appcompat", "appcompat", "1.6.1"].join(":") - libraries.androidCamera = ["androidx.camera", "camera-camera2", "1.2.0-beta02"].join(":") - libraries.androidCameraMlKitVision = ["androidx.camera", "camera-mlkit-vision", "1.2.0-beta02"].join(":") - libraries.androidCoreKotlinExtensions = ["androidx.core", "core-ktx", "1.9.0"].join(":") - } - getReactNativeDependencies = { // Hint: Use `./gradlew buildEnvironment` to check whether these are // correctly set. - def dependencies = [ - androidPluginVersion == "" - ? "com.android.tools.build:gradle" - : "com.android.tools.build:gradle:${androidPluginVersion}", + return [ + "com.android.tools.build:gradle", "org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlinVersion}", + "de.undercouch:gradle-download-task:5.6.0", + "com.facebook.react:react-native-gradle-plugin", ] - - if (autodetectReactNativeVersion || enableNewArchitecture) { - dependencies << "com.facebook.react:react-native-gradle-plugin" - dependencies << "de.undercouch:gradle-download-task:5.6.0" - } - - return dependencies } } diff --git a/android/gradle-wrapper.js b/packages/app/android/gradle-wrapper.js similarity index 89% rename from android/gradle-wrapper.js rename to packages/app/android/gradle-wrapper.js index 869928cdf..e136566f4 100644 --- a/android/gradle-wrapper.js +++ b/packages/app/android/gradle-wrapper.js @@ -39,11 +39,6 @@ const GRADLE_VERSIONS = [ [v(0, 79, 0), [v(8, 13, 0), "8.13"], [INT_MAX, ""]], // 0.79: [8.13, *) [v(0, 78, 0), [v(8, 12, 0), "8.12"], [INT_MAX, ""]], // 0.78: [8.12, *) [v(0, 76, 0), [v(8, 11, 1), "8.11.1"], [INT_MAX, ""]], // 0.76: [8.11.1, *) - [v(0, 75, 0), [v(8, 8, 0), "8.8"], [v(8, 9, 0), "8.8"]], // 0.75: [8.8, 8.9) - [v(0, 74, 0), [v(8, 6, 0), "8.6"], [v(8, 9, 0), "8.8"]], // 0.74: [8.6, 8.9) - [v(0, 73, 0), [v(8, 3, 0), "8.3"], [v(8, 9, 0), "8.8"]], // 0.73: [8.3, 8.9) - [v(0, 72, 0), [v(8, 1, 1), "8.1.1"], [v(8, 3, 0), "8.2.1"]], // 0.72: [8.1.1, 8.3) - [0, [v(7, 5, 1), "7.6.4"], [v(8, 0, 0), "7.6.4"]], // <0.72: [7.5.1, 8.0.0) ]; /** diff --git a/android/gradle.properties b/packages/app/android/gradle.properties similarity index 95% rename from android/gradle.properties rename to packages/app/android/gradle.properties index c40976145..272b1be34 100644 --- a/android/gradle.properties +++ b/packages/app/android/gradle.properties @@ -25,11 +25,11 @@ org.gradle.jvmargs=-Xmx2g -XX:MaxMetaspaceSize=512m -XX:+HeapDumpOnOutOfMemoryEr # https://developer.android.com/topic/libraries/support-library/androidx-rn android.useAndroidX=true # Automatically convert third-party libraries to use AndroidX -android.enableJetifier=true +#android.enableJetifier=true # Failed to transform '/~/bcprov-jdk15on-1.68.jar' using Jetifier. # Reason: IllegalArgumentException, message: Unsupported class file major version 59. -android.jetifier.ignorelist=bcprov-jdk15on +#android.jetifier.ignorelist=bcprov-jdk15on # Kotlin code style for this project: "official" or "obsolete": kotlin.code.style=official diff --git a/android/manifest.gradle b/packages/app/android/manifest.gradle similarity index 100% rename from android/manifest.gradle rename to packages/app/android/manifest.gradle diff --git a/android/media-types.gradle b/packages/app/android/media-types.gradle similarity index 100% rename from android/media-types.gradle rename to packages/app/android/media-types.gradle diff --git a/android/node.gradle b/packages/app/android/node.gradle similarity index 100% rename from android/node.gradle rename to packages/app/android/node.gradle diff --git a/packages/app/android/react-native.gradle b/packages/app/android/react-native.gradle new file mode 100644 index 000000000..3b4161dcf --- /dev/null +++ b/packages/app/android/react-native.gradle @@ -0,0 +1,42 @@ +ext.rnta_react_native_gradle = true + +if (!hasProperty("rnta_node_gradle")) { + apply(from: "${buildscript.sourceFile.getParent()}/node.gradle") +} + +ext.isBridgelessEnabled = { Project project, boolean isNewArchEnabled -> + if (isNewArchEnabled) { + def bridgelessEnabled = project.findProperty("react.bridgelessEnabled") + ?: project.findProperty("bridgelessEnabled") + + def version = getPackageVersionNumber("react-native", project.rootDir) + if (version >= v(0, 82, 0)) { + if (bridgelessEnabled == "false") { + logger.warn("WARNING: As of 0.82, bridgeless can no longer be disabled") + } + return true + } + + return bridgelessEnabled != "false" + } + return false +} + +ext.isFabricEnabled = { Project project -> + return isNewArchitectureEnabled(project) +} + +ext.isNewArchitectureEnabled = { Project project -> + def newArchEnabled = project.findProperty("react.newArchEnabled") + ?: project.findProperty("newArchEnabled") + + def version = getPackageVersionNumber("react-native", project.rootDir) + if (version >= v(0, 82, 0)) { + if (newArchEnabled == "false") { + logger.warn("WARNING: As of 0.82, New Architecture can no longer be disabled") + } + return true + } + + return newArchEnabled == "true" +} diff --git a/android/settings.gradle b/packages/app/android/settings.gradle similarity index 100% rename from android/settings.gradle rename to packages/app/android/settings.gradle diff --git a/android/support/build.gradle b/packages/app/android/support/build.gradle similarity index 100% rename from android/support/build.gradle rename to packages/app/android/support/build.gradle diff --git a/android/support/src/main/AndroidManifest.xml b/packages/app/android/support/src/main/AndroidManifest.xml similarity index 100% rename from android/support/src/main/AndroidManifest.xml rename to packages/app/android/support/src/main/AndroidManifest.xml diff --git a/android/support/src/main/java/com/microsoft/reacttestapp/support/ReactTestAppLifecycleEvents.java b/packages/app/android/support/src/main/java/com/microsoft/reacttestapp/support/ReactTestAppLifecycleEvents.java similarity index 100% rename from android/support/src/main/java/com/microsoft/reacttestapp/support/ReactTestAppLifecycleEvents.java rename to packages/app/android/support/src/main/java/com/microsoft/reacttestapp/support/ReactTestAppLifecycleEvents.java diff --git a/android/utils.gradle b/packages/app/android/utils.gradle similarity index 100% rename from android/utils.gradle rename to packages/app/android/utils.gradle diff --git a/common/AppRegistry.cpp b/packages/app/common/AppRegistry.cpp similarity index 53% rename from common/AppRegistry.cpp rename to packages/app/common/AppRegistry.cpp index 37b75fe25..efc483aee 100644 --- a/common/AppRegistry.cpp +++ b/packages/app/common/AppRegistry.cpp @@ -9,32 +9,18 @@ using facebook::jsi::String; namespace { - constexpr char kFbBatchedBridgeId[] = "__fbBatchedBridge"; constexpr char kRNAppRegistryId[] = "RN$AppRegistry"; Array GetRegisteredAppKeys(Runtime &runtime) { auto global = runtime.global(); - if (global.hasProperty(runtime, kRNAppRegistryId)) { // >= 0.73 - // const appKeys = RN$AppRegistry.getAppKeys(); - auto registry = global.getProperty(runtime, kRNAppRegistryId); - if (registry.isObject()) { - auto getAppKeys = std::move(registry).asObject(runtime).getPropertyAsFunction( - runtime, "getAppKeys"); - return getAppKeys.call(runtime, nullptr, 0).asObject(runtime).asArray(runtime); - } - } else if (global.hasProperty(runtime, kFbBatchedBridgeId)) { // < 0.73 - // const appRegistry = __fbBatchedBridge.getCallableModule("AppRegistry"); - auto fbBatchedBridge = global.getPropertyAsObject(runtime, kFbBatchedBridgeId); - auto getCallableModule = - fbBatchedBridge.getPropertyAsFunction(runtime, "getCallableModule"); - auto appRegistry = - getCallableModule.callWithThis(runtime, fbBatchedBridge, "AppRegistry") - .asObject(runtime); - - // const appKeys = appRegistry.getAppKeys(); - auto getAppKeys = appRegistry.getPropertyAsFunction(runtime, "getAppKeys"); - return getAppKeys.callWithThis(runtime, appRegistry).asObject(runtime).asArray(runtime); + + // const appKeys = RN$AppRegistry.getAppKeys(); + auto registry = global.getProperty(runtime, kRNAppRegistryId); + if (registry.isObject()) { + auto getAppKeys = + std::move(registry).asObject(runtime).getPropertyAsFunction(runtime, "getAppKeys"); + return getAppKeys.call(runtime, nullptr, 0).asObject(runtime).asArray(runtime); } return Array(runtime, 0); diff --git a/common/AppRegistry.h b/packages/app/common/AppRegistry.h similarity index 100% rename from common/AppRegistry.h rename to packages/app/common/AppRegistry.h diff --git a/eslint.config.js b/packages/app/eslint.config.js similarity index 100% rename from eslint.config.js rename to packages/app/eslint.config.js diff --git a/example/.gitignore b/packages/app/example/.gitignore similarity index 100% rename from example/.gitignore rename to packages/app/example/.gitignore diff --git a/example/.watchmanconfig b/packages/app/example/.watchmanconfig similarity index 100% rename from example/.watchmanconfig rename to packages/app/example/.watchmanconfig diff --git a/example/Example-Tests.podspec b/packages/app/example/Example-Tests.podspec similarity index 100% rename from example/Example-Tests.podspec rename to packages/app/example/Example-Tests.podspec diff --git a/example/android/build.gradle b/packages/app/example/android/build.gradle similarity index 52% rename from example/android/build.gradle rename to packages/app/example/android/build.gradle index 602e4cc78..3e00c032b 100644 --- a/example/android/build.gradle +++ b/packages/app/example/android/build.gradle @@ -21,23 +21,3 @@ buildscript { } } } - -allprojects { - repositories { - { - def searchDir = rootDir.toPath() - do { - def p = searchDir.resolve("node_modules/react-native/android") - if (p.toFile().exists()) { - maven { - url = p.toRealPath().toString() - } - break - } - } while (searchDir = searchDir.getParent()) - // As of 0.80, React Native is no longer installed from npm - }() - mavenCentral() - google() - } -} diff --git a/example/android/gradle.properties b/packages/app/example/android/gradle.properties similarity index 96% rename from example/android/gradle.properties rename to packages/app/example/android/gradle.properties index a713e83e3..a3e761121 100644 --- a/example/android/gradle.properties +++ b/packages/app/example/android/gradle.properties @@ -25,9 +25,9 @@ org.gradle.jvmargs=-Xmx2g -XX:MaxMetaspaceSize=512m -XX:+HeapDumpOnOutOfMemoryEr # https://developer.android.com/topic/libraries/support-library/androidx-rn android.useAndroidX=true # Automatically convert third-party libraries to use AndroidX -android.enableJetifier=true +#android.enableJetifier=true # Jetifier randomly fails on these libraries -android.jetifier.ignorelist=hermes-android,react-android +#android.jetifier.ignorelist=hermes-android,react-android # Use this property to specify which architecture you want to build. # You can also override it from the CLI using diff --git a/example/android/gradle/wrapper/gradle-wrapper.jar b/packages/app/example/android/gradle/wrapper/gradle-wrapper.jar similarity index 100% rename from example/android/gradle/wrapper/gradle-wrapper.jar rename to packages/app/example/android/gradle/wrapper/gradle-wrapper.jar diff --git a/example/android/gradle/wrapper/gradle-wrapper.properties b/packages/app/example/android/gradle/wrapper/gradle-wrapper.properties similarity index 100% rename from example/android/gradle/wrapper/gradle-wrapper.properties rename to packages/app/example/android/gradle/wrapper/gradle-wrapper.properties diff --git a/example/android/gradlew b/packages/app/example/android/gradlew similarity index 100% rename from example/android/gradlew rename to packages/app/example/android/gradlew diff --git a/example/android/gradlew.bat b/packages/app/example/android/gradlew.bat similarity index 100% rename from example/android/gradlew.bat rename to packages/app/example/android/gradlew.bat diff --git a/example/android/settings.gradle b/packages/app/example/android/settings.gradle similarity index 100% rename from example/android/settings.gradle rename to packages/app/example/android/settings.gradle diff --git a/example/app.json b/packages/app/example/app.json similarity index 100% rename from example/app.json rename to packages/app/example/app.json diff --git a/packages/app/example/babel.config.js b/packages/app/example/babel.config.js new file mode 100644 index 000000000..ffff9ce44 --- /dev/null +++ b/packages/app/example/babel.config.js @@ -0,0 +1,4 @@ +module.exports = { + presets: [require.resolve("@react-native/babel-preset")], + plugins: [[require("@rnx-kit/polyfills")]], +}; diff --git a/example/dist/.gitignore b/packages/app/example/dist/.gitignore similarity index 100% rename from example/dist/.gitignore rename to packages/app/example/dist/.gitignore diff --git a/example/index.ts b/packages/app/example/index.ts similarity index 100% rename from example/index.ts rename to packages/app/example/index.ts diff --git a/example/ios/ExampleTests/DevSupportTests.m b/packages/app/example/ios/ExampleTests/DevSupportTests.m similarity index 100% rename from example/ios/ExampleTests/DevSupportTests.m rename to packages/app/example/ios/ExampleTests/DevSupportTests.m diff --git a/example/ios/Podfile b/packages/app/example/ios/Podfile similarity index 100% rename from example/ios/Podfile rename to packages/app/example/ios/Podfile diff --git a/example/ios/Podfile.lock b/packages/app/example/ios/Podfile.lock similarity index 81% rename from example/ios/Podfile.lock rename to packages/app/example/ios/Podfile.lock index 513b95b37..5ab3fa38a 100644 --- a/example/ios/Podfile.lock +++ b/packages/app/example/ios/Podfile.lock @@ -1535,78 +1535,78 @@ PODS: - Yoga (0.0.0) DEPENDENCIES: - - boost (from `../../node_modules/react-native/third-party-podspecs/boost.podspec`) - - DoubleConversion (from `../../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec`) + - boost (from `../node_modules/react-native/third-party-podspecs/boost.podspec`) + - DoubleConversion (from `../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec`) - Example-Tests (from `..`) - - fast_float (from `../../node_modules/react-native/third-party-podspecs/fast_float.podspec`) - - FBLazyVector (from `../../node_modules/react-native/Libraries/FBLazyVector`) - - fmt (from `../../node_modules/react-native/third-party-podspecs/fmt.podspec`) - - glog (from `../../node_modules/react-native/third-party-podspecs/glog.podspec`) - - RCT-Folly (from `../../node_modules/react-native/third-party-podspecs/RCT-Folly.podspec`) - - RCT-Folly/Fabric (from `../../node_modules/react-native/third-party-podspecs/RCT-Folly.podspec`) - - RCTDeprecation (from `../../node_modules/react-native/ReactApple/Libraries/RCTFoundation/RCTDeprecation`) - - RCTRequired (from `../../node_modules/react-native/Libraries/Required`) - - RCTTypeSafety (from `../../node_modules/react-native/Libraries/TypeSafety`) - - React (from `../../node_modules/react-native/`) - - React-callinvoker (from `../../node_modules/react-native/ReactCommon/callinvoker`) - - React-Core (from `../../node_modules/react-native/`) - - React-Core/RCTWebSocket (from `../../node_modules/react-native/`) - - React-CoreModules (from `../../node_modules/react-native/React/CoreModules`) - - React-cxxreact (from `../../node_modules/react-native/ReactCommon/cxxreact`) - - React-debug (from `../../node_modules/react-native/ReactCommon/react/debug`) - - React-defaultsnativemodule (from `../../node_modules/react-native/ReactCommon/react/nativemodule/defaults`) - - React-domnativemodule (from `../../node_modules/react-native/ReactCommon/react/nativemodule/dom`) - - React-Fabric (from `../../node_modules/react-native/ReactCommon`) - - React-FabricComponents (from `../../node_modules/react-native/ReactCommon`) - - React-FabricImage (from `../../node_modules/react-native/ReactCommon`) - - React-featureflags (from `../../node_modules/react-native/ReactCommon/react/featureflags`) - - React-featureflagsnativemodule (from `../../node_modules/react-native/ReactCommon/react/nativemodule/featureflags`) - - React-graphics (from `../../node_modules/react-native/ReactCommon/react/renderer/graphics`) - - React-idlecallbacksnativemodule (from `../../node_modules/react-native/ReactCommon/react/nativemodule/idlecallbacks`) - - React-ImageManager (from `../../node_modules/react-native/ReactCommon/react/renderer/imagemanager/platform/ios`) - - React-jsc (from `../../node_modules/react-native/ReactCommon/jsc`) - - React-jserrorhandler (from `../../node_modules/react-native/ReactCommon/jserrorhandler`) - - React-jsi (from `../../node_modules/react-native/ReactCommon/jsi`) - - React-jsiexecutor (from `../../node_modules/react-native/ReactCommon/jsiexecutor`) - - React-jsinspector (from `../../node_modules/react-native/ReactCommon/jsinspector-modern`) - - React-jsinspectortracing (from `../../node_modules/react-native/ReactCommon/jsinspector-modern/tracing`) - - React-jsitracing (from `../../node_modules/react-native/ReactCommon/hermes/executor/`) - - React-logger (from `../../node_modules/react-native/ReactCommon/logger`) - - React-Mapbuffer (from `../../node_modules/react-native/ReactCommon`) - - React-microtasksnativemodule (from `../../node_modules/react-native/ReactCommon/react/nativemodule/microtasks`) - - react-native-safe-area-context (from `../../node_modules/react-native-safe-area-context`) - - React-NativeModulesApple (from `../../node_modules/react-native/ReactCommon/react/nativemodule/core/platform/ios`) - - React-perflogger (from `../../node_modules/react-native/ReactCommon/reactperflogger`) - - React-performancetimeline (from `../../node_modules/react-native/ReactCommon/react/performance/timeline`) - - React-RCTActionSheet (from `../../node_modules/react-native/Libraries/ActionSheetIOS`) - - React-RCTAnimation (from `../../node_modules/react-native/Libraries/NativeAnimation`) - - React-RCTAppDelegate (from `../../node_modules/react-native/Libraries/AppDelegate`) - - React-RCTBlob (from `../../node_modules/react-native/Libraries/Blob`) - - React-RCTFabric (from `../../node_modules/react-native/React`) - - React-RCTFBReactNativeSpec (from `../../node_modules/react-native/React`) - - React-RCTImage (from `../../node_modules/react-native/Libraries/Image`) - - React-RCTLinking (from `../../node_modules/react-native/Libraries/LinkingIOS`) - - React-RCTNetwork (from `../../node_modules/react-native/Libraries/Network`) - - React-RCTSettings (from `../../node_modules/react-native/Libraries/Settings`) - - React-RCTText (from `../../node_modules/react-native/Libraries/Text`) - - React-RCTVibration (from `../../node_modules/react-native/Libraries/Vibration`) - - React-rendererconsistency (from `../../node_modules/react-native/ReactCommon/react/renderer/consistency`) - - React-rendererdebug (from `../../node_modules/react-native/ReactCommon/react/renderer/debug`) - - React-rncore (from `../../node_modules/react-native/ReactCommon`) - - React-RuntimeApple (from `../../node_modules/react-native/ReactCommon/react/runtime/platform/ios`) - - React-RuntimeCore (from `../../node_modules/react-native/ReactCommon/react/runtime`) - - React-runtimeexecutor (from `../../node_modules/react-native/ReactCommon/runtimeexecutor`) - - React-runtimescheduler (from `../../node_modules/react-native/ReactCommon/react/renderer/runtimescheduler`) - - React-timing (from `../../node_modules/react-native/ReactCommon/react/timing`) - - React-utils (from `../../node_modules/react-native/ReactCommon/react/utils`) + - fast_float (from `../node_modules/react-native/third-party-podspecs/fast_float.podspec`) + - FBLazyVector (from `../node_modules/react-native/Libraries/FBLazyVector`) + - fmt (from `../node_modules/react-native/third-party-podspecs/fmt.podspec`) + - glog (from `../node_modules/react-native/third-party-podspecs/glog.podspec`) + - RCT-Folly (from `../node_modules/react-native/third-party-podspecs/RCT-Folly.podspec`) + - RCT-Folly/Fabric (from `../node_modules/react-native/third-party-podspecs/RCT-Folly.podspec`) + - RCTDeprecation (from `../node_modules/react-native/ReactApple/Libraries/RCTFoundation/RCTDeprecation`) + - RCTRequired (from `../node_modules/react-native/Libraries/Required`) + - RCTTypeSafety (from `../node_modules/react-native/Libraries/TypeSafety`) + - React (from `../node_modules/react-native/`) + - React-callinvoker (from `../node_modules/react-native/ReactCommon/callinvoker`) + - React-Core (from `../node_modules/react-native/`) + - React-Core/RCTWebSocket (from `../node_modules/react-native/`) + - React-CoreModules (from `../node_modules/react-native/React/CoreModules`) + - React-cxxreact (from `../node_modules/react-native/ReactCommon/cxxreact`) + - React-debug (from `../node_modules/react-native/ReactCommon/react/debug`) + - React-defaultsnativemodule (from `../node_modules/react-native/ReactCommon/react/nativemodule/defaults`) + - React-domnativemodule (from `../node_modules/react-native/ReactCommon/react/nativemodule/dom`) + - React-Fabric (from `../node_modules/react-native/ReactCommon`) + - React-FabricComponents (from `../node_modules/react-native/ReactCommon`) + - React-FabricImage (from `../node_modules/react-native/ReactCommon`) + - React-featureflags (from `../node_modules/react-native/ReactCommon/react/featureflags`) + - React-featureflagsnativemodule (from `../node_modules/react-native/ReactCommon/react/nativemodule/featureflags`) + - React-graphics (from `../node_modules/react-native/ReactCommon/react/renderer/graphics`) + - React-idlecallbacksnativemodule (from `../node_modules/react-native/ReactCommon/react/nativemodule/idlecallbacks`) + - React-ImageManager (from `../node_modules/react-native/ReactCommon/react/renderer/imagemanager/platform/ios`) + - React-jsc (from `../node_modules/react-native/ReactCommon/jsc`) + - React-jserrorhandler (from `../node_modules/react-native/ReactCommon/jserrorhandler`) + - React-jsi (from `../node_modules/react-native/ReactCommon/jsi`) + - React-jsiexecutor (from `../node_modules/react-native/ReactCommon/jsiexecutor`) + - React-jsinspector (from `../node_modules/react-native/ReactCommon/jsinspector-modern`) + - React-jsinspectortracing (from `../node_modules/react-native/ReactCommon/jsinspector-modern/tracing`) + - React-jsitracing (from `../node_modules/react-native/ReactCommon/hermes/executor/`) + - React-logger (from `../node_modules/react-native/ReactCommon/logger`) + - React-Mapbuffer (from `../node_modules/react-native/ReactCommon`) + - React-microtasksnativemodule (from `../node_modules/react-native/ReactCommon/react/nativemodule/microtasks`) + - react-native-safe-area-context (from `../node_modules/react-native-safe-area-context`) + - React-NativeModulesApple (from `../node_modules/react-native/ReactCommon/react/nativemodule/core/platform/ios`) + - React-perflogger (from `../node_modules/react-native/ReactCommon/reactperflogger`) + - React-performancetimeline (from `../node_modules/react-native/ReactCommon/react/performance/timeline`) + - React-RCTActionSheet (from `../node_modules/react-native/Libraries/ActionSheetIOS`) + - React-RCTAnimation (from `../node_modules/react-native/Libraries/NativeAnimation`) + - React-RCTAppDelegate (from `../node_modules/react-native/Libraries/AppDelegate`) + - React-RCTBlob (from `../node_modules/react-native/Libraries/Blob`) + - React-RCTFabric (from `../node_modules/react-native/React`) + - React-RCTFBReactNativeSpec (from `../node_modules/react-native/React`) + - React-RCTImage (from `../node_modules/react-native/Libraries/Image`) + - React-RCTLinking (from `../node_modules/react-native/Libraries/LinkingIOS`) + - React-RCTNetwork (from `../node_modules/react-native/Libraries/Network`) + - React-RCTSettings (from `../node_modules/react-native/Libraries/Settings`) + - React-RCTText (from `../node_modules/react-native/Libraries/Text`) + - React-RCTVibration (from `../node_modules/react-native/Libraries/Vibration`) + - React-rendererconsistency (from `../node_modules/react-native/ReactCommon/react/renderer/consistency`) + - React-rendererdebug (from `../node_modules/react-native/ReactCommon/react/renderer/debug`) + - React-rncore (from `../node_modules/react-native/ReactCommon`) + - React-RuntimeApple (from `../node_modules/react-native/ReactCommon/react/runtime/platform/ios`) + - React-RuntimeCore (from `../node_modules/react-native/ReactCommon/react/runtime`) + - React-runtimeexecutor (from `../node_modules/react-native/ReactCommon/runtimeexecutor`) + - React-runtimescheduler (from `../node_modules/react-native/ReactCommon/react/renderer/runtimescheduler`) + - React-timing (from `../node_modules/react-native/ReactCommon/react/timing`) + - React-utils (from `../node_modules/react-native/ReactCommon/react/utils`) - ReactAppDependencyProvider (from `build/generated/ios`) - ReactCodegen (from `build/generated/ios`) - - ReactCommon/turbomodule/core (from `../../node_modules/react-native/ReactCommon`) + - ReactCommon/turbomodule/core (from `../node_modules/react-native/ReactCommon`) - "ReactNativeHost (from `../../node_modules/@rnx-kit/react-native-host`)" - ReactTestApp-DevSupport (from `../node_modules/react-native-test-app`) - ReactTestApp-Resources (from `..`) - "RNWWebStorage (from `../node_modules/@react-native-webapis/web-storage`)" - - Yoga (from `../../node_modules/react-native/ReactCommon/yoga`) + - Yoga (from `../node_modules/react-native/ReactCommon/yoga`) SPEC REPOS: trunk: @@ -1614,135 +1614,135 @@ SPEC REPOS: EXTERNAL SOURCES: boost: - :podspec: "../../node_modules/react-native/third-party-podspecs/boost.podspec" + :podspec: "../node_modules/react-native/third-party-podspecs/boost.podspec" DoubleConversion: - :podspec: "../../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec" + :podspec: "../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec" Example-Tests: :path: ".." fast_float: - :podspec: "../../node_modules/react-native/third-party-podspecs/fast_float.podspec" + :podspec: "../node_modules/react-native/third-party-podspecs/fast_float.podspec" FBLazyVector: - :path: "../../node_modules/react-native/Libraries/FBLazyVector" + :path: "../node_modules/react-native/Libraries/FBLazyVector" fmt: - :podspec: "../../node_modules/react-native/third-party-podspecs/fmt.podspec" + :podspec: "../node_modules/react-native/third-party-podspecs/fmt.podspec" glog: - :podspec: "../../node_modules/react-native/third-party-podspecs/glog.podspec" + :podspec: "../node_modules/react-native/third-party-podspecs/glog.podspec" RCT-Folly: - :podspec: "../../node_modules/react-native/third-party-podspecs/RCT-Folly.podspec" + :podspec: "../node_modules/react-native/third-party-podspecs/RCT-Folly.podspec" RCTDeprecation: - :path: "../../node_modules/react-native/ReactApple/Libraries/RCTFoundation/RCTDeprecation" + :path: "../node_modules/react-native/ReactApple/Libraries/RCTFoundation/RCTDeprecation" RCTRequired: - :path: "../../node_modules/react-native/Libraries/Required" + :path: "../node_modules/react-native/Libraries/Required" RCTTypeSafety: - :path: "../../node_modules/react-native/Libraries/TypeSafety" + :path: "../node_modules/react-native/Libraries/TypeSafety" React: - :path: "../../node_modules/react-native/" + :path: "../node_modules/react-native/" React-callinvoker: - :path: "../../node_modules/react-native/ReactCommon/callinvoker" + :path: "../node_modules/react-native/ReactCommon/callinvoker" React-Core: - :path: "../../node_modules/react-native/" + :path: "../node_modules/react-native/" React-CoreModules: - :path: "../../node_modules/react-native/React/CoreModules" + :path: "../node_modules/react-native/React/CoreModules" React-cxxreact: - :path: "../../node_modules/react-native/ReactCommon/cxxreact" + :path: "../node_modules/react-native/ReactCommon/cxxreact" React-debug: - :path: "../../node_modules/react-native/ReactCommon/react/debug" + :path: "../node_modules/react-native/ReactCommon/react/debug" React-defaultsnativemodule: - :path: "../../node_modules/react-native/ReactCommon/react/nativemodule/defaults" + :path: "../node_modules/react-native/ReactCommon/react/nativemodule/defaults" React-domnativemodule: - :path: "../../node_modules/react-native/ReactCommon/react/nativemodule/dom" + :path: "../node_modules/react-native/ReactCommon/react/nativemodule/dom" React-Fabric: - :path: "../../node_modules/react-native/ReactCommon" + :path: "../node_modules/react-native/ReactCommon" React-FabricComponents: - :path: "../../node_modules/react-native/ReactCommon" + :path: "../node_modules/react-native/ReactCommon" React-FabricImage: - :path: "../../node_modules/react-native/ReactCommon" + :path: "../node_modules/react-native/ReactCommon" React-featureflags: - :path: "../../node_modules/react-native/ReactCommon/react/featureflags" + :path: "../node_modules/react-native/ReactCommon/react/featureflags" React-featureflagsnativemodule: - :path: "../../node_modules/react-native/ReactCommon/react/nativemodule/featureflags" + :path: "../node_modules/react-native/ReactCommon/react/nativemodule/featureflags" React-graphics: - :path: "../../node_modules/react-native/ReactCommon/react/renderer/graphics" + :path: "../node_modules/react-native/ReactCommon/react/renderer/graphics" React-idlecallbacksnativemodule: - :path: "../../node_modules/react-native/ReactCommon/react/nativemodule/idlecallbacks" + :path: "../node_modules/react-native/ReactCommon/react/nativemodule/idlecallbacks" React-ImageManager: - :path: "../../node_modules/react-native/ReactCommon/react/renderer/imagemanager/platform/ios" + :path: "../node_modules/react-native/ReactCommon/react/renderer/imagemanager/platform/ios" React-jsc: - :path: "../../node_modules/react-native/ReactCommon/jsc" + :path: "../node_modules/react-native/ReactCommon/jsc" React-jserrorhandler: - :path: "../../node_modules/react-native/ReactCommon/jserrorhandler" + :path: "../node_modules/react-native/ReactCommon/jserrorhandler" React-jsi: - :path: "../../node_modules/react-native/ReactCommon/jsi" + :path: "../node_modules/react-native/ReactCommon/jsi" React-jsiexecutor: - :path: "../../node_modules/react-native/ReactCommon/jsiexecutor" + :path: "../node_modules/react-native/ReactCommon/jsiexecutor" React-jsinspector: - :path: "../../node_modules/react-native/ReactCommon/jsinspector-modern" + :path: "../node_modules/react-native/ReactCommon/jsinspector-modern" React-jsinspectortracing: - :path: "../../node_modules/react-native/ReactCommon/jsinspector-modern/tracing" + :path: "../node_modules/react-native/ReactCommon/jsinspector-modern/tracing" React-jsitracing: - :path: "../../node_modules/react-native/ReactCommon/hermes/executor/" + :path: "../node_modules/react-native/ReactCommon/hermes/executor/" React-logger: - :path: "../../node_modules/react-native/ReactCommon/logger" + :path: "../node_modules/react-native/ReactCommon/logger" React-Mapbuffer: - :path: "../../node_modules/react-native/ReactCommon" + :path: "../node_modules/react-native/ReactCommon" React-microtasksnativemodule: - :path: "../../node_modules/react-native/ReactCommon/react/nativemodule/microtasks" + :path: "../node_modules/react-native/ReactCommon/react/nativemodule/microtasks" react-native-safe-area-context: - :path: "../../node_modules/react-native-safe-area-context" + :path: "../node_modules/react-native-safe-area-context" React-NativeModulesApple: - :path: "../../node_modules/react-native/ReactCommon/react/nativemodule/core/platform/ios" + :path: "../node_modules/react-native/ReactCommon/react/nativemodule/core/platform/ios" React-perflogger: - :path: "../../node_modules/react-native/ReactCommon/reactperflogger" + :path: "../node_modules/react-native/ReactCommon/reactperflogger" React-performancetimeline: - :path: "../../node_modules/react-native/ReactCommon/react/performance/timeline" + :path: "../node_modules/react-native/ReactCommon/react/performance/timeline" React-RCTActionSheet: - :path: "../../node_modules/react-native/Libraries/ActionSheetIOS" + :path: "../node_modules/react-native/Libraries/ActionSheetIOS" React-RCTAnimation: - :path: "../../node_modules/react-native/Libraries/NativeAnimation" + :path: "../node_modules/react-native/Libraries/NativeAnimation" React-RCTAppDelegate: - :path: "../../node_modules/react-native/Libraries/AppDelegate" + :path: "../node_modules/react-native/Libraries/AppDelegate" React-RCTBlob: - :path: "../../node_modules/react-native/Libraries/Blob" + :path: "../node_modules/react-native/Libraries/Blob" React-RCTFabric: - :path: "../../node_modules/react-native/React" + :path: "../node_modules/react-native/React" React-RCTFBReactNativeSpec: - :path: "../../node_modules/react-native/React" + :path: "../node_modules/react-native/React" React-RCTImage: - :path: "../../node_modules/react-native/Libraries/Image" + :path: "../node_modules/react-native/Libraries/Image" React-RCTLinking: - :path: "../../node_modules/react-native/Libraries/LinkingIOS" + :path: "../node_modules/react-native/Libraries/LinkingIOS" React-RCTNetwork: - :path: "../../node_modules/react-native/Libraries/Network" + :path: "../node_modules/react-native/Libraries/Network" React-RCTSettings: - :path: "../../node_modules/react-native/Libraries/Settings" + :path: "../node_modules/react-native/Libraries/Settings" React-RCTText: - :path: "../../node_modules/react-native/Libraries/Text" + :path: "../node_modules/react-native/Libraries/Text" React-RCTVibration: - :path: "../../node_modules/react-native/Libraries/Vibration" + :path: "../node_modules/react-native/Libraries/Vibration" React-rendererconsistency: - :path: "../../node_modules/react-native/ReactCommon/react/renderer/consistency" + :path: "../node_modules/react-native/ReactCommon/react/renderer/consistency" React-rendererdebug: - :path: "../../node_modules/react-native/ReactCommon/react/renderer/debug" + :path: "../node_modules/react-native/ReactCommon/react/renderer/debug" React-rncore: - :path: "../../node_modules/react-native/ReactCommon" + :path: "../node_modules/react-native/ReactCommon" React-RuntimeApple: - :path: "../../node_modules/react-native/ReactCommon/react/runtime/platform/ios" + :path: "../node_modules/react-native/ReactCommon/react/runtime/platform/ios" React-RuntimeCore: - :path: "../../node_modules/react-native/ReactCommon/react/runtime" + :path: "../node_modules/react-native/ReactCommon/react/runtime" React-runtimeexecutor: - :path: "../../node_modules/react-native/ReactCommon/runtimeexecutor" + :path: "../node_modules/react-native/ReactCommon/runtimeexecutor" React-runtimescheduler: - :path: "../../node_modules/react-native/ReactCommon/react/renderer/runtimescheduler" + :path: "../node_modules/react-native/ReactCommon/react/renderer/runtimescheduler" React-timing: - :path: "../../node_modules/react-native/ReactCommon/react/timing" + :path: "../node_modules/react-native/ReactCommon/react/timing" React-utils: - :path: "../../node_modules/react-native/ReactCommon/react/utils" + :path: "../node_modules/react-native/ReactCommon/react/utils" ReactAppDependencyProvider: :path: build/generated/ios ReactCodegen: :path: build/generated/ios ReactCommon: - :path: "../../node_modules/react-native/ReactCommon" + :path: "../node_modules/react-native/ReactCommon" ReactNativeHost: :path: "../../node_modules/@rnx-kit/react-native-host" ReactTestApp-DevSupport: @@ -1752,7 +1752,7 @@ EXTERNAL SOURCES: RNWWebStorage: :path: "../node_modules/@react-native-webapis/web-storage" Yoga: - :path: "../../node_modules/react-native/ReactCommon/yoga" + :path: "../node_modules/react-native/ReactCommon/yoga" SPEC CHECKSUMS: boost: 7e761d76ca2ce687f7cc98e698152abd03a18f90 @@ -1818,7 +1818,7 @@ SPEC CHECKSUMS: React-timing: 1ee3572c398f5579c9df5bf76aacddf5683ff74e React-utils: 2149c6ab1bf4ab9ab8cce1f3f10217c188e37025 ReactAppDependencyProvider: 4893bde33952f997a323eb1a1ee87a72764018ff - ReactCodegen: a99d9f9129c83cdd5c58dea8826d1b82ec528b93 + ReactCodegen: 5a220ff9ae2e4fffd2efd6d614e261d62686b867 ReactCommon: 5008bd981a06fe63176ef815f092685ffee8f7eb ReactNativeHost: 771c74c764b7bf1fa0ec613a4b5ee96db304ca0f ReactTestApp-DevSupport: 2386e7c22084f8a550cfadcc0bde140c7dc328a1 diff --git a/example/macos/Podfile b/packages/app/example/macos/Podfile similarity index 100% rename from example/macos/Podfile rename to packages/app/example/macos/Podfile diff --git a/example/macos/Podfile.lock b/packages/app/example/macos/Podfile.lock similarity index 79% rename from example/macos/Podfile.lock rename to packages/app/example/macos/Podfile.lock index 43b15524f..fb3ee9cc0 100644 --- a/example/macos/Podfile.lock +++ b/packages/app/example/macos/Podfile.lock @@ -1536,211 +1536,211 @@ PODS: - Yoga (0.0.0) DEPENDENCIES: - - boost (from `../../node_modules/react-native-macos/third-party-podspecs/boost.podspec`) - - DoubleConversion (from `../../node_modules/react-native-macos/third-party-podspecs/DoubleConversion.podspec`) + - boost (from `../node_modules/react-native-macos/third-party-podspecs/boost.podspec`) + - DoubleConversion (from `../node_modules/react-native-macos/third-party-podspecs/DoubleConversion.podspec`) - Example-Tests (from `..`) - - fast_float (from `../../node_modules/react-native-macos/third-party-podspecs/fast_float.podspec`) - - FBLazyVector (from `../../node_modules/react-native-macos/Libraries/FBLazyVector`) - - fmt (from `../../node_modules/react-native-macos/third-party-podspecs/fmt.podspec`) - - glog (from `../../node_modules/react-native-macos/third-party-podspecs/glog.podspec`) - - RCT-Folly (from `../../node_modules/react-native-macos/third-party-podspecs/RCT-Folly.podspec`) - - RCT-Folly/Fabric (from `../../node_modules/react-native-macos/third-party-podspecs/RCT-Folly.podspec`) - - RCTDeprecation (from `../../node_modules/react-native-macos/ReactApple/Libraries/RCTFoundation/RCTDeprecation`) - - RCTRequired (from `../../node_modules/react-native-macos/Libraries/Required`) - - RCTTypeSafety (from `../../node_modules/react-native-macos/Libraries/TypeSafety`) - - React (from `../../node_modules/react-native-macos/`) - - React-callinvoker (from `../../node_modules/react-native-macos/ReactCommon/callinvoker`) - - React-Core (from `../../node_modules/react-native-macos/`) - - React-Core/RCTWebSocket (from `../../node_modules/react-native-macos/`) - - React-CoreModules (from `../../node_modules/react-native-macos/React/CoreModules`) - - React-cxxreact (from `../../node_modules/react-native-macos/ReactCommon/cxxreact`) - - React-debug (from `../../node_modules/react-native-macos/ReactCommon/react/debug`) - - React-defaultsnativemodule (from `../../node_modules/react-native-macos/ReactCommon/react/nativemodule/defaults`) - - React-domnativemodule (from `../../node_modules/react-native-macos/ReactCommon/react/nativemodule/dom`) - - React-Fabric (from `../../node_modules/react-native-macos/ReactCommon`) - - React-FabricComponents (from `../../node_modules/react-native-macos/ReactCommon`) - - React-FabricImage (from `../../node_modules/react-native-macos/ReactCommon`) - - React-featureflags (from `../../node_modules/react-native-macos/ReactCommon/react/featureflags`) - - React-featureflagsnativemodule (from `../../node_modules/react-native-macos/ReactCommon/react/nativemodule/featureflags`) - - React-graphics (from `../../node_modules/react-native-macos/ReactCommon/react/renderer/graphics`) - - React-idlecallbacksnativemodule (from `../../node_modules/react-native-macos/ReactCommon/react/nativemodule/idlecallbacks`) - - React-ImageManager (from `../../node_modules/react-native-macos/ReactCommon/react/renderer/imagemanager/platform/ios`) - - React-jsc (from `../../node_modules/react-native-macos/ReactCommon/jsc`) - - React-jserrorhandler (from `../../node_modules/react-native-macos/ReactCommon/jserrorhandler`) - - React-jsi (from `../../node_modules/react-native-macos/ReactCommon/jsi`) - - React-jsiexecutor (from `../../node_modules/react-native-macos/ReactCommon/jsiexecutor`) - - React-jsinspector (from `../../node_modules/react-native-macos/ReactCommon/jsinspector-modern`) - - React-jsinspectortracing (from `../../node_modules/react-native-macos/ReactCommon/jsinspector-modern/tracing`) - - React-jsitracing (from `../../node_modules/react-native-macos/ReactCommon/hermes/executor/`) - - React-logger (from `../../node_modules/react-native-macos/ReactCommon/logger`) - - React-Mapbuffer (from `../../node_modules/react-native-macos/ReactCommon`) - - React-microtasksnativemodule (from `../../node_modules/react-native-macos/ReactCommon/react/nativemodule/microtasks`) - - react-native-safe-area-context (from `../../node_modules/react-native-safe-area-context`) - - React-NativeModulesApple (from `../../node_modules/react-native-macos/ReactCommon/react/nativemodule/core/platform/ios`) - - React-perflogger (from `../../node_modules/react-native-macos/ReactCommon/reactperflogger`) - - React-performancetimeline (from `../../node_modules/react-native-macos/ReactCommon/react/performance/timeline`) - - React-RCTActionSheet (from `../../node_modules/react-native-macos/Libraries/ActionSheetIOS`) - - React-RCTAnimation (from `../../node_modules/react-native-macos/Libraries/NativeAnimation`) - - React-RCTAppDelegate (from `../../node_modules/react-native-macos/Libraries/AppDelegate`) - - React-RCTBlob (from `../../node_modules/react-native-macos/Libraries/Blob`) - - React-RCTFabric (from `../../node_modules/react-native-macos/React`) - - React-RCTFBReactNativeSpec (from `../../node_modules/react-native-macos/React`) - - React-RCTImage (from `../../node_modules/react-native-macos/Libraries/Image`) - - React-RCTLinking (from `../../node_modules/react-native-macos/Libraries/LinkingIOS`) - - React-RCTNetwork (from `../../node_modules/react-native-macos/Libraries/Network`) - - React-RCTSettings (from `../../node_modules/react-native-macos/Libraries/Settings`) - - React-RCTText (from `../../node_modules/react-native-macos/Libraries/Text`) - - React-RCTVibration (from `../../node_modules/react-native-macos/Libraries/Vibration`) - - React-rendererconsistency (from `../../node_modules/react-native-macos/ReactCommon/react/renderer/consistency`) - - React-rendererdebug (from `../../node_modules/react-native-macos/ReactCommon/react/renderer/debug`) - - React-rncore (from `../../node_modules/react-native-macos/ReactCommon`) - - React-RuntimeApple (from `../../node_modules/react-native-macos/ReactCommon/react/runtime/platform/ios`) - - React-RuntimeCore (from `../../node_modules/react-native-macos/ReactCommon/react/runtime`) - - React-runtimeexecutor (from `../../node_modules/react-native-macos/ReactCommon/runtimeexecutor`) - - React-runtimescheduler (from `../../node_modules/react-native-macos/ReactCommon/react/renderer/runtimescheduler`) - - React-timing (from `../../node_modules/react-native-macos/ReactCommon/react/timing`) - - React-utils (from `../../node_modules/react-native-macos/ReactCommon/react/utils`) + - fast_float (from `../node_modules/react-native-macos/third-party-podspecs/fast_float.podspec`) + - FBLazyVector (from `../node_modules/react-native-macos/Libraries/FBLazyVector`) + - fmt (from `../node_modules/react-native-macos/third-party-podspecs/fmt.podspec`) + - glog (from `../node_modules/react-native-macos/third-party-podspecs/glog.podspec`) + - RCT-Folly (from `../node_modules/react-native-macos/third-party-podspecs/RCT-Folly.podspec`) + - RCT-Folly/Fabric (from `../node_modules/react-native-macos/third-party-podspecs/RCT-Folly.podspec`) + - RCTDeprecation (from `../node_modules/react-native-macos/ReactApple/Libraries/RCTFoundation/RCTDeprecation`) + - RCTRequired (from `../node_modules/react-native-macos/Libraries/Required`) + - RCTTypeSafety (from `../node_modules/react-native-macos/Libraries/TypeSafety`) + - React (from `../node_modules/react-native-macos/`) + - React-callinvoker (from `../node_modules/react-native-macos/ReactCommon/callinvoker`) + - React-Core (from `../node_modules/react-native-macos/`) + - React-Core/RCTWebSocket (from `../node_modules/react-native-macos/`) + - React-CoreModules (from `../node_modules/react-native-macos/React/CoreModules`) + - React-cxxreact (from `../node_modules/react-native-macos/ReactCommon/cxxreact`) + - React-debug (from `../node_modules/react-native-macos/ReactCommon/react/debug`) + - React-defaultsnativemodule (from `../node_modules/react-native-macos/ReactCommon/react/nativemodule/defaults`) + - React-domnativemodule (from `../node_modules/react-native-macos/ReactCommon/react/nativemodule/dom`) + - React-Fabric (from `../node_modules/react-native-macos/ReactCommon`) + - React-FabricComponents (from `../node_modules/react-native-macos/ReactCommon`) + - React-FabricImage (from `../node_modules/react-native-macos/ReactCommon`) + - React-featureflags (from `../node_modules/react-native-macos/ReactCommon/react/featureflags`) + - React-featureflagsnativemodule (from `../node_modules/react-native-macos/ReactCommon/react/nativemodule/featureflags`) + - React-graphics (from `../node_modules/react-native-macos/ReactCommon/react/renderer/graphics`) + - React-idlecallbacksnativemodule (from `../node_modules/react-native-macos/ReactCommon/react/nativemodule/idlecallbacks`) + - React-ImageManager (from `../node_modules/react-native-macos/ReactCommon/react/renderer/imagemanager/platform/ios`) + - React-jsc (from `../node_modules/react-native-macos/ReactCommon/jsc`) + - React-jserrorhandler (from `../node_modules/react-native-macos/ReactCommon/jserrorhandler`) + - React-jsi (from `../node_modules/react-native-macos/ReactCommon/jsi`) + - React-jsiexecutor (from `../node_modules/react-native-macos/ReactCommon/jsiexecutor`) + - React-jsinspector (from `../node_modules/react-native-macos/ReactCommon/jsinspector-modern`) + - React-jsinspectortracing (from `../node_modules/react-native-macos/ReactCommon/jsinspector-modern/tracing`) + - React-jsitracing (from `../node_modules/react-native-macos/ReactCommon/hermes/executor/`) + - React-logger (from `../node_modules/react-native-macos/ReactCommon/logger`) + - React-Mapbuffer (from `../node_modules/react-native-macos/ReactCommon`) + - React-microtasksnativemodule (from `../node_modules/react-native-macos/ReactCommon/react/nativemodule/microtasks`) + - react-native-safe-area-context (from `../node_modules/react-native-safe-area-context`) + - React-NativeModulesApple (from `../node_modules/react-native-macos/ReactCommon/react/nativemodule/core/platform/ios`) + - React-perflogger (from `../node_modules/react-native-macos/ReactCommon/reactperflogger`) + - React-performancetimeline (from `../node_modules/react-native-macos/ReactCommon/react/performance/timeline`) + - React-RCTActionSheet (from `../node_modules/react-native-macos/Libraries/ActionSheetIOS`) + - React-RCTAnimation (from `../node_modules/react-native-macos/Libraries/NativeAnimation`) + - React-RCTAppDelegate (from `../node_modules/react-native-macos/Libraries/AppDelegate`) + - React-RCTBlob (from `../node_modules/react-native-macos/Libraries/Blob`) + - React-RCTFabric (from `../node_modules/react-native-macos/React`) + - React-RCTFBReactNativeSpec (from `../node_modules/react-native-macos/React`) + - React-RCTImage (from `../node_modules/react-native-macos/Libraries/Image`) + - React-RCTLinking (from `../node_modules/react-native-macos/Libraries/LinkingIOS`) + - React-RCTNetwork (from `../node_modules/react-native-macos/Libraries/Network`) + - React-RCTSettings (from `../node_modules/react-native-macos/Libraries/Settings`) + - React-RCTText (from `../node_modules/react-native-macos/Libraries/Text`) + - React-RCTVibration (from `../node_modules/react-native-macos/Libraries/Vibration`) + - React-rendererconsistency (from `../node_modules/react-native-macos/ReactCommon/react/renderer/consistency`) + - React-rendererdebug (from `../node_modules/react-native-macos/ReactCommon/react/renderer/debug`) + - React-rncore (from `../node_modules/react-native-macos/ReactCommon`) + - React-RuntimeApple (from `../node_modules/react-native-macos/ReactCommon/react/runtime/platform/ios`) + - React-RuntimeCore (from `../node_modules/react-native-macos/ReactCommon/react/runtime`) + - React-runtimeexecutor (from `../node_modules/react-native-macos/ReactCommon/runtimeexecutor`) + - React-runtimescheduler (from `../node_modules/react-native-macos/ReactCommon/react/renderer/runtimescheduler`) + - React-timing (from `../node_modules/react-native-macos/ReactCommon/react/timing`) + - React-utils (from `../node_modules/react-native-macos/ReactCommon/react/utils`) - ReactAppDependencyProvider (from `build/generated/ios`) - ReactCodegen (from `build/generated/ios`) - - ReactCommon/turbomodule/core (from `../../node_modules/react-native-macos/ReactCommon`) + - ReactCommon/turbomodule/core (from `../node_modules/react-native-macos/ReactCommon`) - "ReactNativeHost (from `../../node_modules/@rnx-kit/react-native-host`)" - ReactTestApp-DevSupport (from `../node_modules/react-native-test-app`) - ReactTestApp-Resources (from `..`) - "RNWWebStorage (from `../node_modules/@react-native-webapis/web-storage`)" - - SocketRocket (from `../../node_modules/react-native-macos/third-party-podspecs/SocketRocket.podspec`) - - Yoga (from `../../node_modules/react-native-macos/ReactCommon/yoga`) + - SocketRocket (from `../node_modules/react-native-macos/third-party-podspecs/SocketRocket.podspec`) + - Yoga (from `../node_modules/react-native-macos/ReactCommon/yoga`) EXTERNAL SOURCES: boost: - :podspec: "../../node_modules/react-native-macos/third-party-podspecs/boost.podspec" + :podspec: "../node_modules/react-native-macos/third-party-podspecs/boost.podspec" DoubleConversion: - :podspec: "../../node_modules/react-native-macos/third-party-podspecs/DoubleConversion.podspec" + :podspec: "../node_modules/react-native-macos/third-party-podspecs/DoubleConversion.podspec" Example-Tests: :path: ".." fast_float: - :podspec: "../../node_modules/react-native-macos/third-party-podspecs/fast_float.podspec" + :podspec: "../node_modules/react-native-macos/third-party-podspecs/fast_float.podspec" FBLazyVector: - :path: "../../node_modules/react-native-macos/Libraries/FBLazyVector" + :path: "../node_modules/react-native-macos/Libraries/FBLazyVector" fmt: - :podspec: "../../node_modules/react-native-macos/third-party-podspecs/fmt.podspec" + :podspec: "../node_modules/react-native-macos/third-party-podspecs/fmt.podspec" glog: - :podspec: "../../node_modules/react-native-macos/third-party-podspecs/glog.podspec" + :podspec: "../node_modules/react-native-macos/third-party-podspecs/glog.podspec" RCT-Folly: - :podspec: "../../node_modules/react-native-macos/third-party-podspecs/RCT-Folly.podspec" + :podspec: "../node_modules/react-native-macos/third-party-podspecs/RCT-Folly.podspec" RCTDeprecation: - :path: "../../node_modules/react-native-macos/ReactApple/Libraries/RCTFoundation/RCTDeprecation" + :path: "../node_modules/react-native-macos/ReactApple/Libraries/RCTFoundation/RCTDeprecation" RCTRequired: - :path: "../../node_modules/react-native-macos/Libraries/Required" + :path: "../node_modules/react-native-macos/Libraries/Required" RCTTypeSafety: - :path: "../../node_modules/react-native-macos/Libraries/TypeSafety" + :path: "../node_modules/react-native-macos/Libraries/TypeSafety" React: - :path: "../../node_modules/react-native-macos/" + :path: "../node_modules/react-native-macos/" React-callinvoker: - :path: "../../node_modules/react-native-macos/ReactCommon/callinvoker" + :path: "../node_modules/react-native-macos/ReactCommon/callinvoker" React-Core: - :path: "../../node_modules/react-native-macos/" + :path: "../node_modules/react-native-macos/" React-CoreModules: - :path: "../../node_modules/react-native-macos/React/CoreModules" + :path: "../node_modules/react-native-macos/React/CoreModules" React-cxxreact: - :path: "../../node_modules/react-native-macos/ReactCommon/cxxreact" + :path: "../node_modules/react-native-macos/ReactCommon/cxxreact" React-debug: - :path: "../../node_modules/react-native-macos/ReactCommon/react/debug" + :path: "../node_modules/react-native-macos/ReactCommon/react/debug" React-defaultsnativemodule: - :path: "../../node_modules/react-native-macos/ReactCommon/react/nativemodule/defaults" + :path: "../node_modules/react-native-macos/ReactCommon/react/nativemodule/defaults" React-domnativemodule: - :path: "../../node_modules/react-native-macos/ReactCommon/react/nativemodule/dom" + :path: "../node_modules/react-native-macos/ReactCommon/react/nativemodule/dom" React-Fabric: - :path: "../../node_modules/react-native-macos/ReactCommon" + :path: "../node_modules/react-native-macos/ReactCommon" React-FabricComponents: - :path: "../../node_modules/react-native-macos/ReactCommon" + :path: "../node_modules/react-native-macos/ReactCommon" React-FabricImage: - :path: "../../node_modules/react-native-macos/ReactCommon" + :path: "../node_modules/react-native-macos/ReactCommon" React-featureflags: - :path: "../../node_modules/react-native-macos/ReactCommon/react/featureflags" + :path: "../node_modules/react-native-macos/ReactCommon/react/featureflags" React-featureflagsnativemodule: - :path: "../../node_modules/react-native-macos/ReactCommon/react/nativemodule/featureflags" + :path: "../node_modules/react-native-macos/ReactCommon/react/nativemodule/featureflags" React-graphics: - :path: "../../node_modules/react-native-macos/ReactCommon/react/renderer/graphics" + :path: "../node_modules/react-native-macos/ReactCommon/react/renderer/graphics" React-idlecallbacksnativemodule: - :path: "../../node_modules/react-native-macos/ReactCommon/react/nativemodule/idlecallbacks" + :path: "../node_modules/react-native-macos/ReactCommon/react/nativemodule/idlecallbacks" React-ImageManager: - :path: "../../node_modules/react-native-macos/ReactCommon/react/renderer/imagemanager/platform/ios" + :path: "../node_modules/react-native-macos/ReactCommon/react/renderer/imagemanager/platform/ios" React-jsc: - :path: "../../node_modules/react-native-macos/ReactCommon/jsc" + :path: "../node_modules/react-native-macos/ReactCommon/jsc" React-jserrorhandler: - :path: "../../node_modules/react-native-macos/ReactCommon/jserrorhandler" + :path: "../node_modules/react-native-macos/ReactCommon/jserrorhandler" React-jsi: - :path: "../../node_modules/react-native-macos/ReactCommon/jsi" + :path: "../node_modules/react-native-macos/ReactCommon/jsi" React-jsiexecutor: - :path: "../../node_modules/react-native-macos/ReactCommon/jsiexecutor" + :path: "../node_modules/react-native-macos/ReactCommon/jsiexecutor" React-jsinspector: - :path: "../../node_modules/react-native-macos/ReactCommon/jsinspector-modern" + :path: "../node_modules/react-native-macos/ReactCommon/jsinspector-modern" React-jsinspectortracing: - :path: "../../node_modules/react-native-macos/ReactCommon/jsinspector-modern/tracing" + :path: "../node_modules/react-native-macos/ReactCommon/jsinspector-modern/tracing" React-jsitracing: - :path: "../../node_modules/react-native-macos/ReactCommon/hermes/executor/" + :path: "../node_modules/react-native-macos/ReactCommon/hermes/executor/" React-logger: - :path: "../../node_modules/react-native-macos/ReactCommon/logger" + :path: "../node_modules/react-native-macos/ReactCommon/logger" React-Mapbuffer: - :path: "../../node_modules/react-native-macos/ReactCommon" + :path: "../node_modules/react-native-macos/ReactCommon" React-microtasksnativemodule: - :path: "../../node_modules/react-native-macos/ReactCommon/react/nativemodule/microtasks" + :path: "../node_modules/react-native-macos/ReactCommon/react/nativemodule/microtasks" react-native-safe-area-context: - :path: "../../node_modules/react-native-safe-area-context" + :path: "../node_modules/react-native-safe-area-context" React-NativeModulesApple: - :path: "../../node_modules/react-native-macos/ReactCommon/react/nativemodule/core/platform/ios" + :path: "../node_modules/react-native-macos/ReactCommon/react/nativemodule/core/platform/ios" React-perflogger: - :path: "../../node_modules/react-native-macos/ReactCommon/reactperflogger" + :path: "../node_modules/react-native-macos/ReactCommon/reactperflogger" React-performancetimeline: - :path: "../../node_modules/react-native-macos/ReactCommon/react/performance/timeline" + :path: "../node_modules/react-native-macos/ReactCommon/react/performance/timeline" React-RCTActionSheet: - :path: "../../node_modules/react-native-macos/Libraries/ActionSheetIOS" + :path: "../node_modules/react-native-macos/Libraries/ActionSheetIOS" React-RCTAnimation: - :path: "../../node_modules/react-native-macos/Libraries/NativeAnimation" + :path: "../node_modules/react-native-macos/Libraries/NativeAnimation" React-RCTAppDelegate: - :path: "../../node_modules/react-native-macos/Libraries/AppDelegate" + :path: "../node_modules/react-native-macos/Libraries/AppDelegate" React-RCTBlob: - :path: "../../node_modules/react-native-macos/Libraries/Blob" + :path: "../node_modules/react-native-macos/Libraries/Blob" React-RCTFabric: - :path: "../../node_modules/react-native-macos/React" + :path: "../node_modules/react-native-macos/React" React-RCTFBReactNativeSpec: - :path: "../../node_modules/react-native-macos/React" + :path: "../node_modules/react-native-macos/React" React-RCTImage: - :path: "../../node_modules/react-native-macos/Libraries/Image" + :path: "../node_modules/react-native-macos/Libraries/Image" React-RCTLinking: - :path: "../../node_modules/react-native-macos/Libraries/LinkingIOS" + :path: "../node_modules/react-native-macos/Libraries/LinkingIOS" React-RCTNetwork: - :path: "../../node_modules/react-native-macos/Libraries/Network" + :path: "../node_modules/react-native-macos/Libraries/Network" React-RCTSettings: - :path: "../../node_modules/react-native-macos/Libraries/Settings" + :path: "../node_modules/react-native-macos/Libraries/Settings" React-RCTText: - :path: "../../node_modules/react-native-macos/Libraries/Text" + :path: "../node_modules/react-native-macos/Libraries/Text" React-RCTVibration: - :path: "../../node_modules/react-native-macos/Libraries/Vibration" + :path: "../node_modules/react-native-macos/Libraries/Vibration" React-rendererconsistency: - :path: "../../node_modules/react-native-macos/ReactCommon/react/renderer/consistency" + :path: "../node_modules/react-native-macos/ReactCommon/react/renderer/consistency" React-rendererdebug: - :path: "../../node_modules/react-native-macos/ReactCommon/react/renderer/debug" + :path: "../node_modules/react-native-macos/ReactCommon/react/renderer/debug" React-rncore: - :path: "../../node_modules/react-native-macos/ReactCommon" + :path: "../node_modules/react-native-macos/ReactCommon" React-RuntimeApple: - :path: "../../node_modules/react-native-macos/ReactCommon/react/runtime/platform/ios" + :path: "../node_modules/react-native-macos/ReactCommon/react/runtime/platform/ios" React-RuntimeCore: - :path: "../../node_modules/react-native-macos/ReactCommon/react/runtime" + :path: "../node_modules/react-native-macos/ReactCommon/react/runtime" React-runtimeexecutor: - :path: "../../node_modules/react-native-macos/ReactCommon/runtimeexecutor" + :path: "../node_modules/react-native-macos/ReactCommon/runtimeexecutor" React-runtimescheduler: - :path: "../../node_modules/react-native-macos/ReactCommon/react/renderer/runtimescheduler" + :path: "../node_modules/react-native-macos/ReactCommon/react/renderer/runtimescheduler" React-timing: - :path: "../../node_modules/react-native-macos/ReactCommon/react/timing" + :path: "../node_modules/react-native-macos/ReactCommon/react/timing" React-utils: - :path: "../../node_modules/react-native-macos/ReactCommon/react/utils" + :path: "../node_modules/react-native-macos/ReactCommon/react/utils" ReactAppDependencyProvider: :path: build/generated/ios ReactCodegen: :path: build/generated/ios ReactCommon: - :path: "../../node_modules/react-native-macos/ReactCommon" + :path: "../node_modules/react-native-macos/ReactCommon" ReactNativeHost: :path: "../../node_modules/@rnx-kit/react-native-host" ReactTestApp-DevSupport: @@ -1750,9 +1750,9 @@ EXTERNAL SOURCES: RNWWebStorage: :path: "../node_modules/@react-native-webapis/web-storage" SocketRocket: - :podspec: "../../node_modules/react-native-macos/third-party-podspecs/SocketRocket.podspec" + :podspec: "../node_modules/react-native-macos/third-party-podspecs/SocketRocket.podspec" Yoga: - :path: "../../node_modules/react-native-macos/ReactCommon/yoga" + :path: "../node_modules/react-native-macos/ReactCommon/yoga" SPEC CHECKSUMS: boost: 7d49a506d1ac47358fea28558d184dd6431170ca @@ -1818,7 +1818,7 @@ SPEC CHECKSUMS: React-timing: 603df0b59afb508934070c569cc568ef72778420 React-utils: ead2ca0433b3c1684ccfa9b9cb89602c44b89846 ReactAppDependencyProvider: a12262458b50521ba56afb93f4cc875732f9d643 - ReactCodegen: 191e4a5cb0241651f2fcf21d79729c6465f0f905 + ReactCodegen: 3d30536e47f328f0a297d897cb789e46a092c2a6 ReactCommon: 0f22e3dd34a8215b8482778898f6e1e95572c498 ReactNativeHost: 771c74c764b7bf1fa0ec613a4b5ee96db304ca0f ReactTestApp-DevSupport: 2386e7c22084f8a550cfadcc0bde140c7dc328a1 diff --git a/example/metro.config.js b/packages/app/example/metro.config.js similarity index 100% rename from example/metro.config.js rename to packages/app/example/metro.config.js diff --git a/example/package.json b/packages/app/example/package.json similarity index 100% rename from example/package.json rename to packages/app/example/package.json diff --git a/example/react-native.config.js b/packages/app/example/react-native.config.js similarity index 100% rename from example/react-native.config.js rename to packages/app/example/react-native.config.js diff --git a/example/src/App.tsx b/packages/app/example/src/App.tsx similarity index 90% rename from example/src/App.tsx rename to packages/app/example/src/App.tsx index 4457f2e55..6a61b08b5 100644 --- a/example/src/App.tsx +++ b/packages/app/example/src/App.tsx @@ -15,7 +15,6 @@ import { Separator } from "./Separator"; import { getHermesVersion, isBridgeless, - isConcurrentReactEnabled, isFabricInstance, ReactNativeVersion, } from "./core"; @@ -40,7 +39,7 @@ function useIsFabricComponent() { return [isFabric, setter] as const; } -export function App(props: AppProps): React.ReactElement { +export function App(_props: AppProps): React.ReactElement { const isDarkMode = useColorScheme() === "dark"; const styles = useStyles(); const [isFabric, setIsFabric] = useIsFabricComponent(); @@ -65,9 +64,7 @@ export function App(props: AppProps): React.ReactElement { Fabric - - Concurrent React - + Concurrent React Bridgeless diff --git a/example/src/Feature.tsx b/packages/app/example/src/Feature.tsx similarity index 100% rename from example/src/Feature.tsx rename to packages/app/example/src/Feature.tsx diff --git a/example/src/LocalStorage.tsx b/packages/app/example/src/LocalStorage.tsx similarity index 100% rename from example/src/LocalStorage.tsx rename to packages/app/example/src/LocalStorage.tsx diff --git a/example/src/RemoteDebugging.tsx b/packages/app/example/src/RemoteDebugging.tsx similarity index 100% rename from example/src/RemoteDebugging.tsx rename to packages/app/example/src/RemoteDebugging.tsx diff --git a/example/src/SafeAreaView.tsx b/packages/app/example/src/SafeAreaView.tsx similarity index 100% rename from example/src/SafeAreaView.tsx rename to packages/app/example/src/SafeAreaView.tsx diff --git a/example/src/Separator.tsx b/packages/app/example/src/Separator.tsx similarity index 100% rename from example/src/Separator.tsx rename to packages/app/example/src/Separator.tsx diff --git a/example/src/core.ts b/packages/app/example/src/core.ts similarity index 78% rename from example/src/core.ts rename to packages/app/example/src/core.ts index 1d526d8a7..db9eaccbf 100644 --- a/example/src/core.ts +++ b/packages/app/example/src/core.ts @@ -53,24 +53,13 @@ export function isBridgeless() { return "RN$Bridgeless" in global && global.RN$Bridgeless === true; } -export function isConcurrentReactEnabled( - props: { concurrentRoot?: boolean }, - isFabric: boolean -): boolean { - const { major, minor } = ReactNativeVersion; - const version = major * 10000 + minor; - // As of 0.74, it won't be possible to opt-out: - // https://github.com/facebook/react-native/commit/30d186c3683228d4fb7a42f804eb2fdfa7c8ac03 - return isFabric && (version >= 74 || props.concurrentRoot !== false); -} - export function isFabricInstance( ref: NativeSyntheticEvent["currentTarget"] ): boolean { return Boolean( - // @ts-expect-error — https://github.com/facebook/react-native/blob/0.72-stable/packages/react-native/Libraries/Renderer/public/ReactFabricPublicInstanceUtils.js + // @ts-expect-error — https://github.com/facebook/react-native/blob/0.76-stable/packages/react-native/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricPublicInstanceUtils.js ref["__nativeTag"] || - // @ts-expect-error — https://github.com/facebook/react-native/blob/0.72-stable/packages/react-native/Libraries/Renderer/public/ReactFabricPublicInstanceUtils.js + // @ts-expect-error — https://github.com/facebook/react-native/blob/0.76-stable/packages/react-native/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricPublicInstanceUtils.js ref["_internalInstanceHandle"]?.stateNode?.canonical ); } diff --git a/example/src/styles.ts b/packages/app/example/src/styles.ts similarity index 100% rename from example/src/styles.ts rename to packages/app/example/src/styles.ts diff --git a/example/test/config.test.mjs b/packages/app/example/test/config.test.mjs similarity index 98% rename from example/test/config.test.mjs rename to packages/app/example/test/config.test.mjs index d3cdeb28f..e88048826 100644 --- a/example/test/config.test.mjs +++ b/packages/app/example/test/config.test.mjs @@ -33,10 +33,10 @@ test("react-native config", async (t) => { const loadConfig = await getLoadConfig(); const currentDir = process.cwd(); - const projectRoot = path.sep + "react-native-test-app"; + const projectRoot = path.sep + path.join("packages", "app"); const exampleRoot = path.join(projectRoot, "example"); const reactNativePath = path.join( - projectRoot, + exampleRoot, "node_modules", "react-native" ); diff --git a/example/test/specs/app.spec.mjs b/packages/app/example/test/specs/app.spec.mjs similarity index 100% rename from example/test/specs/app.spec.mjs rename to packages/app/example/test/specs/app.spec.mjs diff --git a/example/test/specs/wdio.config.mjs b/packages/app/example/test/specs/wdio.config.mjs similarity index 100% rename from example/test/specs/wdio.config.mjs rename to packages/app/example/test/specs/wdio.config.mjs diff --git a/example/tsconfig.json b/packages/app/example/tsconfig.json similarity index 100% rename from example/tsconfig.json rename to packages/app/example/tsconfig.json diff --git a/example/visionos/Podfile b/packages/app/example/visionos/Podfile similarity index 100% rename from example/visionos/Podfile rename to packages/app/example/visionos/Podfile diff --git a/example/visionos/Podfile.lock b/packages/app/example/visionos/Podfile.lock similarity index 99% rename from example/visionos/Podfile.lock rename to packages/app/example/visionos/Podfile.lock index d2938b4cd..25e88d532 100644 --- a/example/visionos/Podfile.lock +++ b/packages/app/example/visionos/Podfile.lock @@ -1628,7 +1628,7 @@ DEPENDENCIES: - "React-logger (from `../node_modules/@callstack/react-native-visionos/ReactCommon/logger`)" - "React-Mapbuffer (from `../node_modules/@callstack/react-native-visionos/ReactCommon`)" - "React-microtasksnativemodule (from `../node_modules/@callstack/react-native-visionos/ReactCommon/react/nativemodule/microtasks`)" - - react-native-safe-area-context (from `../../node_modules/react-native-safe-area-context`) + - react-native-safe-area-context (from `../node_modules/react-native-safe-area-context`) - "React-NativeModulesApple (from `../node_modules/@callstack/react-native-visionos/ReactCommon/react/nativemodule/core/platform/ios`)" - "React-perflogger (from `../node_modules/@callstack/react-native-visionos/ReactCommon/reactperflogger`)" - "React-performancetimeline (from `../node_modules/@callstack/react-native-visionos/ReactCommon/react/performance/timeline`)" @@ -1745,7 +1745,7 @@ EXTERNAL SOURCES: React-microtasksnativemodule: :path: "../node_modules/@callstack/react-native-visionos/ReactCommon/react/nativemodule/microtasks" react-native-safe-area-context: - :path: "../../node_modules/react-native-safe-area-context" + :path: "../node_modules/react-native-safe-area-context" React-NativeModulesApple: :path: "../node_modules/@callstack/react-native-visionos/ReactCommon/react/nativemodule/core/platform/ios" React-perflogger: diff --git a/example/windows/.gitignore b/packages/app/example/windows/.gitignore similarity index 100% rename from example/windows/.gitignore rename to packages/app/example/windows/.gitignore diff --git a/example/windows/ReactAppTests/ReactAppTests.vcxproj b/packages/app/example/windows/ReactAppTests/ReactAppTests.vcxproj similarity index 100% rename from example/windows/ReactAppTests/ReactAppTests.vcxproj rename to packages/app/example/windows/ReactAppTests/ReactAppTests.vcxproj diff --git a/example/windows/ReactAppTests/ReactAppTests.vcxproj.filters b/packages/app/example/windows/ReactAppTests/ReactAppTests.vcxproj.filters similarity index 100% rename from example/windows/ReactAppTests/ReactAppTests.vcxproj.filters rename to packages/app/example/windows/ReactAppTests/ReactAppTests.vcxproj.filters diff --git a/example/windows/ReactAppTests/Tests.cpp b/packages/app/example/windows/ReactAppTests/Tests.cpp similarity index 100% rename from example/windows/ReactAppTests/Tests.cpp rename to packages/app/example/windows/ReactAppTests/Tests.cpp diff --git a/images/RNTA_full.png b/packages/app/images/RNTA_full.png similarity index 100% rename from images/RNTA_full.png rename to packages/app/images/RNTA_full.png diff --git a/images/RNTA_small.png b/packages/app/images/RNTA_small.png similarity index 100% rename from images/RNTA_small.png rename to packages/app/images/RNTA_small.png diff --git a/images/header.jpg b/packages/app/images/header.jpg similarity index 100% rename from images/header.jpg rename to packages/app/images/header.jpg diff --git a/ios/ReactTestApp.xcodeproj/project.pbxproj b/packages/app/ios/ReactTestApp.xcodeproj/project.pbxproj similarity index 100% rename from ios/ReactTestApp.xcodeproj/project.pbxproj rename to packages/app/ios/ReactTestApp.xcodeproj/project.pbxproj diff --git a/ios/ReactTestApp.xcodeproj/xcshareddata/xcschemes/ReactTestApp.xcscheme b/packages/app/ios/ReactTestApp.xcodeproj/xcshareddata/xcschemes/ReactTestApp.xcscheme similarity index 100% rename from ios/ReactTestApp.xcodeproj/xcshareddata/xcschemes/ReactTestApp.xcscheme rename to packages/app/ios/ReactTestApp.xcodeproj/xcshareddata/xcschemes/ReactTestApp.xcscheme diff --git a/ios/ReactTestApp/AppDelegate.swift b/packages/app/ios/ReactTestApp/AppDelegate.swift similarity index 100% rename from ios/ReactTestApp/AppDelegate.swift rename to packages/app/ios/ReactTestApp/AppDelegate.swift diff --git a/ios/ReactTestApp/AppRegistryModule.h b/packages/app/ios/ReactTestApp/AppRegistryModule.h similarity index 100% rename from ios/ReactTestApp/AppRegistryModule.h rename to packages/app/ios/ReactTestApp/AppRegistryModule.h diff --git a/ios/ReactTestApp/AppRegistryModule.mm b/packages/app/ios/ReactTestApp/AppRegistryModule.mm similarity index 100% rename from ios/ReactTestApp/AppRegistryModule.mm rename to packages/app/ios/ReactTestApp/AppRegistryModule.mm diff --git a/ios/ReactTestApp/Assets.xcassets/AppIcon.appiconset/Contents.json b/packages/app/ios/ReactTestApp/Assets.xcassets/AppIcon.appiconset/Contents.json similarity index 100% rename from ios/ReactTestApp/Assets.xcassets/AppIcon.appiconset/Contents.json rename to packages/app/ios/ReactTestApp/Assets.xcassets/AppIcon.appiconset/Contents.json diff --git a/ios/ReactTestApp/Assets.xcassets/Contents.json b/packages/app/ios/ReactTestApp/Assets.xcassets/Contents.json similarity index 100% rename from ios/ReactTestApp/Assets.xcassets/Contents.json rename to packages/app/ios/ReactTestApp/Assets.xcassets/Contents.json diff --git a/ios/ReactTestApp/ContentView.swift b/packages/app/ios/ReactTestApp/ContentView.swift similarity index 100% rename from ios/ReactTestApp/ContentView.swift rename to packages/app/ios/ReactTestApp/ContentView.swift diff --git a/ios/ReactTestApp/Info.plist b/packages/app/ios/ReactTestApp/Info.plist similarity index 100% rename from ios/ReactTestApp/Info.plist rename to packages/app/ios/ReactTestApp/Info.plist diff --git a/ios/ReactTestApp/Manifest.swift b/packages/app/ios/ReactTestApp/Manifest.swift similarity index 100% rename from ios/ReactTestApp/Manifest.swift rename to packages/app/ios/ReactTestApp/Manifest.swift diff --git a/ios/ReactTestApp/Public/ReactTestApp-DevSupport-Bridging-Header.h b/packages/app/ios/ReactTestApp/Public/ReactTestApp-DevSupport-Bridging-Header.h similarity index 100% rename from ios/ReactTestApp/Public/ReactTestApp-DevSupport-Bridging-Header.h rename to packages/app/ios/ReactTestApp/Public/ReactTestApp-DevSupport-Bridging-Header.h diff --git a/ios/ReactTestApp/Public/ReactTestApp-DevSupport.h b/packages/app/ios/ReactTestApp/Public/ReactTestApp-DevSupport.h similarity index 100% rename from ios/ReactTestApp/Public/ReactTestApp-DevSupport.h rename to packages/app/ios/ReactTestApp/Public/ReactTestApp-DevSupport.h diff --git a/ios/ReactTestApp/QRCodeScannerViewController.swift b/packages/app/ios/ReactTestApp/QRCodeScannerViewController.swift similarity index 100% rename from ios/ReactTestApp/QRCodeScannerViewController.swift rename to packages/app/ios/ReactTestApp/QRCodeScannerViewController.swift diff --git a/ios/ReactTestApp/React+Compatibility.h b/packages/app/ios/ReactTestApp/React+Compatibility.h similarity index 100% rename from ios/ReactTestApp/React+Compatibility.h rename to packages/app/ios/ReactTestApp/React+Compatibility.h diff --git a/ios/ReactTestApp/React+Compatibility.m b/packages/app/ios/ReactTestApp/React+Compatibility.m similarity index 54% rename from ios/ReactTestApp/React+Compatibility.m rename to packages/app/ios/ReactTestApp/React+Compatibility.m index 7f55efdde..1594b15ea 100644 --- a/ios/ReactTestApp/React+Compatibility.m +++ b/packages/app/ios/ReactTestApp/React+Compatibility.m @@ -47,63 +47,11 @@ void RTADisableRemoteDebugging() #endif } -// MARK: - [0.71.13] The additional `inlineSourceMap:` was added in 0.71.13 -// See https://github.com/facebook/react-native/commit/f7219ec02d71d2f0f6c71af4d5c3d4850a898fd8 - NSURL *RTADefaultJSBundleURL() { -#if REACT_NATIVE_VERSION < MAKE_VERSION(0, 71, 13) - return [RCTBundleURLProvider jsBundleURLForBundleRoot:@"index" - packagerHost:@"localhost" - enableDev:YES - enableMinification:NO]; -#else return [RCTBundleURLProvider jsBundleURLForBundleRoot:@"index" packagerHost:@"localhost" enableDev:YES enableMinification:NO inlineSourceMap:YES]; -#endif } - -// MARK: - [0.70.0] Alerts don't show when using UIScene -// See https://github.com/facebook/react-native/pull/35716 - -#if !TARGET_OS_OSX && REACT_NATIVE_VERSION < MAKE_VERSION(0, 72, 0) - -#import -#import - -@implementation RCTAlertController (ReactTestApp) - -+ (void)initialize -{ - if ([self class] != [RCTAlertController class]) { - return; - } - - if (@available(iOS 13.0, *)) { - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - RTASwizzleSelector([self class], @selector(hide), @selector(rta_hide)); - RTASwizzleSelector( - [self class], @selector(show:completion:), @selector(rta_show:completion:)); - }); - } -} - -- (void)rta_hide -{ - // noop -} - -- (void)rta_show:(BOOL)animated completion:(void (^)(void))completion -{ - [[RCTKeyWindow() rootViewController] presentViewController:self - animated:animated - completion:completion]; -} - -@end - -#endif // !TARGET_OS_OSX && REACT_NATIVE_VERSION < 0.72.0 diff --git a/ios/ReactTestApp/ReactInstance.swift b/packages/app/ios/ReactTestApp/ReactInstance.swift similarity index 100% rename from ios/ReactTestApp/ReactInstance.swift rename to packages/app/ios/ReactTestApp/ReactInstance.swift diff --git a/ios/ReactTestApp/ReactTestApp-Bridging-Header.h b/packages/app/ios/ReactTestApp/ReactTestApp-Bridging-Header.h similarity index 100% rename from ios/ReactTestApp/ReactTestApp-Bridging-Header.h rename to packages/app/ios/ReactTestApp/ReactTestApp-Bridging-Header.h diff --git a/ios/ReactTestApp/ReactTestApp-DevSupport.m b/packages/app/ios/ReactTestApp/ReactTestApp-DevSupport.m similarity index 100% rename from ios/ReactTestApp/ReactTestApp-DevSupport.m rename to packages/app/ios/ReactTestApp/ReactTestApp-DevSupport.m diff --git a/ios/ReactTestApp/ReactTestApp.common.xcconfig b/packages/app/ios/ReactTestApp/ReactTestApp.common.xcconfig similarity index 100% rename from ios/ReactTestApp/ReactTestApp.common.xcconfig rename to packages/app/ios/ReactTestApp/ReactTestApp.common.xcconfig diff --git a/ios/ReactTestApp/ReactTestApp.debug.xcconfig b/packages/app/ios/ReactTestApp/ReactTestApp.debug.xcconfig similarity index 100% rename from ios/ReactTestApp/ReactTestApp.debug.xcconfig rename to packages/app/ios/ReactTestApp/ReactTestApp.debug.xcconfig diff --git a/ios/ReactTestApp/ReactTestApp.release.xcconfig b/packages/app/ios/ReactTestApp/ReactTestApp.release.xcconfig similarity index 100% rename from ios/ReactTestApp/ReactTestApp.release.xcconfig rename to packages/app/ios/ReactTestApp/ReactTestApp.release.xcconfig diff --git a/ios/ReactTestApp/SceneDelegate.swift b/packages/app/ios/ReactTestApp/SceneDelegate.swift similarity index 100% rename from ios/ReactTestApp/SceneDelegate.swift rename to packages/app/ios/ReactTestApp/SceneDelegate.swift diff --git a/ios/ReactTestApp/Session.swift b/packages/app/ios/ReactTestApp/Session.swift similarity index 100% rename from ios/ReactTestApp/Session.swift rename to packages/app/ios/ReactTestApp/Session.swift diff --git a/ios/ReactTestApp/UIViewController+ReactTestApp.h b/packages/app/ios/ReactTestApp/UIViewController+ReactTestApp.h similarity index 100% rename from ios/ReactTestApp/UIViewController+ReactTestApp.h rename to packages/app/ios/ReactTestApp/UIViewController+ReactTestApp.h diff --git a/ios/ReactTestApp/UIViewController+ReactTestApp.m b/packages/app/ios/ReactTestApp/UIViewController+ReactTestApp.m similarity index 100% rename from ios/ReactTestApp/UIViewController+ReactTestApp.m rename to packages/app/ios/ReactTestApp/UIViewController+ReactTestApp.m diff --git a/ios/ReactTestAppTests/Info.plist b/packages/app/ios/ReactTestAppTests/Info.plist similarity index 100% rename from ios/ReactTestAppTests/Info.plist rename to packages/app/ios/ReactTestAppTests/Info.plist diff --git a/ios/ReactTestAppTests/ReactTestAppTests.swift b/packages/app/ios/ReactTestAppTests/ReactTestAppTests.swift similarity index 100% rename from ios/ReactTestAppTests/ReactTestAppTests.swift rename to packages/app/ios/ReactTestAppTests/ReactTestAppTests.swift diff --git a/ios/ReactTestAppUITests/Info.plist b/packages/app/ios/ReactTestAppUITests/Info.plist similarity index 100% rename from ios/ReactTestAppUITests/Info.plist rename to packages/app/ios/ReactTestAppUITests/Info.plist diff --git a/ios/ReactTestAppUITests/ReactTestAppUITests.swift b/packages/app/ios/ReactTestAppUITests/ReactTestAppUITests.swift similarity index 100% rename from ios/ReactTestAppUITests/ReactTestAppUITests.swift rename to packages/app/ios/ReactTestAppUITests/ReactTestAppUITests.swift diff --git a/ios/app.mjs b/packages/app/ios/app.mjs similarity index 91% rename from ios/app.mjs rename to packages/app/ios/app.mjs index 353b21cda..454da211c 100644 --- a/ios/app.mjs +++ b/packages/app/ios/app.mjs @@ -8,7 +8,6 @@ import { isMain, readTextFile, toVersionNumber, - v, } from "../scripts/helpers.js"; import { cp_r, mkdir_p, rm_r } from "../scripts/utils/filesystem.mjs"; import { generateAssetsCatalogs } from "./assetsCatalog.mjs"; @@ -78,31 +77,6 @@ function exportNodeBinaryPath(projectRoot, destination, fs = nodefs) { ); } -/** - * @param {string} reactNativePath - * @param {number} reactNativeVersion - * @returns {string | undefined} - */ -function findCommunityAutolinkingScriptPath( - reactNativePath, - reactNativeVersion, - fs = nodefs -) { - // As of 0.75, we should use `use_native_modules!` from `react-native` instead - if (reactNativeVersion < v(0, 75, 0)) { - const pkgPath = findFile( - "node_modules/@react-native-community/cli-platform-ios", - reactNativePath, - fs - ); - if (pkgPath) { - return path.join(pkgPath, "native_modules.rb"); - } - } - - return undefined; -} - /** * @param {string} projectRoot * @returns {string} @@ -238,12 +212,7 @@ export function generateProject( reactNativePath: path.resolve(reactNativePath), reactNativeVersion, reactNativeHostPath: findReactNativeHostPath(projectRoot, fs), - communityAutolinkingScriptPath: findCommunityAutolinkingScriptPath( - reactNativePath, - reactNativeVersion, - fs - ), - useHermes: isHermesEnabled(targetPlatform, reactNativeVersion, options), + useHermes: isHermesEnabled(reactNativeVersion, options), useNewArch: isNewArchEnabled(reactNativeVersion, options), useBridgeless: isBridgelessEnabled(reactNativeVersion, options), buildSettings: {}, diff --git a/ios/assetsCatalog.mjs b/packages/app/ios/assetsCatalog.mjs similarity index 100% rename from ios/assetsCatalog.mjs rename to packages/app/ios/assetsCatalog.mjs diff --git a/ios/entitlements.mjs b/packages/app/ios/entitlements.mjs similarity index 100% rename from ios/entitlements.mjs rename to packages/app/ios/entitlements.mjs diff --git a/ios/features.mjs b/packages/app/ios/features.mjs similarity index 67% rename from ios/features.mjs rename to packages/app/ios/features.mjs index 90f9f5f71..aca7af07b 100644 --- a/ios/features.mjs +++ b/packages/app/ios/features.mjs @@ -1,5 +1,5 @@ // @ts-check -/** @import { ApplePlatform, JSONObject } from "../scripts/types.ts"; */ +/** @import { JSONObject } from "../scripts/types.ts"; */ import { v } from "../scripts/helpers.js"; /** @@ -9,13 +9,6 @@ function isNewArchExclusive(reactNativeVersion) { return reactNativeVersion >= v(0, 82, 0); } -/** - * @param {number} reactNativeVersion - */ -function supportsNewArch(reactNativeVersion) { - return reactNativeVersion === 0 || reactNativeVersion >= v(0, 71, 0); -} - /** * @param {number} reactNativeVersion * @param {JSONObject} options @@ -26,10 +19,6 @@ export function isNewArchEnabled(reactNativeVersion, options) { return true; } - if (!supportsNewArch(reactNativeVersion)) { - return false; - } - const newArchEnabled = process.env["RCT_NEW_ARCH_ENABLED"]; if (typeof newArchEnabled === "string") { return newArchEnabled !== "0"; @@ -69,29 +58,16 @@ export function isBridgelessEnabled(reactNativeVersion, options) { } /** - * @param {ApplePlatform} platform * @param {number} reactNativeVersion * @param {JSONObject} options * @returns {boolean | "from-source"} */ -export function isHermesEnabled(platform, reactNativeVersion, options) { +export function isHermesEnabled(reactNativeVersion, options) { if (reactNativeVersion < v(0, 80, 0)) { const useHermes = process.env["USE_HERMES"]; - const enabled = - typeof useHermes === "string" - ? useHermes === "1" - : options["hermesEnabled"] === true; - - // Hermes prebuilds for visionOS was introduced in 0.76 - if ( - enabled && - platform === "visionos" && - reactNativeVersion < v(0, 76, 0) - ) { - return "from-source"; - } - - return enabled; + return typeof useHermes === "string" + ? useHermes === "1" + : options["hermesEnabled"] === true; } return true; diff --git a/ios/infoPlist.mjs b/packages/app/ios/infoPlist.mjs similarity index 100% rename from ios/infoPlist.mjs rename to packages/app/ios/infoPlist.mjs diff --git a/ios/localizations.mjs b/packages/app/ios/localizations.mjs similarity index 100% rename from ios/localizations.mjs rename to packages/app/ios/localizations.mjs diff --git a/ios/pod_helpers.rb b/packages/app/ios/pod_helpers.rb similarity index 78% rename from ios/pod_helpers.rb rename to packages/app/ios/pod_helpers.rb index f4f72ff37..b481fb476 100644 --- a/ios/pod_helpers.rb +++ b/packages/app/ios/pod_helpers.rb @@ -33,17 +33,9 @@ def use_hermes?(options) use_hermes != false end -def use_new_architecture!(options, react_native_version) +def use_new_architecture!(options, _react_native_version) return unless options[:use_new_arch] - if react_native_version < v(0, 76, 0) - Pod::UI.warn( - 'As of writing, New Architecture (Fabric) is still experimental and ' \ - 'subject to change. For more information, please see ' \ - 'https://reactnative.dev/docs/next/new-architecture-intro.' - ) - end - options[:fabric_enabled] = true options[:new_arch_enabled] = true ENV['RCT_NEW_ARCH_ENABLED'] = '1' diff --git a/ios/privacyManifest.mjs b/packages/app/ios/privacyManifest.mjs similarity index 100% rename from ios/privacyManifest.mjs rename to packages/app/ios/privacyManifest.mjs diff --git a/ios/test_app.rb b/packages/app/ios/test_app.rb similarity index 91% rename from ios/test_app.rb rename to packages/app/ios/test_app.rb index a408beae7..85bd40a56 100644 --- a/ios/test_app.rb +++ b/packages/app/ios/test_app.rb @@ -28,13 +28,11 @@ def target_product_type(target) end def react_native_pods(version) - if version.zero? || version >= v(0, 71, 0) - 'use_react_native-0.71' - elsif version >= v(0, 70, 0) - 'use_react_native-0.70' - else + unless version.zero? || version >= v(0, 71, 0) raise "Unsupported React Native version: #{version}" end + + 'use_react_native-0.71' end def validate_resources(resources, app_dir) @@ -139,7 +137,6 @@ def make_project!(project_root, target_platform, options) :react_native_path => project['reactNativePath'], :react_native_version => project['reactNativeVersion'], :react_native_host_path => project['reactNativeHostPath'], - :community_autolinking_script_path => project['communityAutolinkingScriptPath'], :use_hermes => project['useHermes'], :use_new_arch => project['useNewArch'], :use_bridgeless => project['useBridgeless'], @@ -159,14 +156,7 @@ def use_test_app_internal!(target_platform, options) project_target = make_project!(project_root, target_platform, options) xcodeproj_dst, platforms = project_target.values_at(:xcodeproj_path, :platforms) - if project_target[:use_new_arch] || project_target[:react_native_version] >= v(0, 73, 0) - install! 'cocoapods', :deterministic_uuids => false - end - - # As of 0.75, we should use `use_native_modules!` from `react-native` instead - if project_target[:community_autolinking_script_path].is_a? String - require_relative(project_target[:community_autolinking_script_path]) - end + install! 'cocoapods', :deterministic_uuids => false if project_target[:use_new_arch] begin platform :ios, platforms[:ios] if target_platform == :ios @@ -212,11 +202,6 @@ def use_test_app_internal!(target_platform, options) case target.name when /\AReact/, 'RCT-Folly', 'SocketRocket', 'Yoga', 'fmt', 'glog', 'libevent' target.build_configurations.each do |config| - # TODO: Drop `_LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION` when - # we no longer support 0.72 - config.build_settings[GCC_PREPROCESSOR_DEFINITIONS] ||= ['$(inherited)'] - config.build_settings[GCC_PREPROCESSOR_DEFINITIONS] << - '_LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION=1' config.build_settings[WARNING_CFLAGS] ||= [] config.build_settings[WARNING_CFLAGS] << '-w' end diff --git a/ios/use_react_native-0.71.rb b/packages/app/ios/use_react_native-0.71.rb similarity index 100% rename from ios/use_react_native-0.71.rb rename to packages/app/ios/use_react_native-0.71.rb diff --git a/ios/utils.mjs b/packages/app/ios/utils.mjs similarity index 100% rename from ios/utils.mjs rename to packages/app/ios/utils.mjs diff --git a/ios/xcode.mjs b/packages/app/ios/xcode.mjs similarity index 91% rename from ios/xcode.mjs rename to packages/app/ios/xcode.mjs index 35c45cd29..1905057a4 100644 --- a/ios/xcode.mjs +++ b/packages/app/ios/xcode.mjs @@ -2,7 +2,7 @@ import { XMLBuilder, XMLParser } from "fast-xml-parser"; import * as nodefs from "node:fs"; import * as path from "node:path"; -import { findFile, readTextFile, v } from "../scripts/helpers.js"; +import { findFile, readTextFile } from "../scripts/helpers.js"; import { assertArray, assertObject, @@ -112,18 +112,6 @@ export function applyPreprocessorDefinitions({ preprocessors.push(`REACT_NATIVE_VERSION=${reactNativeVersion}`); - // In Xcode 15, `unary_function` and `binary_function` are no longer provided - // in C++17 and newer Standard modes. See Xcode release notes: - // https://developer.apple.com/documentation/xcode-release-notes/xcode-15-release-notes#Deprecations - // Upstream issue: https://github.com/facebook/react-native/issues/37748 - const enableCxx17RemovedUnaryBinaryFunction = - (reactNativeVersion >= v(0, 72, 0) && reactNativeVersion < v(0, 72, 5)) || - (reactNativeVersion >= v(0, 71, 0) && reactNativeVersion < v(0, 71, 4)) || - (reactNativeVersion > 0 && reactNativeVersion < v(0, 70, 14)); - if (enableCxx17RemovedUnaryBinaryFunction) { - preprocessors.push("_LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION=1"); - } - if (useNewArch) { preprocessors.push("FOLLY_NO_CONFIG=1"); preprocessors.push("RCT_NEW_ARCH_ENABLED=1"); diff --git a/macos/Localizations/en.lproj/Main.strings b/packages/app/macos/Localizations/en.lproj/Main.strings similarity index 100% rename from macos/Localizations/en.lproj/Main.strings rename to packages/app/macos/Localizations/en.lproj/Main.strings diff --git a/macos/ReactTestApp.xcodeproj/project.pbxproj b/packages/app/macos/ReactTestApp.xcodeproj/project.pbxproj similarity index 100% rename from macos/ReactTestApp.xcodeproj/project.pbxproj rename to packages/app/macos/ReactTestApp.xcodeproj/project.pbxproj diff --git a/macos/ReactTestApp.xcodeproj/xcshareddata/xcschemes/ReactTestApp.xcscheme b/packages/app/macos/ReactTestApp.xcodeproj/xcshareddata/xcschemes/ReactTestApp.xcscheme similarity index 100% rename from macos/ReactTestApp.xcodeproj/xcshareddata/xcschemes/ReactTestApp.xcscheme rename to packages/app/macos/ReactTestApp.xcodeproj/xcshareddata/xcschemes/ReactTestApp.xcscheme diff --git a/macos/ReactTestApp/AppDelegate.swift b/packages/app/macos/ReactTestApp/AppDelegate.swift similarity index 100% rename from macos/ReactTestApp/AppDelegate.swift rename to packages/app/macos/ReactTestApp/AppDelegate.swift diff --git a/macos/ReactTestApp/Assets.xcassets/AppIcon.appiconset/Contents.json b/packages/app/macos/ReactTestApp/Assets.xcassets/AppIcon.appiconset/Contents.json similarity index 100% rename from macos/ReactTestApp/Assets.xcassets/AppIcon.appiconset/Contents.json rename to packages/app/macos/ReactTestApp/Assets.xcassets/AppIcon.appiconset/Contents.json diff --git a/macos/ReactTestApp/Assets.xcassets/Contents.json b/packages/app/macos/ReactTestApp/Assets.xcassets/Contents.json similarity index 100% rename from macos/ReactTestApp/Assets.xcassets/Contents.json rename to packages/app/macos/ReactTestApp/Assets.xcassets/Contents.json diff --git a/macos/ReactTestApp/Base.lproj/Main.storyboard b/packages/app/macos/ReactTestApp/Base.lproj/Main.storyboard similarity index 100% rename from macos/ReactTestApp/Base.lproj/Main.storyboard rename to packages/app/macos/ReactTestApp/Base.lproj/Main.storyboard diff --git a/macos/ReactTestApp/Info.plist b/packages/app/macos/ReactTestApp/Info.plist similarity index 100% rename from macos/ReactTestApp/Info.plist rename to packages/app/macos/ReactTestApp/Info.plist diff --git a/macos/ReactTestApp/ReactTestApp.common.xcconfig b/packages/app/macos/ReactTestApp/ReactTestApp.common.xcconfig similarity index 100% rename from macos/ReactTestApp/ReactTestApp.common.xcconfig rename to packages/app/macos/ReactTestApp/ReactTestApp.common.xcconfig diff --git a/macos/ReactTestApp/ReactTestApp.debug.xcconfig b/packages/app/macos/ReactTestApp/ReactTestApp.debug.xcconfig similarity index 100% rename from macos/ReactTestApp/ReactTestApp.debug.xcconfig rename to packages/app/macos/ReactTestApp/ReactTestApp.debug.xcconfig diff --git a/macos/ReactTestApp/ReactTestApp.release.xcconfig b/packages/app/macos/ReactTestApp/ReactTestApp.release.xcconfig similarity index 100% rename from macos/ReactTestApp/ReactTestApp.release.xcconfig rename to packages/app/macos/ReactTestApp/ReactTestApp.release.xcconfig diff --git a/macos/ReactTestApp/ViewController.swift b/packages/app/macos/ReactTestApp/ViewController.swift similarity index 100% rename from macos/ReactTestApp/ViewController.swift rename to packages/app/macos/ReactTestApp/ViewController.swift diff --git a/macos/ReactTestAppTests/Info.plist b/packages/app/macos/ReactTestAppTests/Info.plist similarity index 100% rename from macos/ReactTestAppTests/Info.plist rename to packages/app/macos/ReactTestAppTests/Info.plist diff --git a/macos/ReactTestAppTests/ReactTestAppTests.swift b/packages/app/macos/ReactTestAppTests/ReactTestAppTests.swift similarity index 100% rename from macos/ReactTestAppTests/ReactTestAppTests.swift rename to packages/app/macos/ReactTestAppTests/ReactTestAppTests.swift diff --git a/macos/ReactTestAppUITests/Info.plist b/packages/app/macos/ReactTestAppUITests/Info.plist similarity index 100% rename from macos/ReactTestAppUITests/Info.plist rename to packages/app/macos/ReactTestAppUITests/Info.plist diff --git a/macos/ReactTestAppUITests/ReactTestAppUITests.swift b/packages/app/macos/ReactTestAppUITests/ReactTestAppUITests.swift similarity index 100% rename from macos/ReactTestAppUITests/ReactTestAppUITests.swift rename to packages/app/macos/ReactTestAppUITests/ReactTestAppUITests.swift diff --git a/macos/Shared b/packages/app/macos/Shared similarity index 100% rename from macos/Shared rename to packages/app/macos/Shared diff --git a/macos/test_app.rb b/packages/app/macos/test_app.rb similarity index 100% rename from macos/test_app.rb rename to packages/app/macos/test_app.rb diff --git a/packages/app/package.json b/packages/app/package.json new file mode 100644 index 000000000..4eb6f9649 --- /dev/null +++ b/packages/app/package.json @@ -0,0 +1,164 @@ +{ + "name": "react-native-test-app", + "version": "0.0.1-dev", + "description": "react-native-test-app provides a test app for all supported platforms as a package", + "keywords": [ + "android", + "app", + "ios", + "macos", + "react", + "react-native", + "test", + "test-app", + "testing", + "windows" + ], + "homepage": "https://github.com/microsoft/react-native-test-app", + "license": "MIT", + "author": { + "name": "Microsoft Open Source", + "email": "microsoftopensource@users.noreply.github.com" + }, + "files": [ + "*.md", + "ReactTestApp-DevSupport.podspec", + "android/**/*.gradle", + "android/android-manifest.js", + "android/app/lint.xml", + "android/app/src", + "!android/app/src/test", + "android/autolink.mjs", + "android/gradle-wrapper.js", + "android/support/src", + "common", + "example/_gitignore", + "example/android/gradle", + "example/android/gradle.properties", + "example/android/gradlew*", + "example/windows/_gitignore", + "example/{metro,react-native}.config.js", + "ios", + "macos", + "plugins", + "react-native.config.js", + "schema.json", + "scripts/*.js", + "scripts/*.mjs", + "scripts/config-plugins", + "scripts/embed-manifest", + "scripts/utils", + "test-app.gradle", + "test_app.rb", + "visionos", + "windows", + "!.clang-format" + ], + "main": "scripts/configure-projects.js", + "bin": { + "init": "scripts/init.mjs", + "init-test-app": "scripts/init.mjs", + "configure-test-app": "scripts/configure.mjs", + "install-windows-test-app": "windows/app.mjs" + }, + "repository": { + "type": "git", + "url": "https://github.com/microsoft/react-native-test-app.git", + "directory": "packages/app" + }, + "scripts": { + "format:c": "clang-format -i $(git ls-files '*.cpp' '*.h' '*.m' '*.mm')", + "format:js": "prettier --write --log-level error $(git ls-files '*.[cm][jt]s' '*.[jt]s' '*.tsx' '*.yml' 'README.md' 'test/**/*.json')", + "format:swift": "swiftformat $(git ls-files '*.swift')", + "generate:code": "node scripts/internal/generate-manifest.mts", + "generate:docs": "node scripts/internal/generate-manifest-docs.mts", + "generate:schema": "node scripts/internal/generate-schema.mts", + "lint:js": "eslint $(git ls-files '*.[cm][jt]s' '*.[jt]s' '*.tsx' ':!:*.config.js' ':!:.yarn/releases') && tsc && tsc --project tsconfig.cjs.json", + "lint:kt": "ktlint --relative 'android/app/src/**/*.kt'", + "lint:rb": "bundle exec rubocop", + "lint:swift": "swiftlint", + "prepack": "node scripts/internal/pack.mts pre", + "postpack": "node scripts/internal/pack.mts post", + "release-notes": "node scripts/internal/release-notes.mts", + "set-react-version": "node scripts/internal/set-react-version.mts", + "test": "node scripts/internal/test.mts", + "test:js": "node --test $(git ls-files '*.test.ts')", + "test:matrix": "node scripts/testing/test-matrix.mts", + "test:rb": "bundle exec ruby -Ilib:test -e \"Dir.glob('./test/test_*.rb').each { |file| require(file) }\"" + }, + "dependencies": { + "@rnx-kit/react-native-host": "^0.5.11", + "@rnx-kit/tools-react-native": "^2.1.0", + "ajv": "^8.0.0", + "cliui": "^8.0.0", + "fast-xml-parser": "^4.0.0", + "prompts": "^2.4.0", + "semver": "^7.3.5", + "uuid": "^11.0.0" + }, + "peerDependencies": { + "@callstack/react-native-visionos": "0.76 - 0.79", + "@expo/config-plugins": ">=5.0", + "react": "18.2 - 19.1", + "react-native": "0.76 - 0.82 || >=0.83.0-0 <0.83.0", + "react-native-macos": "^0.0.0-0 || 0.76 - 0.79", + "react-native-windows": "^0.0.0-0 || 0.76 - 0.79" + }, + "peerDependenciesMeta": { + "@callstack/react-native-visionos": { + "optional": true + }, + "@expo/config-plugins": { + "optional": true + }, + "react-native-macos": { + "optional": true + }, + "react-native-windows": { + "optional": true + } + }, + "devDependencies": { + "@babel/core": "^7.20.0", + "@babel/preset-env": "^7.20.0", + "@expo/config-plugins": "^10.0.0", + "@expo/json-file": "~9.1.5", + "@microsoft/eslint-plugin-sdl": "^1.0.0", + "@react-native-community/cli": "^15.0.1", + "@react-native-community/cli-types": "^15.0.1", + "@react-native-community/template": "^0.78.0", + "@rnx-kit/eslint-plugin": "^0.8.0", + "@rnx-kit/tsconfig": "^2.0.0", + "@swc-node/register": "^1.10.0", + "@swc/core": "^1.11.0", + "@types/js-yaml": "^4.0.5", + "@types/mustache": "^4.0.0", + "@types/node": "^22.0.0", + "@types/prompts": "~2.4.0", + "@types/semver": "^7.3.6", + "@wdio/types": "^9.16.0", + "eslint": "^9.12.0", + "eslint-plugin-wdio": "^9.0.0", + "js-yaml": "^4.1.0", + "memfs": "^4.0.0", + "prettier": "^3.0.0", + "prettier-plugin-organize-imports": "^4.1.0", + "react": "19.0.0", + "react-native": "^0.78.0", + "react-native-macos": "^0.78.0", + "react-native-windows": "^0.78.0", + "suggestion-bot": "^4.0.0", + "typescript": "^5.0.0" + }, + "engines": { + "node": ">=18.12" + }, + "defaultPlatformPackages": { + "android": "react-native", + "ios": "react-native", + "macos": "react-native-macos", + "visionos": "@callstack/react-native-visionos", + "windows": "react-native-windows" + }, + "prettier": "../../.github/prettierrc.json" +} diff --git a/plugins/index.js b/packages/app/plugins/index.js similarity index 100% rename from plugins/index.js rename to packages/app/plugins/index.js diff --git a/plugins/macos.js b/packages/app/plugins/macos.js similarity index 100% rename from plugins/macos.js rename to packages/app/plugins/macos.js diff --git a/plugins/reanimated.js b/packages/app/plugins/reanimated.js similarity index 60% rename from plugins/reanimated.js rename to packages/app/plugins/reanimated.js index 20743c8b4..4f5d0706b 100644 --- a/plugins/reanimated.js +++ b/packages/app/plugins/reanimated.js @@ -39,46 +39,15 @@ function installerFor(version, indent = " ") { const minor = v(0, 1, 0); const minorVersion = Math.trunc(version / minor) % minor; - if (version > 0 && version < v(0, 72, 0)) { - const header = [ - "#if !USE_FABRIC", - "#pragma clang diagnostic push", - '#pragma clang diagnostic ignored "-Wnullability-completeness"', - "", - `#define REACT_NATIVE_MINOR_VERSION ${minorVersion}`, - "#import ", - "", - "#if __has_include()", - "#import ", - "using ExecutorFactory = facebook::react::HermesExecutorFactory;", - "#elif __has_include()", - "#import ", - "using ExecutorFactory = facebook::react::HermesExecutorFactory;", - "#else", - "#import ", - "using ExecutorFactory = facebook::react::JSCExecutorFactory;", - "#endif", - "", - "#pragma clang diagnostic pop", - "#endif // !USE_FABRIC", - ].join("\n"); - const installer = [ - `${indent}const auto installer = reanimated::REAJSIExecutorRuntimeInstaller(bridge, nullptr);`, - `${indent}auto installBindings = facebook::react::RCTJSIExecutorRuntimeInstaller(installer);`, - `${indent}return std::make_unique(installBindings);`, - ].join("\n"); - return [header, installer]; - } else { - // As of React Native 0.72, we need to call `REAInitializer` instead. See - // https://github.com/software-mansion/react-native-reanimated/commit/a8206f383e51251e144cb9fd5293e15d06896df0. - const header = [ - "#if !USE_FABRIC", - `#define REACT_NATIVE_MINOR_VERSION ${minorVersion}`, - "#import ", - "#endif // !USE_FABRIC", - ].join("\n"); - return [header, `${indent}reanimated::REAInitializer(bridge);`]; - } + // As of React Native 0.72, we need to call `REAInitializer` instead. See + // https://github.com/software-mansion/react-native-reanimated/commit/a8206f383e51251e144cb9fd5293e15d06896df0. + const header = [ + "#if !USE_FABRIC", + `#define REACT_NATIVE_MINOR_VERSION ${minorVersion}`, + "#import ", + "#endif // !USE_FABRIC", + ].join("\n"); + return [header, `${indent}reanimated::REAInitializer(bridge);`]; } /** diff --git a/react-native.config.js b/packages/app/react-native.config.js similarity index 100% rename from react-native.config.js rename to packages/app/react-native.config.js diff --git a/schema.json b/packages/app/schema.json similarity index 100% rename from schema.json rename to packages/app/schema.json diff --git a/scripts/appConfig.mjs b/packages/app/scripts/appConfig.mjs similarity index 100% rename from scripts/appConfig.mjs rename to packages/app/scripts/appConfig.mjs diff --git a/scripts/apply-config-plugins.mjs b/packages/app/scripts/apply-config-plugins.mjs similarity index 100% rename from scripts/apply-config-plugins.mjs rename to packages/app/scripts/apply-config-plugins.mjs diff --git a/scripts/build/MSBuild.ps1 b/packages/app/scripts/build/MSBuild.ps1 similarity index 100% rename from scripts/build/MSBuild.ps1 rename to packages/app/scripts/build/MSBuild.ps1 diff --git a/scripts/build/VSTest.ps1 b/packages/app/scripts/build/VSTest.ps1 similarity index 100% rename from scripts/build/VSTest.ps1 rename to packages/app/scripts/build/VSTest.ps1 diff --git a/scripts/config-plugins/ExpoConfigPlugins.mjs b/packages/app/scripts/config-plugins/ExpoConfigPlugins.mjs similarity index 100% rename from scripts/config-plugins/ExpoConfigPlugins.mjs rename to packages/app/scripts/config-plugins/ExpoConfigPlugins.mjs diff --git a/scripts/config-plugins/apply.mjs b/packages/app/scripts/config-plugins/apply.mjs similarity index 100% rename from scripts/config-plugins/apply.mjs rename to packages/app/scripts/config-plugins/apply.mjs diff --git a/scripts/config-plugins/index.mjs b/packages/app/scripts/config-plugins/index.mjs similarity index 100% rename from scripts/config-plugins/index.mjs rename to packages/app/scripts/config-plugins/index.mjs diff --git a/scripts/config-plugins/plugins/cocoaBaseMods.mjs b/packages/app/scripts/config-plugins/plugins/cocoaBaseMods.mjs similarity index 100% rename from scripts/config-plugins/plugins/cocoaBaseMods.mjs rename to packages/app/scripts/config-plugins/plugins/cocoaBaseMods.mjs diff --git a/scripts/config-plugins/plugins/mod-compiler.mjs b/packages/app/scripts/config-plugins/plugins/mod-compiler.mjs similarity index 100% rename from scripts/config-plugins/plugins/mod-compiler.mjs rename to packages/app/scripts/config-plugins/plugins/mod-compiler.mjs diff --git a/scripts/config-plugins/plugins/withAndroidBaseMods.mjs b/packages/app/scripts/config-plugins/plugins/withAndroidBaseMods.mjs similarity index 100% rename from scripts/config-plugins/plugins/withAndroidBaseMods.mjs rename to packages/app/scripts/config-plugins/plugins/withAndroidBaseMods.mjs diff --git a/scripts/config-plugins/plugins/withInternal.mjs b/packages/app/scripts/config-plugins/plugins/withInternal.mjs similarity index 100% rename from scripts/config-plugins/plugins/withInternal.mjs rename to packages/app/scripts/config-plugins/plugins/withInternal.mjs diff --git a/scripts/config-plugins/plugins/withIosBaseMods.mjs b/packages/app/scripts/config-plugins/plugins/withIosBaseMods.mjs similarity index 100% rename from scripts/config-plugins/plugins/withIosBaseMods.mjs rename to packages/app/scripts/config-plugins/plugins/withIosBaseMods.mjs diff --git a/scripts/config-plugins/plugins/withMacOsBaseMods.mjs b/packages/app/scripts/config-plugins/plugins/withMacOsBaseMods.mjs similarity index 100% rename from scripts/config-plugins/plugins/withMacOsBaseMods.mjs rename to packages/app/scripts/config-plugins/plugins/withMacOsBaseMods.mjs diff --git a/scripts/config-plugins/provider.mjs b/packages/app/scripts/config-plugins/provider.mjs similarity index 100% rename from scripts/config-plugins/provider.mjs rename to packages/app/scripts/config-plugins/provider.mjs diff --git a/scripts/config-plugins/types.ts b/packages/app/scripts/config-plugins/types.ts similarity index 100% rename from scripts/config-plugins/types.ts rename to packages/app/scripts/config-plugins/types.ts diff --git a/scripts/configure-projects.js b/packages/app/scripts/configure-projects.js similarity index 72% rename from scripts/configure-projects.js rename to packages/app/scripts/configure-projects.js index ed30505b8..26d2cc2d6 100644 --- a/scripts/configure-projects.js +++ b/packages/app/scripts/configure-projects.js @@ -11,14 +11,7 @@ const nodefs = require("node:fs"); const path = require("node:path"); const { generateAndroidManifest } = require("../android/android-manifest"); const { configureGradleWrapper } = require("../android/gradle-wrapper"); -const { - findFile, - findNearest, - getPackageVersion, - readTextFile, - toVersionNumber, - v, -} = require("./helpers"); +const { findFile, findNearest, readTextFile } = require("./helpers"); /** * Finds `react-native.config.[ts,mjs,cjs,js]`. @@ -76,52 +69,10 @@ function findReactNativeConfig(fs = nodefs) { throw new Error("Failed to find `react-native.config.[ts,mjs,cjs,js]`"); } -/** - * Returns the version number of a React Native dependency. - * @param {string} packageName - * @returns {number} - */ -const getRNPackageVersion = (() => { - const isTesting = "NODE_TEST_CONTEXT" in process.env; - - /** @type {Record} */ - let versions = {}; - - /** @type {(packageName: string) => number} */ - return (packageName, fs = nodefs) => { - if (isTesting || !versions[packageName]) { - const rnDir = path.dirname(require.resolve("react-native/package.json")); - const versionString = getPackageVersion(packageName, rnDir, fs); - versions[packageName] = toVersionNumber(versionString); - } - return versions[packageName]; - }; -})(); - /** * @returns {string | undefined} */ -function getAndroidPackageName(fs = nodefs) { - try { - const rncliAndroidVersion = getRNPackageVersion( - "@react-native-community/cli-platform-android", - fs - ); - if (rncliAndroidVersion < v(12, 3, 7)) { - // TODO: This block can be removed when we drop support for 0.72 - return undefined; - } - if ( - rncliAndroidVersion >= v(13, 0, 0) && - rncliAndroidVersion < v(13, 6, 9) - ) { - // TODO: This block can be removed when we drop support for 0.73 - return undefined; - } - } catch (_) { - // We're on 0.76 or later - } - +function getAndroidPackageName() { return "com.microsoft.reacttestapp"; } @@ -171,7 +122,7 @@ function configureProjects({ android, ios, windows }, fs = nodefs) { config.android = { sourceDir, manifestPath, - packageName: packageName || getAndroidPackageName(fs), + packageName: packageName || getAndroidPackageName(), }; configureGradleWrapper(sourceDir, fs); diff --git a/scripts/configure.mjs b/packages/app/scripts/configure.mjs similarity index 89% rename from scripts/configure.mjs rename to packages/app/scripts/configure.mjs index 33d1ff12b..aad5cb943 100755 --- a/scripts/configure.mjs +++ b/packages/app/scripts/configure.mjs @@ -24,7 +24,6 @@ import { readJSONFile, readTextFile, toVersionNumber, - v, } from "./helpers.js"; import { appManifest, @@ -77,11 +76,6 @@ export function error(message) { * @returns {Promise} */ async function findTemplateDir(targetVersion) { - if (toVersionNumber(targetVersion) < v(0, 75, 0)) { - // Let `getConfig` try to find the template inside `react-native` - return undefined; - } - const [major, minor = 0] = targetVersion.split("."); const output = await downloadPackage( "@react-native-community/template", @@ -296,17 +290,8 @@ export const getConfig = (() => { ...(!init ? undefined : { - // TODO: We will no longer need to consider `App.js` when we - // drop support for 0.70 - ...(fs.existsSync(path.join(templateDir, "App.tsx")) - ? { - "App.tsx": copyFrom(templateDir, "App.tsx"), - "tsconfig.json": copyFrom(templateDir, "tsconfig.json"), - } - : { - "App.js": copyFrom(templateDir, "App.js"), - }), ".bundle/config": bundleConfig(), + "App.tsx": copyFrom(templateDir, "App.tsx"), Gemfile: copyFrom(templateDir, "Gemfile"), "app.json": appManifest(name), "index.js": copyFrom(templateDir, "index.js"), @@ -314,13 +299,11 @@ export const getConfig = (() => { path.join(templateDir, "package.json"), fs ).replaceAll("HelloWorld", name), + "tsconfig.json": copyFrom(templateDir, "tsconfig.json"), }), }, oldFiles: [], scripts: { - // TODO: Remove this script when we drop support for 0.72 - // https://github.com/react-native-community/cli/commit/48d4c29bba4e8b16cbc8307bd1b4c5349f3651d8 - mkdist: `node -e "require('node:fs').mkdirSync('dist', { recursive: true, mode: 0o755 })"`, start: "react-native start", }, dependencies: {}, @@ -336,24 +319,14 @@ export const getConfig = (() => { "wrapper", "gradle-wrapper.jar" ), - "gradle/wrapper/gradle-wrapper.properties": (() => { - const gradleWrapperProperties = path.join( - testAppPath, - "example", - "android", - "gradle", - "wrapper", - "gradle-wrapper.properties" - ); - const props = readTextFile(gradleWrapperProperties); - if (targetVersionNum < v(0, 73, 0)) { - return props.replace( - /gradle-[.0-9]*-bin\.zip/, - "gradle-7.6.4-bin.zip" - ); - } - return props; - })(), + "gradle/wrapper/gradle-wrapper.properties": copyFrom( + testAppPath, + "example", + "android", + "gradle", + "wrapper", + "gradle-wrapper.properties" + ), "gradle.properties": gradleProperties(targetVersionNum), gradlew: copyFrom(testAppPath, "example", "android", "gradlew"), "gradlew.bat": copyFrom( @@ -368,7 +341,7 @@ export const getConfig = (() => { scripts: { android: "react-native run-android", "build:android": - "npm run mkdist && react-native bundle --entry-file index.js --platform android --dev true --bundle-output dist/main.android.jsbundle --assets-dest dist/res", + "react-native bundle --entry-file index.js --platform android --dev true --bundle-output dist/main.android.jsbundle --assets-dest dist/res", }, dependencies: {}, }, @@ -384,7 +357,7 @@ export const getConfig = (() => { ], scripts: { "build:ios": - "npm run mkdist && react-native bundle --entry-file index.js --platform ios --dev true --bundle-output dist/main.ios.jsbundle --assets-dest dist", + "react-native bundle --entry-file index.js --platform ios --dev true --bundle-output dist/main.ios.jsbundle --assets-dest dist", ios: "react-native run-ios", }, dependencies: {}, @@ -401,7 +374,7 @@ export const getConfig = (() => { ], scripts: { "build:macos": - "npm run mkdist && react-native bundle --entry-file index.js --platform macos --dev true --bundle-output dist/main.macos.jsbundle --assets-dest dist", + "react-native bundle --entry-file index.js --platform macos --dev true --bundle-output dist/main.macos.jsbundle --assets-dest dist", macos: `react-native run-macos --scheme ${name}`, }, dependencies: {}, @@ -418,7 +391,7 @@ export const getConfig = (() => { ], scripts: { "build:visionos": - "npm run mkdist && react-native bundle --entry-file index.js --platform ios --dev true --bundle-output dist/main.visionos.jsbundle --assets-dest dist", + "react-native bundle --entry-file index.js --platform ios --dev true --bundle-output dist/main.visionos.jsbundle --assets-dest dist", visionos: "react-native run-visionos", }, dependencies: {}, @@ -439,7 +412,7 @@ export const getConfig = (() => { ], scripts: { "build:windows": - "npm run mkdist && react-native bundle --entry-file index.js --platform windows --dev true --bundle-output dist/main.windows.bundle --assets-dest dist", + "react-native bundle --entry-file index.js --platform windows --dev true --bundle-output dist/main.windows.bundle --assets-dest dist", windows: "react-native run-windows", }, dependencies: {}, diff --git a/scripts/embed-manifest/cpp.mjs b/packages/app/scripts/embed-manifest/cpp.mjs similarity index 100% rename from scripts/embed-manifest/cpp.mjs rename to packages/app/scripts/embed-manifest/cpp.mjs diff --git a/scripts/embed-manifest/kotlin.mjs b/packages/app/scripts/embed-manifest/kotlin.mjs similarity index 100% rename from scripts/embed-manifest/kotlin.mjs rename to packages/app/scripts/embed-manifest/kotlin.mjs diff --git a/scripts/embed-manifest/main.mjs b/packages/app/scripts/embed-manifest/main.mjs similarity index 100% rename from scripts/embed-manifest/main.mjs rename to packages/app/scripts/embed-manifest/main.mjs diff --git a/scripts/embed-manifest/swift.mjs b/packages/app/scripts/embed-manifest/swift.mjs similarity index 100% rename from scripts/embed-manifest/swift.mjs rename to packages/app/scripts/embed-manifest/swift.mjs diff --git a/scripts/embed-manifest/validate.mjs b/packages/app/scripts/embed-manifest/validate.mjs similarity index 100% rename from scripts/embed-manifest/validate.mjs rename to packages/app/scripts/embed-manifest/validate.mjs diff --git a/scripts/eslint/no-process-exit.js b/packages/app/scripts/eslint/no-process-exit.js similarity index 100% rename from scripts/eslint/no-process-exit.js rename to packages/app/scripts/eslint/no-process-exit.js diff --git a/scripts/eslint/plugin.js b/packages/app/scripts/eslint/plugin.js similarity index 100% rename from scripts/eslint/plugin.js rename to packages/app/scripts/eslint/plugin.js diff --git a/scripts/helpers.js b/packages/app/scripts/helpers.js similarity index 100% rename from scripts/helpers.js rename to packages/app/scripts/helpers.js diff --git a/scripts/init.mjs b/packages/app/scripts/init.mjs similarity index 93% rename from scripts/init.mjs rename to packages/app/scripts/init.mjs index 633827e24..68419cc81 100755 --- a/scripts/init.mjs +++ b/packages/app/scripts/init.mjs @@ -9,7 +9,7 @@ import { getDefaultPlatformPackageName, validatePlatforms, } from "./configure.mjs"; -import { memo, readJSONFile, toVersionNumber, v } from "./helpers.js"; +import { memo, readJSONFile } from "./helpers.js"; import * as colors from "./utils/colors.mjs"; import { downloadPackage, fetchPackageMetadata } from "./utils/npm.mjs"; import { parseArgs } from "./utils/parseargs.mjs"; @@ -49,7 +49,7 @@ const getInstalledVersion = memo(() => { * * Checks the following in order: * - * - Command line flag, e.g. `--version 0.70` + * - Command line flag, e.g. `--version 0.81` * - Currently installed `react-native` version * - Latest version from npm * @@ -116,18 +116,10 @@ async function getVersion(platforms) { */ async function fetchTemplate(platforms) { const version = await getVersion(platforms); - const useTemplatePackage = toVersionNumber(version) >= v(0, 75, 0); - if (!useTemplatePackage && getInstalledVersion() === version) { - const rnManifest = getInstalledReactNativeManifest(); - if (rnManifest) { - return [version, path.join(path.dirname(rnManifest), "template")]; - } - } - - const template = useTemplatePackage - ? "@react-native-community/template" - : "react-native"; - const output = await downloadPackage(template, version); + const output = await downloadPackage( + "@react-native-community/template", + version + ); return [version, path.join(output, "template")]; } diff --git a/scripts/internal/generate-manifest-docs.mts b/packages/app/scripts/internal/generate-manifest-docs.mts similarity index 100% rename from scripts/internal/generate-manifest-docs.mts rename to packages/app/scripts/internal/generate-manifest-docs.mts diff --git a/scripts/internal/generate-manifest.mts b/packages/app/scripts/internal/generate-manifest.mts similarity index 100% rename from scripts/internal/generate-manifest.mts rename to packages/app/scripts/internal/generate-manifest.mts diff --git a/scripts/internal/generate-schema.mts b/packages/app/scripts/internal/generate-schema.mts similarity index 96% rename from scripts/internal/generate-schema.mts rename to packages/app/scripts/internal/generate-schema.mts index 2db6e377d..abb1c9367 100644 --- a/scripts/internal/generate-schema.mts +++ b/packages/app/scripts/internal/generate-schema.mts @@ -29,7 +29,7 @@ export function assertDefinition(props: unknown): asserts props is Definition { export async function readDocumentation(): Promise> { const docs: Partial = {}; - const docsDir = fileURLToPath(new URL("../../docs", import.meta.url)); + const docsDir = fileURLToPath(new URL("../../../../docs", import.meta.url)); const keys: (keyof Docs)[] = [ "introduction", diff --git a/scripts/internal/pack.mts b/packages/app/scripts/internal/pack.mts similarity index 100% rename from scripts/internal/pack.mts rename to packages/app/scripts/internal/pack.mts diff --git a/scripts/internal/prepare-viewfinder.mts b/packages/app/scripts/internal/prepare-viewfinder.mts similarity index 100% rename from scripts/internal/prepare-viewfinder.mts rename to packages/app/scripts/internal/prepare-viewfinder.mts diff --git a/scripts/internal/release-notes.mts b/packages/app/scripts/internal/release-notes.mts similarity index 100% rename from scripts/internal/release-notes.mts rename to packages/app/scripts/internal/release-notes.mts diff --git a/scripts/internal/set-react-version.mts b/packages/app/scripts/internal/set-react-version.mts similarity index 70% rename from scripts/internal/set-react-version.mts rename to packages/app/scripts/internal/set-react-version.mts index 04dac6570..1100dc67c 100644 --- a/scripts/internal/set-react-version.mts +++ b/packages/app/scripts/internal/set-react-version.mts @@ -5,13 +5,7 @@ import * as fs from "node:fs"; import * as path from "node:path"; import * as util from "node:util"; -import { - isMain, - readJSONFile, - readTextFile, - toVersionNumber, - v, -} from "../helpers.js"; +import { isMain, readJSONFile } from "../helpers.js"; import type { Manifest } from "../types.js"; import { writeJSONFile } from "../utils/filesystem.mjs"; import { fetchPackageMetadata, npmRegistryBaseURL } from "../utils/npm.mjs"; @@ -32,41 +26,6 @@ function keys>(obj: T): (keyof T)[] { return Object.keys(obj) as (keyof T)[]; } -function searchReplaceInFile( - filename: string, - searchValue: string | RegExp, - replaceValue: string -): void { - const current = readTextFile(filename); - const updated = current.replace(searchValue, replaceValue); - if (updated !== current) { - fs.writeFileSync(filename, updated); - } -} - -/** - * Disables [Jetifier](https://developer.android.com/tools/jetifier). - * - * Jetifier is only necessary when you depend on code that has not yet migrated - * to AndroidX. If we only deal with modern code, disabling it makes builds - * slightly faster. - */ -function disableJetifier() { - return searchReplaceInFile( - "example/android/gradle.properties", - "android.enableJetifier=true", - "android.enableJetifier=false" - ); -} - -function disableWebStorage() { - return searchReplaceInFile( - "example/package.json", - /\s+"@react-native-webapis\/web-storage":.*/, - "" - ); -} - /** * Infer the React Native version an out-of-tree platform package is based on. */ @@ -122,6 +81,22 @@ function fetchPackageInfo(pkg: string, version: string): Promise { }); } +/** + * Fetches the template manifest for the specified React Native version. + */ +function fetchTemplateManifest(version: string): Promise { + const url = `https://raw.githubusercontent.com/react-native-community/template/refs/heads/${version}-stable/template/package.json`; + console.log(`Fetching template manifest from ${url}`); + return fetch(url, { + headers: { + Accept: + "application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*", + }, + }) + .then((res) => res.text()) + .then((text) => JSON.parse(text)); +} + /** * Fetches the latest react-native-windows@canary information via NuGet. */ @@ -175,61 +150,35 @@ function fetchReactNativeWindowsCanaryInfoViaNuGet(): Promise { */ async function resolveCommonDependencies( v: string, - { dependencies = {}, peerDependencies = {} }: Manifest + { peerDependencies = {} }: Manifest ): Promise> { - const [rnBabelPresetVersion, rnMetroConfigVersion, metroBabelPresetVersion] = + const [devDependencies, rnBabelPresetVersion, rnMetroConfigVersion] = await (async () => { if (["^", "canary", "nightly"].some((tag) => v.includes(tag))) { - return [v, v, undefined]; + return [{}, v, v]; } const [ + { devDependencies }, { version: rnBabelPresetVersion }, { version: rnMetroConfigVersion }, - { version: metroBabelPresetVersion }, ] = await Promise.all([ + fetchTemplateManifest(v), fetchPackageInfo("@react-native/babel-preset", v), fetchPackageInfo("@react-native/metro-config", v), - (async () => { - // Metro bumps and publishes all packages together, meaning we can use - // `metro-react-native-babel-transformer` to determine the version of - // `metro-react-native-babel-preset` that should be used. - const version = dependencies["metro-react-native-babel-transformer"]; - if (version) { - return { version }; - } - - // `metro-react-native-babel-transformer` is no longer a direct - // dependency of `react-native`. As of 0.72, we should go through - // `@react-native-community/cli-plugin-metro` instead. - const cliVersion = dependencies["@react-native-community/cli"]; - if (!cliVersion) { - // `@react-native-community/cli` is no longer a direct dependency in - // 0.73. We should be using `@react-native/babel-preset` instead. - return {}; - } - - const metroPluginInfo = await fetchPackageInfo( - "@react-native-community/cli-plugin-metro", - cliVersion.replace("^", "").split(".").slice(0, 2).join(".") - ); - return { version: metroPluginInfo.dependencies?.["metro"] }; - })(), ]); return [ + devDependencies ?? {}, rnBabelPresetVersion, rnMetroConfigVersion, - metroBabelPresetVersion, ]; })(); - // Starting with 0.76, `react-native` no longer depends on - // `@react-native-community/cli` - const rncli = dependencies["@react-native-community/cli"] ?? "latest"; + const rncli = devDependencies["@react-native-community/cli"] ?? "latest"; const rncliAndroid = - dependencies["@react-native-community/cli-platform-android"] ?? rncli; + devDependencies["@react-native-community/cli-platform-android"] ?? rncli; const rncliIOS = - dependencies["@react-native-community/cli-platform-ios"] ?? rncli; + devDependencies["@react-native-community/cli-platform-ios"] ?? rncli; return { "@react-native-community/cli": rncli, @@ -237,7 +186,6 @@ async function resolveCommonDependencies( "@react-native-community/cli-platform-ios": rncliIOS, "@react-native/babel-preset": rnBabelPresetVersion, "@react-native/metro-config": rnMetroConfigVersion, - "metro-react-native-babel-preset": metroBabelPresetVersion, // Replace range to avoid React version mismatch react: peerDependencies["react"].replace(/^\^/, ""), }; @@ -335,29 +283,37 @@ export async function setReactVersion( const profile = { ...(await getProfile(version, coreOnly)), ...overrides }; console.dir(profile, { depth: null }); - const manifests = ["package.json", "example/package.json"]; + const manifests = [ + "package.json", + "example/package.json", + "../../package.json", + ]; for (const manifestPath of manifests) { const manifest = readJSONFile(manifestPath); - const { dependencies, devDependencies, resolutions = {} } = manifest; + const { dependencies, devDependencies, resolutions } = manifest; if (!devDependencies) { throw new Error("Expected 'devDependencies' to be declared"); } - for (const packageName of keys(profile)) { - const deps = dependencies?.[packageName] - ? dependencies - : devDependencies; - deps[packageName] = profile[packageName]; - + if (resolutions) { // Reset resolutions so we don't get old packages - resolutions[packageName] = undefined; - } + for (const packageName of keys(profile)) { + resolutions[packageName] = undefined; + } - // Reset resolutions of the nested type e.g., - // `@react-native/community-cli-plugin/@react-native-community/cli-server-api` - for (const pkg of Object.keys(resolutions)) { - if (pkg.startsWith("@react-native")) { - resolutions[pkg] = undefined; + // Reset resolutions of the nested type e.g., + // `@react-native/community-cli-plugin/@react-native-community/cli-server-api` + for (const pkg of Object.keys(resolutions)) { + if (pkg.startsWith("@react-native")) { + resolutions[pkg] = undefined; + } + } + } else { + for (const packageName of keys(profile)) { + const deps = dependencies?.[packageName] + ? dependencies + : devDependencies; + deps[packageName] = profile[packageName]; } } @@ -398,18 +354,6 @@ if (isMain(import.meta.url)) { process.exitCode = 1; } else { const { "core-only": coreOnly, overrides } = values; - setReactVersion(version, coreOnly, JSON.parse(overrides)).then(() => { - const numVersion = VALID_TAGS.includes(version) - ? Number.MAX_SAFE_INTEGER - : toVersionNumber(version); - if (numVersion >= v(0, 74, 0)) { - disableJetifier(); - } - - // `@react-native-webapis/web-storage` is not compatible with codegen 0.71 - if (numVersion < v(0, 72, 0)) { - disableWebStorage(); - } - }); + setReactVersion(version, coreOnly, JSON.parse(overrides)); } } diff --git a/scripts/internal/test.mts b/packages/app/scripts/internal/test.mts similarity index 100% rename from scripts/internal/test.mts rename to packages/app/scripts/internal/test.mts diff --git a/scripts/schema.mjs b/packages/app/scripts/schema.mjs similarity index 100% rename from scripts/schema.mjs rename to packages/app/scripts/schema.mjs diff --git a/scripts/template.mjs b/packages/app/scripts/template.mjs similarity index 81% rename from scripts/template.mjs rename to packages/app/scripts/template.mjs index 89efb1c32..c088bc5d3 100644 --- a/scripts/template.mjs +++ b/packages/app/scripts/template.mjs @@ -71,28 +71,6 @@ export function buildGradle() { " }", " }", "}", - "", - // TODO: Remove this block when we drop support for 0.70 - // https://github.com/facebook/react-native/commit/51a48d2e2c64a18012692b063368e369cd8ff797 - "allprojects {", - " repositories {", - " {", - " def searchDir = rootDir.toPath()", - " do {", - ' def p = searchDir.resolve("node_modules/react-native/android")', - " if (p.toFile().exists()) {", - " maven {", - " url = p.toRealPath().toString()", - " }", - " break", - " }", - " } while (searchDir = searchDir.getParent())", - " // As of 0.80, React Native is no longer installed from npm", - " }()", - " mavenCentral()", - " google()", - " }", - "}", "" ); } @@ -110,14 +88,10 @@ export function bundleConfig() { } /** - * @param {number} targetVersion Target React Native version + * @param {number} _targetVersion Target React Native version * @returns {string} */ -export function gradleProperties(targetVersion) { - // https://github.com/facebook/react-native/commit/14ccf6bc9c40a51e913bb89a67b114f035bf77cd - const enableJetifier = targetVersion < v(0, 75, 0) ? "" : "#"; - // https://reactnative.dev/blog/2024/10/23/the-new-architecture-is-here - const enableNewArch = targetVersion >= v(0, 76, 0) ? "" : "#"; +export function gradleProperties(_targetVersion) { return join( "# Project-wide Gradle settings.", "", @@ -146,9 +120,9 @@ export function gradleProperties(targetVersion) { "# https://developer.android.com/topic/libraries/support-library/androidx-rn", "android.useAndroidX=true", "# Automatically convert third-party libraries to use AndroidX", - `${enableJetifier}android.enableJetifier=true`, + `#android.enableJetifier=true`, "# Jetifier randomly fails on these libraries", - `${enableJetifier}android.jetifier.ignorelist=hermes-android,react-android`, + `#android.jetifier.ignorelist=hermes-android,react-android`, "", "# Use this property to specify which architecture you want to build.", "# You can also override it from the CLI using", @@ -161,7 +135,7 @@ export function gradleProperties(targetVersion) { "# to write custom TurboModules/Fabric components OR use libraries that", "# are providing them.", "# Note that this is incompatible with web debugging.", - `${enableNewArch}newArchEnabled=true`, + `newArchEnabled=true`, "#bridgelessEnabled=true", "", "# Uncomment the line below to build React Native from source.", diff --git a/scripts/testing/test-apple.mts b/packages/app/scripts/testing/test-apple.mts similarity index 100% rename from scripts/testing/test-apple.mts rename to packages/app/scripts/testing/test-apple.mts diff --git a/scripts/testing/test-e2e.mts b/packages/app/scripts/testing/test-e2e.mts similarity index 100% rename from scripts/testing/test-e2e.mts rename to packages/app/scripts/testing/test-e2e.mts diff --git a/scripts/testing/test-matrix.mts b/packages/app/scripts/testing/test-matrix.mts similarity index 100% rename from scripts/testing/test-matrix.mts rename to packages/app/scripts/testing/test-matrix.mts diff --git a/scripts/types.ts b/packages/app/scripts/types.ts similarity index 98% rename from scripts/types.ts rename to packages/app/scripts/types.ts index b3c016d6d..1ca2f3ada 100644 --- a/scripts/types.ts +++ b/packages/app/scripts/types.ts @@ -137,7 +137,6 @@ export type ProjectConfiguration = { reactNativePath: string; reactNativeVersion: number; reactNativeHostPath: string; - communityAutolinkingScriptPath?: string; singleApp?: string; useHermes: boolean | "from-source"; useNewArch: boolean; @@ -177,9 +176,9 @@ type InferredOptionTypes = { [key in keyof O]: InferredOptionType }; export type Args = InferredOptionTypes & { _: string[] }; -/************************ +/******************* * windows/app.mjs * - ************************/ + *******************/ type Resources = string[] | { windows?: string[] }; diff --git a/scripts/utils/colors.mjs b/packages/app/scripts/utils/colors.mjs similarity index 100% rename from scripts/utils/colors.mjs rename to packages/app/scripts/utils/colors.mjs diff --git a/scripts/utils/filesystem.mjs b/packages/app/scripts/utils/filesystem.mjs similarity index 100% rename from scripts/utils/filesystem.mjs rename to packages/app/scripts/utils/filesystem.mjs diff --git a/scripts/utils/npm.mjs b/packages/app/scripts/utils/npm.mjs similarity index 100% rename from scripts/utils/npm.mjs rename to packages/app/scripts/utils/npm.mjs diff --git a/scripts/utils/parseargs.mjs b/packages/app/scripts/utils/parseargs.mjs similarity index 100% rename from scripts/utils/parseargs.mjs rename to packages/app/scripts/utils/parseargs.mjs diff --git a/test-app.gradle b/packages/app/test-app.gradle similarity index 83% rename from test-app.gradle rename to packages/app/test-app.gradle index ea080886a..23aa687ab 100644 --- a/test-app.gradle +++ b/packages/app/test-app.gradle @@ -14,11 +14,6 @@ applyConfigPlugins(rootDir, testAppDir) def reactNativeDir = file(findNodeModulesPath("react-native", rootDir)) -def importLegacyAutolinkingModule = { File startDir -> - def cliAndroidDir = findNodeModulesPath("@react-native-community/cli-platform-android", startDir) - apply(from: "${cliAndroidDir}/native_modules.gradle") -} - ext.applyTestAppSettings = { DefaultSettings settings -> settings.include(":app") settings.include(":support") @@ -28,28 +23,18 @@ ext.applyTestAppSettings = { DefaultSettings settings -> settings.project(":support") .projectDir = file("${testAppDir}/android/support") - def reactNativeVersion = getPackageVersionNumber("react-native", rootDir) - - def reactNativeGradlePlugin = - reactNativeVersion >= v(0, 72, 0) - ? findNodeModulesPath("@react-native/gradle-plugin", reactNativeDir) - : findNodeModulesPath("react-native-gradle-plugin", reactNativeDir) + def reactNativeGradlePlugin = findNodeModulesPath("@react-native/gradle-plugin", reactNativeDir) if (reactNativeGradlePlugin != null) { settings.includeBuild(reactNativeGradlePlugin) } - if (reactNativeVersion == 0 || reactNativeVersion >= v(0, 75, 0)) { - // https://github.com/facebook/react-native/blob/b0c0bb45911434ea654ba7e2feff4686061eba7a/packages/react-native-gradle-plugin/settings-plugin/src/main/kotlin/com/facebook/react/ReactSettingsExtension.kt#L39 - def output = file("${rootDir}/app/build/generated/rnta/autolinking.json") - def projectRoot = file(findFile("package.json").getParent()) - def dependencies = autolinkModules(projectRoot, output, testAppDir) - dependencies.each { path, info -> - settings.include(path) - settings.project(path).projectDir = file(info.projectDir) - } - } else { - importLegacyAutolinkingModule(reactNativeDir) - applyNativeModulesSettingsGradle(settings) + // https://github.com/facebook/react-native/blob/b0c0bb45911434ea654ba7e2feff4686061eba7a/packages/react-native-gradle-plugin/settings-plugin/src/main/kotlin/com/facebook/react/ReactSettingsExtension.kt#L39 + def output = file("${rootDir}/app/build/generated/rnta/autolinking.json") + def projectRoot = file(findFile("package.json").getParent()) + def dependencies = autolinkModules(projectRoot, output, testAppDir) + dependencies.each { path, info -> + settings.include(path) + settings.project(path).projectDir = file(info.projectDir) } if (settings.hasProperty("react.buildFromSource") && settings["react.buildFromSource"] == "true") { @@ -67,10 +52,7 @@ ext.applyTestAppSettings = { DefaultSettings settings -> ext.applyTestAppModule = { Project project -> def reactNativeVersion = getPackageVersionNumber("react-native", rootDir) - if (reactNativeVersion >= 0 && reactNativeVersion < v(0, 75, 0)) { - importLegacyAutolinkingModule(reactNativeDir) - applyNativeModulesAppBuildGradle(project) - } else if (reactNativeVersion >= v(0, 82, 0)) { + if (reactNativeVersion >= v(0, 82, 0)) { // Ensure community modules can continue using `isNewArchEnabled()` to // determine whether New Architecture is enabled when it is enabled by // default in React Native 0.82 and later. diff --git a/test/__fixtures__/single_app_mode/app.json b/packages/app/test/__fixtures__/single_app_mode/app.json similarity index 100% rename from test/__fixtures__/single_app_mode/app.json rename to packages/app/test/__fixtures__/single_app_mode/app.json diff --git a/test/__fixtures__/test_app/node_modules/@react-native-community/cli-platform-ios/native_modules.rb b/packages/app/test/__fixtures__/test_app/node_modules/@react-native-community/cli-platform-ios/native_modules.rb similarity index 100% rename from test/__fixtures__/test_app/node_modules/@react-native-community/cli-platform-ios/native_modules.rb rename to packages/app/test/__fixtures__/test_app/node_modules/@react-native-community/cli-platform-ios/native_modules.rb diff --git a/test/__fixtures__/test_app/node_modules/@react-native-community/cli-platform-ios/package.json b/packages/app/test/__fixtures__/test_app/node_modules/@react-native-community/cli-platform-ios/package.json similarity index 100% rename from test/__fixtures__/test_app/node_modules/@react-native-community/cli-platform-ios/package.json rename to packages/app/test/__fixtures__/test_app/node_modules/@react-native-community/cli-platform-ios/package.json diff --git a/test/__fixtures__/test_app/node_modules/react-native/package.json b/packages/app/test/__fixtures__/test_app/node_modules/react-native/package.json similarity index 100% rename from test/__fixtures__/test_app/node_modules/react-native/package.json rename to packages/app/test/__fixtures__/test_app/node_modules/react-native/package.json diff --git a/test/__fixtures__/windows_test_app/Root.vcxproj b/packages/app/test/__fixtures__/windows_test_app/Root.vcxproj similarity index 100% rename from test/__fixtures__/windows_test_app/Root.vcxproj rename to packages/app/test/__fixtures__/windows_test_app/Root.vcxproj diff --git a/test/__fixtures__/windows_test_app/android/Android.vcxproj b/packages/app/test/__fixtures__/windows_test_app/android/Android.vcxproj similarity index 100% rename from test/__fixtures__/windows_test_app/android/Android.vcxproj rename to packages/app/test/__fixtures__/windows_test_app/android/Android.vcxproj diff --git a/test/__fixtures__/windows_test_app/ios/iOS.vcxproj b/packages/app/test/__fixtures__/windows_test_app/ios/iOS.vcxproj similarity index 100% rename from test/__fixtures__/windows_test_app/ios/iOS.vcxproj rename to packages/app/test/__fixtures__/windows_test_app/ios/iOS.vcxproj diff --git a/test/__fixtures__/windows_test_app/macos/macOS.vcxproj b/packages/app/test/__fixtures__/windows_test_app/macos/macOS.vcxproj similarity index 100% rename from test/__fixtures__/windows_test_app/macos/macOS.vcxproj rename to packages/app/test/__fixtures__/windows_test_app/macos/macOS.vcxproj diff --git a/test/__fixtures__/windows_test_app/node_modules/SomeProject.vcxproj b/packages/app/test/__fixtures__/windows_test_app/node_modules/SomeProject.vcxproj similarity index 100% rename from test/__fixtures__/windows_test_app/node_modules/SomeProject.vcxproj rename to packages/app/test/__fixtures__/windows_test_app/node_modules/SomeProject.vcxproj diff --git a/test/__fixtures__/windows_test_app/windows/InvalidProject.vcxproj b/packages/app/test/__fixtures__/windows_test_app/windows/InvalidProject.vcxproj similarity index 100% rename from test/__fixtures__/windows_test_app/windows/InvalidProject.vcxproj rename to packages/app/test/__fixtures__/windows_test_app/windows/InvalidProject.vcxproj diff --git a/test/__fixtures__/windows_test_app/windows/Windows.vcxproj b/packages/app/test/__fixtures__/windows_test_app/windows/Windows.vcxproj similarity index 100% rename from test/__fixtures__/windows_test_app/windows/Windows.vcxproj rename to packages/app/test/__fixtures__/windows_test_app/windows/Windows.vcxproj diff --git a/test/__fixtures__/windows_test_app/windows/WithoutProjectName.vcxproj b/packages/app/test/__fixtures__/windows_test_app/windows/WithoutProjectName.vcxproj similarity index 100% rename from test/__fixtures__/windows_test_app/windows/WithoutProjectName.vcxproj rename to packages/app/test/__fixtures__/windows_test_app/windows/WithoutProjectName.vcxproj diff --git a/test/__fixtures__/with_platform_resources/app.json b/packages/app/test/__fixtures__/with_platform_resources/app.json similarity index 100% rename from test/__fixtures__/with_platform_resources/app.json rename to packages/app/test/__fixtures__/with_platform_resources/app.json diff --git a/test/__fixtures__/with_platform_resources/ios/.gitignore b/packages/app/test/__fixtures__/with_platform_resources/ios/.gitignore similarity index 100% rename from test/__fixtures__/with_platform_resources/ios/.gitignore rename to packages/app/test/__fixtures__/with_platform_resources/ios/.gitignore diff --git a/test/__fixtures__/with_platform_resources/macos/.gitignore b/packages/app/test/__fixtures__/with_platform_resources/macos/.gitignore similarity index 100% rename from test/__fixtures__/with_platform_resources/macos/.gitignore rename to packages/app/test/__fixtures__/with_platform_resources/macos/.gitignore diff --git a/test/__fixtures__/with_resources/app.json b/packages/app/test/__fixtures__/with_resources/app.json similarity index 100% rename from test/__fixtures__/with_resources/app.json rename to packages/app/test/__fixtures__/with_resources/app.json diff --git a/test/__fixtures__/with_resources/ios/.gitignore b/packages/app/test/__fixtures__/with_resources/ios/.gitignore similarity index 100% rename from test/__fixtures__/with_resources/ios/.gitignore rename to packages/app/test/__fixtures__/with_resources/ios/.gitignore diff --git a/test/__fixtures__/with_resources/macos/.gitignore b/packages/app/test/__fixtures__/with_resources/macos/.gitignore similarity index 100% rename from test/__fixtures__/with_resources/macos/.gitignore rename to packages/app/test/__fixtures__/with_resources/macos/.gitignore diff --git a/test/__fixtures__/without_platform_resources/app.json b/packages/app/test/__fixtures__/without_platform_resources/app.json similarity index 100% rename from test/__fixtures__/without_platform_resources/app.json rename to packages/app/test/__fixtures__/without_platform_resources/app.json diff --git a/test/__fixtures__/without_platform_resources/ios/.gitignore b/packages/app/test/__fixtures__/without_platform_resources/ios/.gitignore similarity index 100% rename from test/__fixtures__/without_platform_resources/ios/.gitignore rename to packages/app/test/__fixtures__/without_platform_resources/ios/.gitignore diff --git a/test/__fixtures__/without_platform_resources/macos/.gitignore b/packages/app/test/__fixtures__/without_platform_resources/macos/.gitignore similarity index 100% rename from test/__fixtures__/without_platform_resources/macos/.gitignore rename to packages/app/test/__fixtures__/without_platform_resources/macos/.gitignore diff --git a/test/__fixtures__/without_resources/app.json b/packages/app/test/__fixtures__/without_resources/app.json similarity index 100% rename from test/__fixtures__/without_resources/app.json rename to packages/app/test/__fixtures__/without_resources/app.json diff --git a/test/__fixtures__/without_resources/ios/.gitignore b/packages/app/test/__fixtures__/without_resources/ios/.gitignore similarity index 100% rename from test/__fixtures__/without_resources/ios/.gitignore rename to packages/app/test/__fixtures__/without_resources/ios/.gitignore diff --git a/test/__fixtures__/without_resources/macos/.gitignore b/packages/app/test/__fixtures__/without_resources/macos/.gitignore similarity index 100% rename from test/__fixtures__/without_resources/macos/.gitignore rename to packages/app/test/__fixtures__/without_resources/macos/.gitignore diff --git a/test/android/android-manifest.test.ts b/packages/app/test/android/android-manifest.test.ts similarity index 100% rename from test/android/android-manifest.test.ts rename to packages/app/test/android/android-manifest.test.ts diff --git a/test/android/autolink.test.ts b/packages/app/test/android/autolink.test.ts similarity index 100% rename from test/android/autolink.test.ts rename to packages/app/test/android/autolink.test.ts diff --git a/test/android/gradle-wrapper.test.ts b/packages/app/test/android/gradle-wrapper.test.ts similarity index 89% rename from test/android/gradle-wrapper.test.ts rename to packages/app/test/android/gradle-wrapper.test.ts index 1392a958d..ca92a4485 100644 --- a/test/android/gradle-wrapper.test.ts +++ b/packages/app/test/android/gradle-wrapper.test.ts @@ -140,16 +140,6 @@ describe("configureGradleWrapper()", () => { ["8.12", "0.79.0", "gradle-8.13-bin.zip"], ["8.11.1", "0.78.0", "gradle-8.12-bin.zip"], ["8.9", "0.76.0", "gradle-8.11.1-bin.zip"], - ["8.9", "0.75.0", "gradle-8.8-bin.zip"], - ["8.7", "0.75.0", "gradle-8.8-bin.zip"], - ["8.9", "0.74.0", "gradle-8.8-bin.zip"], - ["8.5", "0.74.0", "gradle-8.6-bin.zip"], - ["8.9", "0.73.0", "gradle-8.8-bin.zip"], - ["8.2.1", "0.73.0", "gradle-8.3-bin.zip"], - ["8.3", "0.72.0", "gradle-8.2.1-bin.zip"], - ["8.1", "0.72.0", "gradle-8.1.1-bin.zip"], - ["8.0", "0.71.0", "gradle-7.6.4-bin.zip"], - ["7.5", "0.71.0", "gradle-7.6.4-bin.zip"], ]; for (const [gradleVersion, rnVersion, expected] of cases) { written = ""; @@ -200,15 +190,6 @@ describe("configureGradleWrapper()", () => { ["8.13", "0.79.0"], ["8.12", "0.78.0"], ["8.11.1", "0.76.0"], - ["8.8", "0.75.0"], - ["8.8", "0.74.0"], - ["8.8", "0.73.0"], - ["8.2", "0.72.0"], - ["8.6", "0.74.0"], - ["8.3", "0.73.0"], - ["8.1.1", "0.72.0"], - ["7.6.4", "0.71.0"], - ["7.5.1", "0.71.0"], ]; for (const [gradleVersion, rnVersion] of cases) { const fs = mockfs(gradleVersion, rnVersion); diff --git a/test/android/gradle.ts b/packages/app/test/android/gradle.ts similarity index 100% rename from test/android/gradle.ts rename to packages/app/test/android/gradle.ts diff --git a/test/android/test-app-util.test.ts b/packages/app/test/android/test-app-util.test.ts similarity index 100% rename from test/android/test-app-util.test.ts rename to packages/app/test/android/test-app-util.test.ts diff --git a/test/configure-projects.test.ts b/packages/app/test/configure-projects.test.ts similarity index 59% rename from test/configure-projects.test.ts rename to packages/app/test/configure-projects.test.ts index f3560ad9d..6c729f6f3 100644 --- a/test/configure-projects.test.ts +++ b/packages/app/test/configure-projects.test.ts @@ -1,4 +1,5 @@ -import { deepEqual, equal, fail, ok, throws } from "node:assert/strict"; +import { XMLParser } from "fast-xml-parser"; +import { deepEqual, equal, ok, throws } from "node:assert/strict"; import * as nodefs from "node:fs"; import * as path from "node:path"; import { describe, it } from "node:test"; @@ -7,9 +8,24 @@ import { internalForTestingPurposesOnly, } from "../scripts/configure-projects.js"; -// This value needs to be the same as `package` in -// `android/app/src/main/AndroidManifest.xml` -const packageName = "com.microsoft.reacttestapp"; +const getAndroidPackageNameFromManifest = (() => { + let packageName = ""; + return () => { + if (!packageName) { + const androidManifestXml = nodefs.readFileSync( + "android/app/src/main/AndroidManifest.xml", + { encoding: "utf-8" } + ); + + const xml = new XMLParser({ ignoreAttributes: false }); + const { manifest } = xml.parse(androidManifestXml); + + packageName = manifest["@_package"]; + } + + return packageName; + }; +})(); describe("configureProjects()", () => { const manifestPath = path.join( @@ -33,7 +49,7 @@ describe("configureProjects()", () => { android: { sourceDir, manifestPath, - packageName, + packageName: getAndroidPackageNameFromManifest(), }, }); }); @@ -117,49 +133,7 @@ describe("findReactNativeConfig()", () => { describe("getAndroidPackageName()", () => { const { getAndroidPackageName } = internalForTestingPurposesOnly; - function mockfs(cliPlatformAndroidVersion: string): typeof nodefs { - const appManifest = "app.json"; - const cliPlatformAndroidPackageManifest = - /@react-native-community[/\\]cli-platform-android[/\\]package.json$/; - return { - ...nodefs, - existsSync: (p) => p === appManifest, - // @ts-expect-error Type 'string' is not assignable to type 'Buffer' - readFileSync: (p) => { - if (p === appManifest) { - return JSON.stringify({ android: { package: "com.testapp" } }); - } else if ( - typeof p === "string" && - cliPlatformAndroidPackageManifest.test(p) - ) { - return JSON.stringify({ - name: "@react-native-community/cli-platform-android", - version: cliPlatformAndroidVersion, - }); - } - - fail(`Unexpected file read: ${p}`); - }, - }; - } - - it("returns early if `@react-native-community/cli-platform-android` <12.3.7", () => { - equal(getAndroidPackageName(mockfs("11.4.1")), undefined); - equal(getAndroidPackageName(mockfs("12.3.6")), undefined); - }); - - it("returns package name if `@react-native-community/cli-platform-android` >=12.3.7 <13.0.0", () => { - equal(getAndroidPackageName(mockfs("12.3.7")), packageName); - equal(getAndroidPackageName(mockfs("12.999.999")), packageName); - }); - - it("returns early if `@react-native-community/cli-platform-android` <13.6.9", () => { - equal(getAndroidPackageName(mockfs("13.0.0")), undefined); - equal(getAndroidPackageName(mockfs("13.6.8")), undefined); - }); - - it("returns package name `@react-native-community/cli-platform-android` >=13.6.9", () => { - equal(getAndroidPackageName(mockfs("13.6.9")), packageName); - equal(getAndroidPackageName(mockfs("14.0.0")), packageName); + it("returns package name set in 'AndroidManifest.xml'", () => { + equal(getAndroidPackageNameFromManifest(), getAndroidPackageName()); }); }); diff --git a/test/configure/console.test.ts b/packages/app/test/configure/console.test.ts similarity index 100% rename from test/configure/console.test.ts rename to packages/app/test/configure/console.test.ts diff --git a/test/configure/gatherConfig.test.ts b/packages/app/test/configure/gatherConfig.test.ts similarity index 86% rename from test/configure/gatherConfig.test.ts rename to packages/app/test/configure/gatherConfig.test.ts index d9ebba624..505deec06 100644 --- a/test/configure/gatherConfig.test.ts +++ b/packages/app/test/configure/gatherConfig.test.ts @@ -1,7 +1,6 @@ import { deepEqual } from "node:assert/strict"; import { describe, it } from "node:test"; import { gatherConfig as gatherConfigActual } from "../../scripts/configure.mjs"; -import { readTextFile } from "../../scripts/helpers.js"; import { join } from "../../scripts/template.mjs"; import type { Configuration, ConfigureParams } from "../../scripts/types.ts"; import { templatePath } from "../template.ts"; @@ -35,10 +34,6 @@ describe("gatherConfig()", () => { return config; } - const gradleWrapper = readTextFile( - "example/android/gradle/wrapper/gradle-wrapper.properties" - ).replaceAll("\r", ""); - it("returns configuration for all platforms", () => { deepEqual(gatherConfig(mockParams()), { dependencies: { @@ -76,26 +71,6 @@ describe("gatherConfig()", () => { " }", " }", "}", - "", - "allprojects {", - " repositories {", - " {", - " def searchDir = rootDir.toPath()", - " do {", - ' def p = searchDir.resolve("node_modules/react-native/android")', - " if (p.toFile().exists()) {", - " maven {", - " url = p.toRealPath().toString()", - " }", - " break", - " }", - " } while (searchDir = searchDir.getParent())", - " // As of 0.80, React Native is no longer installed from npm", - " }()", - " mavenCentral()", - " google()", - " }", - "}", "" ), "android/gradle.properties": join( @@ -156,7 +131,9 @@ describe("gatherConfig()", () => { "android/gradle/wrapper/gradle-wrapper.jar": { source: "example/android/gradle/wrapper/gradle-wrapper.jar", }, - "android/gradle/wrapper/gradle-wrapper.properties": gradleWrapper, + "android/gradle/wrapper/gradle-wrapper.properties": { + source: "example/android/gradle/wrapper/gradle-wrapper.properties", + }, "android/gradlew": { source: "example/android/gradlew", }, @@ -263,16 +240,15 @@ describe("gatherConfig()", () => { scripts: { android: "react-native run-android", "build:android": - "npm run mkdist && react-native bundle --entry-file index.js --platform android --dev true --bundle-output dist/main.android.jsbundle --assets-dest dist/res", + "react-native bundle --entry-file index.js --platform android --dev true --bundle-output dist/main.android.jsbundle --assets-dest dist/res", "build:ios": - "npm run mkdist && react-native bundle --entry-file index.js --platform ios --dev true --bundle-output dist/main.ios.jsbundle --assets-dest dist", + "react-native bundle --entry-file index.js --platform ios --dev true --bundle-output dist/main.ios.jsbundle --assets-dest dist", "build:macos": - "npm run mkdist && react-native bundle --entry-file index.js --platform macos --dev true --bundle-output dist/main.macos.jsbundle --assets-dest dist", + "react-native bundle --entry-file index.js --platform macos --dev true --bundle-output dist/main.macos.jsbundle --assets-dest dist", "build:windows": - "npm run mkdist && react-native bundle --entry-file index.js --platform windows --dev true --bundle-output dist/main.windows.bundle --assets-dest dist", + "react-native bundle --entry-file index.js --platform windows --dev true --bundle-output dist/main.windows.bundle --assets-dest dist", ios: "react-native run-ios", macos: "react-native run-macos --scheme Test", - mkdist: `node -e "require('node:fs').mkdirSync('dist', { recursive: true, mode: 0o755 })"`, start: "react-native start", windows: "react-native run-windows", }, @@ -363,7 +339,6 @@ describe("gatherConfig()", () => { }, oldFiles: [], scripts: { - mkdist: `node -e "require('node:fs').mkdirSync('dist', { recursive: true, mode: 0o755 })"`, start: "react-native start", }, }); @@ -433,9 +408,8 @@ describe("gatherConfig()", () => { ], scripts: { "build:ios": - "npm run mkdist && react-native bundle --entry-file index.js --platform ios --dev true --bundle-output dist/main.ios.jsbundle --assets-dest dist", + "react-native bundle --entry-file index.js --platform ios --dev true --bundle-output dist/main.ios.jsbundle --assets-dest dist", ios: "react-native run-ios", - mkdist: `node -e "require('node:fs').mkdirSync('dist', { recursive: true, mode: 0o755 })"`, start: "react-native start", }, }); @@ -476,26 +450,6 @@ describe("gatherConfig()", () => { " }", " }", "}", - "", - "allprojects {", - " repositories {", - " {", - " def searchDir = rootDir.toPath()", - " do {", - ' def p = searchDir.resolve("node_modules/react-native/android")', - " if (p.toFile().exists()) {", - " maven {", - " url = p.toRealPath().toString()", - " }", - " break", - " }", - " } while (searchDir = searchDir.getParent())", - " // As of 0.80, React Native is no longer installed from npm", - " }()", - " mavenCentral()", - " google()", - " }", - "}", "" ), "android/gradle.properties": join( @@ -556,7 +510,9 @@ describe("gatherConfig()", () => { "android/gradle/wrapper/gradle-wrapper.jar": { source: "example/android/gradle/wrapper/gradle-wrapper.jar", }, - "android/gradle/wrapper/gradle-wrapper.properties": gradleWrapper, + "android/gradle/wrapper/gradle-wrapper.properties": { + source: "example/android/gradle/wrapper/gradle-wrapper.properties", + }, "android/gradlew": { source: "example/android/gradlew", }, @@ -641,11 +597,10 @@ describe("gatherConfig()", () => { scripts: { android: "react-native run-android", "build:android": - "npm run mkdist && react-native bundle --entry-file index.js --platform android --dev true --bundle-output dist/main.android.jsbundle --assets-dest dist/res", + "react-native bundle --entry-file index.js --platform android --dev true --bundle-output dist/main.android.jsbundle --assets-dest dist/res", "build:ios": - "npm run mkdist && react-native bundle --entry-file index.js --platform ios --dev true --bundle-output dist/main.ios.jsbundle --assets-dest dist", + "react-native bundle --entry-file index.js --platform ios --dev true --bundle-output dist/main.ios.jsbundle --assets-dest dist", ios: "react-native run-ios", - mkdist: `node -e "require('node:fs').mkdirSync('dist', { recursive: true, mode: 0o755 })"`, start: "react-native start", }, }); diff --git a/test/configure/getAppName.test.ts b/packages/app/test/configure/getAppName.test.ts similarity index 100% rename from test/configure/getAppName.test.ts rename to packages/app/test/configure/getAppName.test.ts diff --git a/test/configure/getConfig.test.ts b/packages/app/test/configure/getConfig.test.ts similarity index 96% rename from test/configure/getConfig.test.ts rename to packages/app/test/configure/getConfig.test.ts index 783a59e77..d78adc47e 100644 --- a/test/configure/getConfig.test.ts +++ b/packages/app/test/configure/getConfig.test.ts @@ -36,7 +36,7 @@ describe("getConfig()", () => { "react-native.config.js", ]); deepEqual(config.oldFiles, []); - deepEqual(Object.keys(config.scripts).sort(), ["mkdist", "start"]); + deepEqual(Object.keys(config.scripts).sort(), ["start"]); deepEqual(getDependencies("common", params), []); }); @@ -59,7 +59,7 @@ describe("getConfig()", () => { "tsconfig.json", ]); deepEqual(config.oldFiles, []); - deepEqual(Object.keys(config.scripts).sort(), ["mkdist", "start"]); + deepEqual(Object.keys(config.scripts).sort(), ["start"]); deepEqual(getDependencies("common", params), []); }); diff --git a/test/configure/getPlatformPackage.test.ts b/packages/app/test/configure/getPlatformPackage.test.ts similarity index 88% rename from test/configure/getPlatformPackage.test.ts rename to packages/app/test/configure/getPlatformPackage.test.ts index dbe21fbc9..04229ecd3 100644 --- a/test/configure/getPlatformPackage.test.ts +++ b/packages/app/test/configure/getPlatformPackage.test.ts @@ -13,9 +13,9 @@ describe("getPlatformPackage()", () => { deepEqual(pkg, { [name]: "^0.0.0" }); } - for (const targetVersion of ["0.73", "0.73.2", "^0.73", "^0.73.2"]) { + for (const targetVersion of ["0.78", "0.78.6", "^0.78", "^0.78.6"]) { const pkg = getPlatformPackage("macos", targetVersion); - deepEqual(pkg, { [name]: "^0.73.0" }); + deepEqual(pkg, { [name]: "^0.78.0" }); } equal(warnMock.mock.calls.length, 0); @@ -24,7 +24,7 @@ describe("getPlatformPackage()", () => { it("returns `undefined` when target version is outside range", (t) => { const warnMock = t.mock.method(console, "warn", () => null); - const versions = ["0.59", "9999.0"]; + const versions = ["0.75", "9999.0"]; for (const targetVersion of versions) { const pkg = getPlatformPackage("macos", targetVersion); equal(pkg, undefined); diff --git a/test/configure/isDestructive.test.ts b/packages/app/test/configure/isDestructive.test.ts similarity index 100% rename from test/configure/isDestructive.test.ts rename to packages/app/test/configure/isDestructive.test.ts diff --git a/test/configure/join.test.ts b/packages/app/test/configure/join.test.ts similarity index 100% rename from test/configure/join.test.ts rename to packages/app/test/configure/join.test.ts diff --git a/test/configure/mergeConfig.test.ts b/packages/app/test/configure/mergeConfig.test.ts similarity index 100% rename from test/configure/mergeConfig.test.ts rename to packages/app/test/configure/mergeConfig.test.ts diff --git a/test/configure/mockParams.ts b/packages/app/test/configure/mockParams.ts similarity index 100% rename from test/configure/mockParams.ts rename to packages/app/test/configure/mockParams.ts diff --git a/test/configure/reactNativeConfig.test.ts b/packages/app/test/configure/reactNativeConfig.test.ts similarity index 100% rename from test/configure/reactNativeConfig.test.ts rename to packages/app/test/configure/reactNativeConfig.test.ts diff --git a/test/configure/removeAllFiles.test.ts b/packages/app/test/configure/removeAllFiles.test.ts similarity index 100% rename from test/configure/removeAllFiles.test.ts rename to packages/app/test/configure/removeAllFiles.test.ts diff --git a/test/configure/updatePackageManifest.test.ts b/packages/app/test/configure/updatePackageManifest.test.ts similarity index 100% rename from test/configure/updatePackageManifest.test.ts rename to packages/app/test/configure/updatePackageManifest.test.ts diff --git a/test/configure/writeAllFiles.test.ts b/packages/app/test/configure/writeAllFiles.test.ts similarity index 100% rename from test/configure/writeAllFiles.test.ts rename to packages/app/test/configure/writeAllFiles.test.ts diff --git a/test/embed-manifest/cpp.test.ts b/packages/app/test/embed-manifest/cpp.test.ts similarity index 100% rename from test/embed-manifest/cpp.test.ts rename to packages/app/test/embed-manifest/cpp.test.ts diff --git a/test/embed-manifest/fixtures.ts b/packages/app/test/embed-manifest/fixtures.ts similarity index 100% rename from test/embed-manifest/fixtures.ts rename to packages/app/test/embed-manifest/fixtures.ts diff --git a/test/embed-manifest/kotlin.test.ts b/packages/app/test/embed-manifest/kotlin.test.ts similarity index 100% rename from test/embed-manifest/kotlin.test.ts rename to packages/app/test/embed-manifest/kotlin.test.ts diff --git a/test/embed-manifest/swift.test.ts b/packages/app/test/embed-manifest/swift.test.ts similarity index 100% rename from test/embed-manifest/swift.test.ts rename to packages/app/test/embed-manifest/swift.test.ts diff --git a/test/embed-manifest/validate.test.ts b/packages/app/test/embed-manifest/validate.test.ts similarity index 100% rename from test/embed-manifest/validate.test.ts rename to packages/app/test/embed-manifest/validate.test.ts diff --git a/test/fs.mock.ts b/packages/app/test/fs.mock.ts similarity index 100% rename from test/fs.mock.ts rename to packages/app/test/fs.mock.ts diff --git a/test/helpers.test.ts b/packages/app/test/helpers.test.ts similarity index 98% rename from test/helpers.test.ts rename to packages/app/test/helpers.test.ts index 19c438819..ff27a4e92 100644 --- a/test/helpers.test.ts +++ b/packages/app/test/helpers.test.ts @@ -1,4 +1,5 @@ import { equal, fail, notEqual } from "node:assert/strict"; +import * as fs from "node:fs"; import * as path from "node:path"; import { describe, it } from "node:test"; import { URL, fileURLToPath } from "node:url"; @@ -72,7 +73,7 @@ describe("requireTransitive()", () => { const mustache = requireTransitive( ["@react-native-windows/cli", "mustache"], - rnwDir + fs.realpathSync(rnwDir) ); notEqual(mustache, null); equal(typeof mustache.parse, "function"); diff --git a/test/ios/app.test.ts b/packages/app/test/ios/app.test.ts similarity index 97% rename from test/ios/app.test.ts rename to packages/app/test/ios/app.test.ts index 2bf391ba0..7b7cce022 100644 --- a/test/ios/app.test.ts +++ b/packages/app/test/ios/app.test.ts @@ -231,17 +231,6 @@ describe("generateProject()", macosOnly, () => { deepEqual(trimPaths(result, cwd), PROJECT_FILES.customReactNative); }); - - it("finds community autolinking script for older versions", () => { - setMockFiles(makeMockProject(undefined, "0.74.0")); - - const result = generateProject("ios", "ios", {}); - - equal( - result.communityAutolinkingScriptPath, - "node_modules/@react-native-community/cli-platform-ios/native_modules.rb" - ); - }); }); const PROJECT_FILES = { @@ -260,7 +249,6 @@ const PROJECT_FILES = { PRODUCT_VERSION: "1.0", USER_HEADER_SEARCH_PATHS: ["/~/node_modules/.generated"], }, - communityAutolinkingScriptPath: undefined, reactNativeHostPath: "../node_modules/@rnx-kit/react-native-host", reactNativePath: "/~/node_modules/react-native-macos", reactNativeVersion: 1000000000, @@ -289,7 +277,6 @@ const PROJECT_FILES = { PRODUCT_VERSION: "1.0", USER_HEADER_SEARCH_PATHS: ["/~/node_modules/.generated"], }, - communityAutolinkingScriptPath: undefined, reactNativeHostPath: "../node_modules/@rnx-kit/react-native-host", reactNativePath: "/~/node_modules/react-native", reactNativeVersion: 1000000000, @@ -354,7 +341,6 @@ const PROJECT_FILES = { PRODUCT_VERSION: "1.0", USER_HEADER_SEARCH_PATHS: ["/~/node_modules/.generated"], }, - communityAutolinkingScriptPath: undefined, reactNativeHostPath: "../node_modules/@rnx-kit/react-native-host", reactNativePath: "/~/node_modules/react-native-macos", reactNativeVersion: 1000000000, @@ -420,7 +406,6 @@ const PROJECT_FILES = { PRODUCT_VERSION: "1.0", USER_HEADER_SEARCH_PATHS: ["/~/node_modules/.generated"], }, - communityAutolinkingScriptPath: undefined, reactNativeHostPath: "../node_modules/@rnx-kit/react-native-host", reactNativePath: "/~/node_modules/@callstack/react-native-visionos", reactNativeVersion: 1000000000, @@ -482,7 +467,6 @@ const PROJECT_FILES = { PRODUCT_VERSION: "1.0", USER_HEADER_SEARCH_PATHS: ["/~/node_modules/.generated"], }, - communityAutolinkingScriptPath: undefined, reactNativeHostPath: "../node_modules/@rnx-kit/react-native-host", reactNativePath: "/~/node_modules/react-native", reactNativeVersion: 81000, @@ -541,7 +525,6 @@ const PROJECT_FILES = { PRODUCT_VERSION: "1.0", USER_HEADER_SEARCH_PATHS: ["/~/node_modules/.generated"], }, - communityAutolinkingScriptPath: undefined, reactNativeHostPath: "../node_modules/@rnx-kit/react-native-host", reactNativePath: "/~/node_modules/react-native-macos", reactNativeVersion: 81000, @@ -601,7 +584,6 @@ const PROJECT_FILES = { PRODUCT_VERSION: "1.0", USER_HEADER_SEARCH_PATHS: ["/~/node_modules/.generated"], }, - communityAutolinkingScriptPath: undefined, reactNativeHostPath: "../node_modules/@rnx-kit/react-native-host", reactNativePath: "/~/node_modules/@callstack/react-native-visionos", reactNativeVersion: 81000, diff --git a/test/ios/assetsCatalog.test.ts b/packages/app/test/ios/assetsCatalog.test.ts similarity index 100% rename from test/ios/assetsCatalog.test.ts rename to packages/app/test/ios/assetsCatalog.test.ts diff --git a/test/ios/entitlements.test.ts b/packages/app/test/ios/entitlements.test.ts similarity index 100% rename from test/ios/entitlements.test.ts rename to packages/app/test/ios/entitlements.test.ts diff --git a/test/ios/features.test.ts b/packages/app/test/ios/features.test.ts similarity index 80% rename from test/ios/features.test.ts rename to packages/app/test/ios/features.test.ts index 11b3440b1..a97db2141 100644 --- a/test/ios/features.test.ts +++ b/packages/app/test/ios/features.test.ts @@ -1,4 +1,4 @@ -import { equal, ok } from "node:assert/strict"; +import { ok } from "node:assert/strict"; import { afterEach, before, describe, it } from "node:test"; import { isBridgelessEnabled, @@ -80,43 +80,31 @@ describe("isHermesEnabled()", () => { for (const platform of ["ios", "macos", "visionos"] as const) { it(`[${platform}] is disabled by default`, () => { - ok(!isHermesEnabled(platform, v(0, 79, 0), {})); + ok(!isHermesEnabled(v(0, 79, 0), {})); }); it(`[${platform}] returns true when enabled`, () => { - ok(isHermesEnabled(platform, v(0, 79, 0), { hermesEnabled: true })); + ok(isHermesEnabled(v(0, 79, 0), { hermesEnabled: true })); }); it(`[${platform}] returns true if 'USE_HERMES=1'`, () => { process.env["USE_HERMES"] = "1"; - ok(isHermesEnabled(platform, v(0, 79, 0), {})); + ok(isHermesEnabled(v(0, 79, 0), {})); }); it(`[${platform}] returns false if 'USE_HERMES=0'`, () => { process.env["USE_HERMES"] = "0"; - ok(!isHermesEnabled(platform, v(0, 79, 0), { hermesEnabled: true })); + ok(!isHermesEnabled(v(0, 79, 0), { hermesEnabled: true })); }); it(`[${platform}] always returns true from 0.80 on`, () => { - ok(isHermesEnabled(platform, v(0, 80, 0), {})); + ok(isHermesEnabled(v(0, 80, 0), {})); process.env["USE_HERMES"] = "0"; - ok(isHermesEnabled(platform, v(0, 80, 0), {})); + ok(isHermesEnabled(v(0, 80, 0), {})); }); } - - it("[visionos] builds from source when necessary", () => { - const options = { hermesEnabled: true }; - - equal(isHermesEnabled("visionos", v(0, 75, 0), options), "from-source"); - equal(isHermesEnabled("visionos", v(0, 76, 0), options), true); - - process.env["USE_HERMES"] = "1"; - - equal(isHermesEnabled("visionos", v(0, 75, 0), {}), "from-source"); - equal(isHermesEnabled("visionos", v(0, 76, 0), {}), true); - }); }); describe("isNewArchEnabled()", () => { @@ -137,9 +125,6 @@ describe("isNewArchEnabled()", () => { it("returns true if New Architecture is available and enabled", () => { ok(!isNewArchEnabled(0, {})); ok(!isNewArchEnabled(firstAvailableVersion, {})); - - // New architecture is first publicly available in 0.68, but we'll require 0.71 - ok(!isNewArchEnabled(v(0, 70, 999), { fabricEnabled: true })); ok(isNewArchEnabled(firstAvailableVersion, { fabricEnabled: true })); ok(isNewArchEnabled(firstAvailableVersion, { newArchEnabled: true })); }); @@ -147,14 +132,12 @@ describe("isNewArchEnabled()", () => { it("returns true if `RCT_NEW_ARCH_ENABLED=1`", () => { process.env["RCT_NEW_ARCH_ENABLED"] = "1"; - ok(!isNewArchEnabled(v(0, 70, 999), {})); ok(isNewArchEnabled(firstAvailableVersion, {})); }); it("returns false if `RCT_NEW_ARCH_ENABLED=0`", () => { process.env["RCT_NEW_ARCH_ENABLED"] = "0"; - ok(!isNewArchEnabled(v(0, 70, 999), {})); ok(!isNewArchEnabled(firstAvailableVersion, {})); ok(!isNewArchEnabled(firstAvailableVersion, { fabric_enabled: true })); }); diff --git a/test/ios/infoPlist.test.ts b/packages/app/test/ios/infoPlist.test.ts similarity index 100% rename from test/ios/infoPlist.test.ts rename to packages/app/test/ios/infoPlist.test.ts diff --git a/test/ios/localizations.test.ts b/packages/app/test/ios/localizations.test.ts similarity index 100% rename from test/ios/localizations.test.ts rename to packages/app/test/ios/localizations.test.ts diff --git a/test/ios/privacyManifest.test.ts b/packages/app/test/ios/privacyManifest.test.ts similarity index 100% rename from test/ios/privacyManifest.test.ts rename to packages/app/test/ios/privacyManifest.test.ts diff --git a/test/ios/xcode.test.ts b/packages/app/test/ios/xcode.test.ts similarity index 94% rename from test/ios/xcode.test.ts rename to packages/app/test/ios/xcode.test.ts index 246afc232..f9c55cd93 100644 --- a/test/ios/xcode.test.ts +++ b/packages/app/test/ios/xcode.test.ts @@ -27,7 +27,7 @@ import { PRODUCT_BUNDLE_IDENTIFIER, USER_HEADER_SEARCH_PATHS, } from "../../ios/xcode.mjs"; -import { readTextFile, v } from "../../scripts/helpers.js"; +import { readTextFile } from "../../scripts/helpers.js"; import type { ApplePlatform, JSONObject, @@ -248,32 +248,6 @@ describe("applyPreprocessorDefinitions()", () => { "REACT_NATIVE_VERSION=0", ]); }); - - it("applies C++17 workarounds for unpatched versions", () => { - const versions = [ - [v(0, 71, 0), true], - [v(0, 71, 3), true], - [v(0, 71, 4), false], - [v(0, 72, 0), true], - [v(0, 72, 4), true], - [v(0, 72, 5), false], - ] as const; - - for (const [version, enable] of versions) { - const project = makeProjectConfiguration(); - const { buildSettings } = project; - - project.reactNativeVersion = version; - applyPreprocessorDefinitions(project); - - const expected = [`REACT_NATIVE_VERSION=${version}`]; - if (enable) { - expected.push("_LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION=1"); - } - - deepEqual(buildSettings[GCC_PREPROCESSOR_DEFINITIONS], expected); - } - }); }); describe("applySwiftFlags()", () => { diff --git a/test/pack.test.ts b/packages/app/test/pack.test.ts similarity index 92% rename from test/pack.test.ts rename to packages/app/test/pack.test.ts index b942712a4..2c7a9bf93 100644 --- a/test/pack.test.ts +++ b/packages/app/test/pack.test.ts @@ -26,21 +26,15 @@ describe("npm pack", () => { .sort(); deepEqual(content, [ - "CODE_OF_CONDUCT.md", - "CONTRIBUTING.md", "LICENSE", "README.md", "ReactTestApp-DevSupport.podspec", - "SECURITY.md", "android/android-manifest.js", "android/app/build.gradle", "android/app/lint.xml", "android/app/src/camera/java/com/microsoft/reacttestapp/camera/MainActivityExtensions.kt", "android/app/src/camera/java/com/microsoft/reacttestapp/camera/QRCodeScannerFragment.kt", - "android/app/src/devserverhelper-0.73/java/com/microsoft/reacttestapp/react/DevServerHelperCompat.kt", - "android/app/src/devserverhelper-0.74/java/com/microsoft/reacttestapp/react/DevServerHelperCompat.kt", "android/app/src/devserverhelper-0.75/java/com/microsoft/reacttestapp/react/DevServerHelperCompat.kt", - "android/app/src/devserverhelper-pre-0.73/java/com/microsoft/reacttestapp/react/DevServerHelperCompat.kt", "android/app/src/main/AndroidManifest.xml", "android/app/src/main/java/com/microsoft/reacttestapp/MainActivity.kt", "android/app/src/main/java/com/microsoft/reacttestapp/Session.kt", @@ -89,20 +83,11 @@ describe("npm pack", () => { "android/app/src/new-arch-0.81/java/com/microsoft/reacttestapp/compat/ReactNativeHostCompat.kt", "android/app/src/new-arch-0.81/java/com/microsoft/reacttestapp/fabric/ComponentsRegistry.kt", "android/app/src/new-arch-0.81/java/com/microsoft/reacttestapp/turbomodule/TurboModuleManagerDelegate.kt", - "android/app/src/new-arch/java/com/microsoft/reacttestapp/compat/ReactNativeHostCompat.kt", - "android/app/src/new-arch/java/com/microsoft/reacttestapp/fabric/ComponentsRegistry.kt", - "android/app/src/new-arch/java/com/microsoft/reacttestapp/turbomodule/TurboModuleManagerDelegate.kt", "android/app/src/no-camera/java/com/microsoft/reacttestapp/camera/MainActivityExtensions.kt", "android/app/src/old-arch/java/com/microsoft/reacttestapp/compat/ReactNativeHostCompat.kt", - "android/app/src/reactactivitydelegate-0.72/java/com/microsoft/reacttestapp/component/ComponentActivityDelegate.kt", - "android/app/src/reactactivitydelegate-0.74/java/com/microsoft/reacttestapp/component/ComponentActivityDelegate.kt", "android/app/src/reactactivitydelegate-0.75/java/com/microsoft/reacttestapp/component/ComponentActivityDelegate.kt", - "android/app/src/reactactivitydelegate-pre-0.72/java/com/microsoft/reacttestapp/component/ComponentActivityDelegate.kt", - "android/app/src/reactapplication-0.73/java/com/microsoft/reacttestapp/TestApp.kt", "android/app/src/reactapplication-0.76/java/com/microsoft/reacttestapp/TestApp.kt", - "android/app/src/reactapplication-pre-0.73/java/com/microsoft/reacttestapp/TestApp.kt", "android/app/src/reacthost-0.76/java/com/microsoft/reacttetapp/react/MainReactNativeHost.kt", - "android/app/src/reacthost-legacy/java/com/microsoft/reacttetapp/react/MainReactNativeHost.kt", "android/autolink.gradle", "android/autolink.mjs", "android/config-plugins.gradle", @@ -166,7 +151,6 @@ describe("npm pack", () => { "ios/pod_helpers.rb", "ios/privacyManifest.mjs", "ios/test_app.rb", - "ios/use_react_native-0.70.rb", "ios/use_react_native-0.71.rb", "ios/utils.mjs", "ios/xcode.mjs", diff --git a/test/template.ts b/packages/app/test/template.ts similarity index 100% rename from test/template.ts rename to packages/app/test/template.ts diff --git a/test/test_pod_helpers.rb b/packages/app/test/test_pod_helpers.rb similarity index 100% rename from test/test_pod_helpers.rb rename to packages/app/test/test_pod_helpers.rb diff --git a/test/test_test_app.rb b/packages/app/test/test_test_app.rb similarity index 99% rename from test/test_test_app.rb rename to packages/app/test/test_test_app.rb index 4d2da463c..04fe52ae1 100644 --- a/test/test_test_app.rb +++ b/packages/app/test/test_test_app.rb @@ -23,7 +23,6 @@ def test_react_native_pods [0, '0.71'], [v(1000, 0, 0), '0.71'], [v(0, 71, 0), '0.71'], - [v(0, 70, 13), '0.70'], ].each do |target, profile| assert_equal("use_react_native-#{profile}", react_native_pods(target)) end diff --git a/test/windows/copyAndReplace.test.ts b/packages/app/test/windows/copyAndReplace.test.ts similarity index 100% rename from test/windows/copyAndReplace.test.ts rename to packages/app/test/windows/copyAndReplace.test.ts diff --git a/test/windows/findUserProjects.test.ts b/packages/app/test/windows/findUserProjects.test.ts similarity index 100% rename from test/windows/findUserProjects.test.ts rename to packages/app/test/windows/findUserProjects.test.ts diff --git a/test/windows/generateSolution.test.ts b/packages/app/test/windows/generateSolution.test.ts similarity index 100% rename from test/windows/generateSolution.test.ts rename to packages/app/test/windows/generateSolution.test.ts diff --git a/test/windows/getBundleResources.test.ts b/packages/app/test/windows/getBundleResources.test.ts similarity index 100% rename from test/windows/getBundleResources.test.ts rename to packages/app/test/windows/getBundleResources.test.ts diff --git a/test/windows/parseMSBuildProperties.test.ts b/packages/app/test/windows/parseMSBuildProperties.test.ts similarity index 100% rename from test/windows/parseMSBuildProperties.test.ts rename to packages/app/test/windows/parseMSBuildProperties.test.ts diff --git a/test/windows/parseResources.test.ts b/packages/app/test/windows/parseResources.test.ts similarity index 100% rename from test/windows/parseResources.test.ts rename to packages/app/test/windows/parseResources.test.ts diff --git a/test/windows/replaceContent.test.ts b/packages/app/test/windows/replaceContent.test.ts similarity index 100% rename from test/windows/replaceContent.test.ts rename to packages/app/test/windows/replaceContent.test.ts diff --git a/test_app.rb b/packages/app/test_app.rb similarity index 100% rename from test_app.rb rename to packages/app/test_app.rb diff --git a/tsconfig.cjs.json b/packages/app/tsconfig.cjs.json similarity index 100% rename from tsconfig.cjs.json rename to packages/app/tsconfig.cjs.json diff --git a/tsconfig.json b/packages/app/tsconfig.json similarity index 100% rename from tsconfig.json rename to packages/app/tsconfig.json diff --git a/visionos/ReactTestApp.xcodeproj/project.pbxproj b/packages/app/visionos/ReactTestApp.xcodeproj/project.pbxproj similarity index 100% rename from visionos/ReactTestApp.xcodeproj/project.pbxproj rename to packages/app/visionos/ReactTestApp.xcodeproj/project.pbxproj diff --git a/visionos/ReactTestApp.xcodeproj/xcshareddata/xcschemes/ReactTestApp.xcscheme b/packages/app/visionos/ReactTestApp.xcodeproj/xcshareddata/xcschemes/ReactTestApp.xcscheme similarity index 100% rename from visionos/ReactTestApp.xcodeproj/xcshareddata/xcschemes/ReactTestApp.xcscheme rename to packages/app/visionos/ReactTestApp.xcodeproj/xcshareddata/xcschemes/ReactTestApp.xcscheme diff --git a/visionos/ReactTestApp/Assets.xcassets/AppIcon.solidimagestack/Back.solidimagestacklayer/Content.imageset/Contents.json b/packages/app/visionos/ReactTestApp/Assets.xcassets/AppIcon.solidimagestack/Back.solidimagestacklayer/Content.imageset/Contents.json similarity index 100% rename from visionos/ReactTestApp/Assets.xcassets/AppIcon.solidimagestack/Back.solidimagestacklayer/Content.imageset/Contents.json rename to packages/app/visionos/ReactTestApp/Assets.xcassets/AppIcon.solidimagestack/Back.solidimagestacklayer/Content.imageset/Contents.json diff --git a/visionos/ReactTestApp/Assets.xcassets/AppIcon.solidimagestack/Back.solidimagestacklayer/Content.imageset/back.jpg b/packages/app/visionos/ReactTestApp/Assets.xcassets/AppIcon.solidimagestack/Back.solidimagestacklayer/Content.imageset/back.jpg similarity index 100% rename from visionos/ReactTestApp/Assets.xcassets/AppIcon.solidimagestack/Back.solidimagestacklayer/Content.imageset/back.jpg rename to packages/app/visionos/ReactTestApp/Assets.xcassets/AppIcon.solidimagestack/Back.solidimagestacklayer/Content.imageset/back.jpg diff --git a/visionos/ReactTestApp/Assets.xcassets/AppIcon.solidimagestack/Back.solidimagestacklayer/Contents.json b/packages/app/visionos/ReactTestApp/Assets.xcassets/AppIcon.solidimagestack/Back.solidimagestacklayer/Contents.json similarity index 100% rename from visionos/ReactTestApp/Assets.xcassets/AppIcon.solidimagestack/Back.solidimagestacklayer/Contents.json rename to packages/app/visionos/ReactTestApp/Assets.xcassets/AppIcon.solidimagestack/Back.solidimagestacklayer/Contents.json diff --git a/visionos/ReactTestApp/Assets.xcassets/AppIcon.solidimagestack/Contents.json b/packages/app/visionos/ReactTestApp/Assets.xcassets/AppIcon.solidimagestack/Contents.json similarity index 100% rename from visionos/ReactTestApp/Assets.xcassets/AppIcon.solidimagestack/Contents.json rename to packages/app/visionos/ReactTestApp/Assets.xcassets/AppIcon.solidimagestack/Contents.json diff --git a/visionos/ReactTestApp/Assets.xcassets/AppIcon.solidimagestack/Front.solidimagestacklayer/Content.imageset/Contents.json b/packages/app/visionos/ReactTestApp/Assets.xcassets/AppIcon.solidimagestack/Front.solidimagestacklayer/Content.imageset/Contents.json similarity index 100% rename from visionos/ReactTestApp/Assets.xcassets/AppIcon.solidimagestack/Front.solidimagestacklayer/Content.imageset/Contents.json rename to packages/app/visionos/ReactTestApp/Assets.xcassets/AppIcon.solidimagestack/Front.solidimagestacklayer/Content.imageset/Contents.json diff --git a/visionos/ReactTestApp/Assets.xcassets/AppIcon.solidimagestack/Front.solidimagestacklayer/Content.imageset/front.png b/packages/app/visionos/ReactTestApp/Assets.xcassets/AppIcon.solidimagestack/Front.solidimagestacklayer/Content.imageset/front.png similarity index 100% rename from visionos/ReactTestApp/Assets.xcassets/AppIcon.solidimagestack/Front.solidimagestacklayer/Content.imageset/front.png rename to packages/app/visionos/ReactTestApp/Assets.xcassets/AppIcon.solidimagestack/Front.solidimagestacklayer/Content.imageset/front.png diff --git a/visionos/ReactTestApp/Assets.xcassets/AppIcon.solidimagestack/Front.solidimagestacklayer/Contents.json b/packages/app/visionos/ReactTestApp/Assets.xcassets/AppIcon.solidimagestack/Front.solidimagestacklayer/Contents.json similarity index 100% rename from visionos/ReactTestApp/Assets.xcassets/AppIcon.solidimagestack/Front.solidimagestacklayer/Contents.json rename to packages/app/visionos/ReactTestApp/Assets.xcassets/AppIcon.solidimagestack/Front.solidimagestacklayer/Contents.json diff --git a/visionos/ReactTestApp/Assets.xcassets/AppIcon.solidimagestack/Middle.solidimagestacklayer/Content.imageset/Contents.json b/packages/app/visionos/ReactTestApp/Assets.xcassets/AppIcon.solidimagestack/Middle.solidimagestacklayer/Content.imageset/Contents.json similarity index 100% rename from visionos/ReactTestApp/Assets.xcassets/AppIcon.solidimagestack/Middle.solidimagestacklayer/Content.imageset/Contents.json rename to packages/app/visionos/ReactTestApp/Assets.xcassets/AppIcon.solidimagestack/Middle.solidimagestacklayer/Content.imageset/Contents.json diff --git a/visionos/ReactTestApp/Assets.xcassets/AppIcon.solidimagestack/Middle.solidimagestacklayer/Contents.json b/packages/app/visionos/ReactTestApp/Assets.xcassets/AppIcon.solidimagestack/Middle.solidimagestacklayer/Contents.json similarity index 100% rename from visionos/ReactTestApp/Assets.xcassets/AppIcon.solidimagestack/Middle.solidimagestacklayer/Contents.json rename to packages/app/visionos/ReactTestApp/Assets.xcassets/AppIcon.solidimagestack/Middle.solidimagestacklayer/Contents.json diff --git a/visionos/ReactTestApp/Assets.xcassets/Contents.json b/packages/app/visionos/ReactTestApp/Assets.xcassets/Contents.json similarity index 100% rename from visionos/ReactTestApp/Assets.xcassets/Contents.json rename to packages/app/visionos/ReactTestApp/Assets.xcassets/Contents.json diff --git a/visionos/ReactTestApp/Info.plist b/packages/app/visionos/ReactTestApp/Info.plist similarity index 100% rename from visionos/ReactTestApp/Info.plist rename to packages/app/visionos/ReactTestApp/Info.plist diff --git a/visionos/ReactTestApp/ReactTestApp.common.xcconfig b/packages/app/visionos/ReactTestApp/ReactTestApp.common.xcconfig similarity index 100% rename from visionos/ReactTestApp/ReactTestApp.common.xcconfig rename to packages/app/visionos/ReactTestApp/ReactTestApp.common.xcconfig diff --git a/visionos/ReactTestApp/ReactTestApp.debug.xcconfig b/packages/app/visionos/ReactTestApp/ReactTestApp.debug.xcconfig similarity index 100% rename from visionos/ReactTestApp/ReactTestApp.debug.xcconfig rename to packages/app/visionos/ReactTestApp/ReactTestApp.debug.xcconfig diff --git a/visionos/ReactTestApp/ReactTestApp.release.xcconfig b/packages/app/visionos/ReactTestApp/ReactTestApp.release.xcconfig similarity index 100% rename from visionos/ReactTestApp/ReactTestApp.release.xcconfig rename to packages/app/visionos/ReactTestApp/ReactTestApp.release.xcconfig diff --git a/visionos/ReactTestAppTests/Info.plist b/packages/app/visionos/ReactTestAppTests/Info.plist similarity index 100% rename from visionos/ReactTestAppTests/Info.plist rename to packages/app/visionos/ReactTestAppTests/Info.plist diff --git a/visionos/ReactTestAppTests/ReactTestAppTests.swift b/packages/app/visionos/ReactTestAppTests/ReactTestAppTests.swift similarity index 100% rename from visionos/ReactTestAppTests/ReactTestAppTests.swift rename to packages/app/visionos/ReactTestAppTests/ReactTestAppTests.swift diff --git a/visionos/ReactTestAppUITests/Info.plist b/packages/app/visionos/ReactTestAppUITests/Info.plist similarity index 100% rename from visionos/ReactTestAppUITests/Info.plist rename to packages/app/visionos/ReactTestAppUITests/Info.plist diff --git a/visionos/ReactTestAppUITests/ReactTestAppUITests.swift b/packages/app/visionos/ReactTestAppUITests/ReactTestAppUITests.swift similarity index 100% rename from visionos/ReactTestAppUITests/ReactTestAppUITests.swift rename to packages/app/visionos/ReactTestAppUITests/ReactTestAppUITests.swift diff --git a/visionos/Shared b/packages/app/visionos/Shared similarity index 100% rename from visionos/Shared rename to packages/app/visionos/Shared diff --git a/visionos/test_app.rb b/packages/app/visionos/test_app.rb similarity index 100% rename from visionos/test_app.rb rename to packages/app/visionos/test_app.rb diff --git a/windows/.clang-format b/packages/app/windows/.clang-format similarity index 100% rename from windows/.clang-format rename to packages/app/windows/.clang-format diff --git a/windows/.gitignore b/packages/app/windows/.gitignore similarity index 100% rename from windows/.gitignore rename to packages/app/windows/.gitignore diff --git a/windows/ExperimentalFeatures.props b/packages/app/windows/ExperimentalFeatures.props similarity index 98% rename from windows/ExperimentalFeatures.props rename to packages/app/windows/ExperimentalFeatures.props index 26b727e29..e22ce48e6 100644 --- a/windows/ExperimentalFeatures.props +++ b/packages/app/windows/ExperimentalFeatures.props @@ -10,7 +10,7 @@ false diff --git a/windows/Shared/EmbedManifest.targets b/packages/app/windows/Shared/EmbedManifest.targets similarity index 100% rename from windows/Shared/EmbedManifest.targets rename to packages/app/windows/Shared/EmbedManifest.targets diff --git a/windows/Shared/JSValueWriterHelper.h b/packages/app/windows/Shared/JSValueWriterHelper.h similarity index 100% rename from windows/Shared/JSValueWriterHelper.h rename to packages/app/windows/Shared/JSValueWriterHelper.h diff --git a/windows/Shared/Manifest.h b/packages/app/windows/Shared/Manifest.h similarity index 100% rename from windows/Shared/Manifest.h rename to packages/app/windows/Shared/Manifest.h diff --git a/windows/Shared/ReactInstance.cpp b/packages/app/windows/Shared/ReactInstance.cpp similarity index 100% rename from windows/Shared/ReactInstance.cpp rename to packages/app/windows/Shared/ReactInstance.cpp diff --git a/windows/Shared/ReactInstance.h b/packages/app/windows/Shared/ReactInstance.h similarity index 100% rename from windows/Shared/ReactInstance.h rename to packages/app/windows/Shared/ReactInstance.h diff --git a/windows/Shared/Session.h b/packages/app/windows/Shared/Session.h similarity index 100% rename from windows/Shared/Session.h rename to packages/app/windows/Shared/Session.h diff --git a/windows/UWP/App.cpp b/packages/app/windows/UWP/App.cpp similarity index 100% rename from windows/UWP/App.cpp rename to packages/app/windows/UWP/App.cpp diff --git a/windows/UWP/App.h b/packages/app/windows/UWP/App.h similarity index 100% rename from windows/UWP/App.h rename to packages/app/windows/UWP/App.h diff --git a/windows/UWP/App.idl b/packages/app/windows/UWP/App.idl similarity index 100% rename from windows/UWP/App.idl rename to packages/app/windows/UWP/App.idl diff --git a/windows/UWP/App.xaml b/packages/app/windows/UWP/App.xaml similarity index 100% rename from windows/UWP/App.xaml rename to packages/app/windows/UWP/App.xaml diff --git a/windows/UWP/Assets/SplashScreen.scale-100.png b/packages/app/windows/UWP/Assets/SplashScreen.scale-100.png similarity index 100% rename from windows/UWP/Assets/SplashScreen.scale-100.png rename to packages/app/windows/UWP/Assets/SplashScreen.scale-100.png diff --git a/windows/UWP/Assets/SplashScreen.scale-200.png b/packages/app/windows/UWP/Assets/SplashScreen.scale-200.png similarity index 100% rename from windows/UWP/Assets/SplashScreen.scale-200.png rename to packages/app/windows/UWP/Assets/SplashScreen.scale-200.png diff --git a/windows/UWP/Assets/SplashScreen.scale-400.png b/packages/app/windows/UWP/Assets/SplashScreen.scale-400.png similarity index 100% rename from windows/UWP/Assets/SplashScreen.scale-400.png rename to packages/app/windows/UWP/Assets/SplashScreen.scale-400.png diff --git a/windows/UWP/Assets/Square150x150Logo.scale-100.png b/packages/app/windows/UWP/Assets/Square150x150Logo.scale-100.png similarity index 100% rename from windows/UWP/Assets/Square150x150Logo.scale-100.png rename to packages/app/windows/UWP/Assets/Square150x150Logo.scale-100.png diff --git a/windows/UWP/Assets/Square150x150Logo.scale-200.png b/packages/app/windows/UWP/Assets/Square150x150Logo.scale-200.png similarity index 100% rename from windows/UWP/Assets/Square150x150Logo.scale-200.png rename to packages/app/windows/UWP/Assets/Square150x150Logo.scale-200.png diff --git a/windows/UWP/Assets/Square150x150Logo.scale-400.png b/packages/app/windows/UWP/Assets/Square150x150Logo.scale-400.png similarity index 100% rename from windows/UWP/Assets/Square150x150Logo.scale-400.png rename to packages/app/windows/UWP/Assets/Square150x150Logo.scale-400.png diff --git a/windows/UWP/Assets/Square44x44Logo.altform-lightunplated_targetsize-16.png b/packages/app/windows/UWP/Assets/Square44x44Logo.altform-lightunplated_targetsize-16.png similarity index 100% rename from windows/UWP/Assets/Square44x44Logo.altform-lightunplated_targetsize-16.png rename to packages/app/windows/UWP/Assets/Square44x44Logo.altform-lightunplated_targetsize-16.png diff --git a/windows/UWP/Assets/Square44x44Logo.altform-lightunplated_targetsize-256.png b/packages/app/windows/UWP/Assets/Square44x44Logo.altform-lightunplated_targetsize-256.png similarity index 100% rename from windows/UWP/Assets/Square44x44Logo.altform-lightunplated_targetsize-256.png rename to packages/app/windows/UWP/Assets/Square44x44Logo.altform-lightunplated_targetsize-256.png diff --git a/windows/UWP/Assets/Square44x44Logo.altform-lightunplated_targetsize-48.png b/packages/app/windows/UWP/Assets/Square44x44Logo.altform-lightunplated_targetsize-48.png similarity index 100% rename from windows/UWP/Assets/Square44x44Logo.altform-lightunplated_targetsize-48.png rename to packages/app/windows/UWP/Assets/Square44x44Logo.altform-lightunplated_targetsize-48.png diff --git a/windows/UWP/Assets/Square44x44Logo.altform-unplated_targetsize-16.png b/packages/app/windows/UWP/Assets/Square44x44Logo.altform-unplated_targetsize-16.png similarity index 100% rename from windows/UWP/Assets/Square44x44Logo.altform-unplated_targetsize-16.png rename to packages/app/windows/UWP/Assets/Square44x44Logo.altform-unplated_targetsize-16.png diff --git a/windows/UWP/Assets/Square44x44Logo.altform-unplated_targetsize-256.png b/packages/app/windows/UWP/Assets/Square44x44Logo.altform-unplated_targetsize-256.png similarity index 100% rename from windows/UWP/Assets/Square44x44Logo.altform-unplated_targetsize-256.png rename to packages/app/windows/UWP/Assets/Square44x44Logo.altform-unplated_targetsize-256.png diff --git a/windows/UWP/Assets/Square44x44Logo.altform-unplated_targetsize-48.png b/packages/app/windows/UWP/Assets/Square44x44Logo.altform-unplated_targetsize-48.png similarity index 100% rename from windows/UWP/Assets/Square44x44Logo.altform-unplated_targetsize-48.png rename to packages/app/windows/UWP/Assets/Square44x44Logo.altform-unplated_targetsize-48.png diff --git a/windows/UWP/Assets/Square44x44Logo.scale-100.png b/packages/app/windows/UWP/Assets/Square44x44Logo.scale-100.png similarity index 100% rename from windows/UWP/Assets/Square44x44Logo.scale-100.png rename to packages/app/windows/UWP/Assets/Square44x44Logo.scale-100.png diff --git a/windows/UWP/Assets/Square44x44Logo.scale-200.png b/packages/app/windows/UWP/Assets/Square44x44Logo.scale-200.png similarity index 100% rename from windows/UWP/Assets/Square44x44Logo.scale-200.png rename to packages/app/windows/UWP/Assets/Square44x44Logo.scale-200.png diff --git a/windows/UWP/Assets/Square44x44Logo.scale-400.png b/packages/app/windows/UWP/Assets/Square44x44Logo.scale-400.png similarity index 100% rename from windows/UWP/Assets/Square44x44Logo.scale-400.png rename to packages/app/windows/UWP/Assets/Square44x44Logo.scale-400.png diff --git a/windows/UWP/Assets/Square44x44Logo.targetsize-16.png b/packages/app/windows/UWP/Assets/Square44x44Logo.targetsize-16.png similarity index 100% rename from windows/UWP/Assets/Square44x44Logo.targetsize-16.png rename to packages/app/windows/UWP/Assets/Square44x44Logo.targetsize-16.png diff --git a/windows/UWP/Assets/Square44x44Logo.targetsize-256.png b/packages/app/windows/UWP/Assets/Square44x44Logo.targetsize-256.png similarity index 100% rename from windows/UWP/Assets/Square44x44Logo.targetsize-256.png rename to packages/app/windows/UWP/Assets/Square44x44Logo.targetsize-256.png diff --git a/windows/UWP/Assets/Square44x44Logo.targetsize-48.png b/packages/app/windows/UWP/Assets/Square44x44Logo.targetsize-48.png similarity index 100% rename from windows/UWP/Assets/Square44x44Logo.targetsize-48.png rename to packages/app/windows/UWP/Assets/Square44x44Logo.targetsize-48.png diff --git a/windows/UWP/Assets/StoreLogo.scale-100.png b/packages/app/windows/UWP/Assets/StoreLogo.scale-100.png similarity index 100% rename from windows/UWP/Assets/StoreLogo.scale-100.png rename to packages/app/windows/UWP/Assets/StoreLogo.scale-100.png diff --git a/windows/UWP/Assets/StoreLogo.scale-200.png b/packages/app/windows/UWP/Assets/StoreLogo.scale-200.png similarity index 100% rename from windows/UWP/Assets/StoreLogo.scale-200.png rename to packages/app/windows/UWP/Assets/StoreLogo.scale-200.png diff --git a/windows/UWP/Assets/StoreLogo.scale-400.png b/packages/app/windows/UWP/Assets/StoreLogo.scale-400.png similarity index 100% rename from windows/UWP/Assets/StoreLogo.scale-400.png rename to packages/app/windows/UWP/Assets/StoreLogo.scale-400.png diff --git a/windows/UWP/Assets/Wide310x150Logo.scale-200.png b/packages/app/windows/UWP/Assets/Wide310x150Logo.scale-200.png similarity index 100% rename from windows/UWP/Assets/Wide310x150Logo.scale-200.png rename to packages/app/windows/UWP/Assets/Wide310x150Logo.scale-200.png diff --git a/windows/UWP/AutolinkedNativeModules.g.cpp b/packages/app/windows/UWP/AutolinkedNativeModules.g.cpp similarity index 100% rename from windows/UWP/AutolinkedNativeModules.g.cpp rename to packages/app/windows/UWP/AutolinkedNativeModules.g.cpp diff --git a/windows/UWP/AutolinkedNativeModules.g.h b/packages/app/windows/UWP/AutolinkedNativeModules.g.h similarity index 100% rename from windows/UWP/AutolinkedNativeModules.g.h rename to packages/app/windows/UWP/AutolinkedNativeModules.g.h diff --git a/windows/UWP/AutolinkedNativeModules.g.props b/packages/app/windows/UWP/AutolinkedNativeModules.g.props similarity index 100% rename from windows/UWP/AutolinkedNativeModules.g.props rename to packages/app/windows/UWP/AutolinkedNativeModules.g.props diff --git a/windows/UWP/AutolinkedNativeModules.g.targets b/packages/app/windows/UWP/AutolinkedNativeModules.g.targets similarity index 100% rename from windows/UWP/AutolinkedNativeModules.g.targets rename to packages/app/windows/UWP/AutolinkedNativeModules.g.targets diff --git a/windows/UWP/MainPage.cpp b/packages/app/windows/UWP/MainPage.cpp similarity index 100% rename from windows/UWP/MainPage.cpp rename to packages/app/windows/UWP/MainPage.cpp diff --git a/windows/UWP/MainPage.h b/packages/app/windows/UWP/MainPage.h similarity index 100% rename from windows/UWP/MainPage.h rename to packages/app/windows/UWP/MainPage.h diff --git a/windows/UWP/MainPage.idl b/packages/app/windows/UWP/MainPage.idl similarity index 100% rename from windows/UWP/MainPage.idl rename to packages/app/windows/UWP/MainPage.idl diff --git a/windows/UWP/MainPage.xaml b/packages/app/windows/UWP/MainPage.xaml similarity index 100% rename from windows/UWP/MainPage.xaml rename to packages/app/windows/UWP/MainPage.xaml diff --git a/windows/UWP/Package.appxmanifest b/packages/app/windows/UWP/Package.appxmanifest similarity index 100% rename from windows/UWP/Package.appxmanifest rename to packages/app/windows/UWP/Package.appxmanifest diff --git a/windows/UWP/PropertySheet.props b/packages/app/windows/UWP/PropertySheet.props similarity index 100% rename from windows/UWP/PropertySheet.props rename to packages/app/windows/UWP/PropertySheet.props diff --git a/windows/UWP/ReactTestApp.vcxproj b/packages/app/windows/UWP/ReactTestApp.vcxproj similarity index 100% rename from windows/UWP/ReactTestApp.vcxproj rename to packages/app/windows/UWP/ReactTestApp.vcxproj diff --git a/windows/UWP/ReactTestApp.vcxproj.filters b/packages/app/windows/UWP/ReactTestApp.vcxproj.filters similarity index 100% rename from windows/UWP/ReactTestApp.vcxproj.filters rename to packages/app/windows/UWP/ReactTestApp.vcxproj.filters diff --git a/windows/UWP/pch.cpp b/packages/app/windows/UWP/pch.cpp similarity index 100% rename from windows/UWP/pch.cpp rename to packages/app/windows/UWP/pch.cpp diff --git a/windows/UWP/pch.h b/packages/app/windows/UWP/pch.h similarity index 100% rename from windows/UWP/pch.h rename to packages/app/windows/UWP/pch.h diff --git a/windows/Win32/AutolinkedNativeModules.g.cpp b/packages/app/windows/Win32/AutolinkedNativeModules.g.cpp similarity index 100% rename from windows/Win32/AutolinkedNativeModules.g.cpp rename to packages/app/windows/Win32/AutolinkedNativeModules.g.cpp diff --git a/windows/Win32/AutolinkedNativeModules.g.h b/packages/app/windows/Win32/AutolinkedNativeModules.g.h similarity index 100% rename from windows/Win32/AutolinkedNativeModules.g.h rename to packages/app/windows/Win32/AutolinkedNativeModules.g.h diff --git a/windows/Win32/Images/SplashScreen.scale-100.png b/packages/app/windows/Win32/Images/SplashScreen.scale-100.png similarity index 100% rename from windows/Win32/Images/SplashScreen.scale-100.png rename to packages/app/windows/Win32/Images/SplashScreen.scale-100.png diff --git a/windows/Win32/Images/SplashScreen.scale-200.png b/packages/app/windows/Win32/Images/SplashScreen.scale-200.png similarity index 100% rename from windows/Win32/Images/SplashScreen.scale-200.png rename to packages/app/windows/Win32/Images/SplashScreen.scale-200.png diff --git a/windows/Win32/Images/SplashScreen.scale-400.png b/packages/app/windows/Win32/Images/SplashScreen.scale-400.png similarity index 100% rename from windows/Win32/Images/SplashScreen.scale-400.png rename to packages/app/windows/Win32/Images/SplashScreen.scale-400.png diff --git a/windows/Win32/Images/Square150x150Logo.scale-100.png b/packages/app/windows/Win32/Images/Square150x150Logo.scale-100.png similarity index 100% rename from windows/Win32/Images/Square150x150Logo.scale-100.png rename to packages/app/windows/Win32/Images/Square150x150Logo.scale-100.png diff --git a/windows/Win32/Images/Square150x150Logo.scale-200.png b/packages/app/windows/Win32/Images/Square150x150Logo.scale-200.png similarity index 100% rename from windows/Win32/Images/Square150x150Logo.scale-200.png rename to packages/app/windows/Win32/Images/Square150x150Logo.scale-200.png diff --git a/windows/Win32/Images/Square150x150Logo.scale-400.png b/packages/app/windows/Win32/Images/Square150x150Logo.scale-400.png similarity index 100% rename from windows/Win32/Images/Square150x150Logo.scale-400.png rename to packages/app/windows/Win32/Images/Square150x150Logo.scale-400.png diff --git a/windows/Win32/Images/Square44x44Logo.altform-lightunplated_targetsize-16.png b/packages/app/windows/Win32/Images/Square44x44Logo.altform-lightunplated_targetsize-16.png similarity index 100% rename from windows/Win32/Images/Square44x44Logo.altform-lightunplated_targetsize-16.png rename to packages/app/windows/Win32/Images/Square44x44Logo.altform-lightunplated_targetsize-16.png diff --git a/windows/Win32/Images/Square44x44Logo.altform-lightunplated_targetsize-256.png b/packages/app/windows/Win32/Images/Square44x44Logo.altform-lightunplated_targetsize-256.png similarity index 100% rename from windows/Win32/Images/Square44x44Logo.altform-lightunplated_targetsize-256.png rename to packages/app/windows/Win32/Images/Square44x44Logo.altform-lightunplated_targetsize-256.png diff --git a/windows/Win32/Images/Square44x44Logo.altform-lightunplated_targetsize-48.png b/packages/app/windows/Win32/Images/Square44x44Logo.altform-lightunplated_targetsize-48.png similarity index 100% rename from windows/Win32/Images/Square44x44Logo.altform-lightunplated_targetsize-48.png rename to packages/app/windows/Win32/Images/Square44x44Logo.altform-lightunplated_targetsize-48.png diff --git a/windows/Win32/Images/Square44x44Logo.altform-unplated_targetsize-16.png b/packages/app/windows/Win32/Images/Square44x44Logo.altform-unplated_targetsize-16.png similarity index 100% rename from windows/Win32/Images/Square44x44Logo.altform-unplated_targetsize-16.png rename to packages/app/windows/Win32/Images/Square44x44Logo.altform-unplated_targetsize-16.png diff --git a/windows/Win32/Images/Square44x44Logo.altform-unplated_targetsize-256.png b/packages/app/windows/Win32/Images/Square44x44Logo.altform-unplated_targetsize-256.png similarity index 100% rename from windows/Win32/Images/Square44x44Logo.altform-unplated_targetsize-256.png rename to packages/app/windows/Win32/Images/Square44x44Logo.altform-unplated_targetsize-256.png diff --git a/windows/Win32/Images/Square44x44Logo.altform-unplated_targetsize-48.png b/packages/app/windows/Win32/Images/Square44x44Logo.altform-unplated_targetsize-48.png similarity index 100% rename from windows/Win32/Images/Square44x44Logo.altform-unplated_targetsize-48.png rename to packages/app/windows/Win32/Images/Square44x44Logo.altform-unplated_targetsize-48.png diff --git a/windows/Win32/Images/Square44x44Logo.scale-100.png b/packages/app/windows/Win32/Images/Square44x44Logo.scale-100.png similarity index 100% rename from windows/Win32/Images/Square44x44Logo.scale-100.png rename to packages/app/windows/Win32/Images/Square44x44Logo.scale-100.png diff --git a/windows/Win32/Images/Square44x44Logo.scale-200.png b/packages/app/windows/Win32/Images/Square44x44Logo.scale-200.png similarity index 100% rename from windows/Win32/Images/Square44x44Logo.scale-200.png rename to packages/app/windows/Win32/Images/Square44x44Logo.scale-200.png diff --git a/windows/Win32/Images/Square44x44Logo.scale-400.png b/packages/app/windows/Win32/Images/Square44x44Logo.scale-400.png similarity index 100% rename from windows/Win32/Images/Square44x44Logo.scale-400.png rename to packages/app/windows/Win32/Images/Square44x44Logo.scale-400.png diff --git a/windows/Win32/Images/Square44x44Logo.targetsize-16.png b/packages/app/windows/Win32/Images/Square44x44Logo.targetsize-16.png similarity index 100% rename from windows/Win32/Images/Square44x44Logo.targetsize-16.png rename to packages/app/windows/Win32/Images/Square44x44Logo.targetsize-16.png diff --git a/windows/Win32/Images/Square44x44Logo.targetsize-256.png b/packages/app/windows/Win32/Images/Square44x44Logo.targetsize-256.png similarity index 100% rename from windows/Win32/Images/Square44x44Logo.targetsize-256.png rename to packages/app/windows/Win32/Images/Square44x44Logo.targetsize-256.png diff --git a/windows/Win32/Images/Square44x44Logo.targetsize-48.png b/packages/app/windows/Win32/Images/Square44x44Logo.targetsize-48.png similarity index 100% rename from windows/Win32/Images/Square44x44Logo.targetsize-48.png rename to packages/app/windows/Win32/Images/Square44x44Logo.targetsize-48.png diff --git a/windows/Win32/Images/StoreLogo.scale-100.png b/packages/app/windows/Win32/Images/StoreLogo.scale-100.png similarity index 100% rename from windows/Win32/Images/StoreLogo.scale-100.png rename to packages/app/windows/Win32/Images/StoreLogo.scale-100.png diff --git a/windows/Win32/Images/StoreLogo.scale-200.png b/packages/app/windows/Win32/Images/StoreLogo.scale-200.png similarity index 100% rename from windows/Win32/Images/StoreLogo.scale-200.png rename to packages/app/windows/Win32/Images/StoreLogo.scale-200.png diff --git a/windows/Win32/Images/StoreLogo.scale-400.png b/packages/app/windows/Win32/Images/StoreLogo.scale-400.png similarity index 100% rename from windows/Win32/Images/StoreLogo.scale-400.png rename to packages/app/windows/Win32/Images/StoreLogo.scale-400.png diff --git a/windows/Win32/Images/Wide310x150Logo.scale-200.png b/packages/app/windows/Win32/Images/Wide310x150Logo.scale-200.png similarity index 100% rename from windows/Win32/Images/Wide310x150Logo.scale-200.png rename to packages/app/windows/Win32/Images/Wide310x150Logo.scale-200.png diff --git a/windows/Win32/Main.cpp b/packages/app/windows/Win32/Main.cpp similarity index 100% rename from windows/Win32/Main.cpp rename to packages/app/windows/Win32/Main.cpp diff --git a/windows/Win32/Main.h b/packages/app/windows/Win32/Main.h similarity index 100% rename from windows/Win32/Main.h rename to packages/app/windows/Win32/Main.h diff --git a/windows/Win32/Main.ico b/packages/app/windows/Win32/Main.ico similarity index 100% rename from windows/Win32/Main.ico rename to packages/app/windows/Win32/Main.ico diff --git a/windows/Win32/Main.rc b/packages/app/windows/Win32/Main.rc similarity index 100% rename from windows/Win32/Main.rc rename to packages/app/windows/Win32/Main.rc diff --git a/windows/Win32/Main.small.ico b/packages/app/windows/Win32/Main.small.ico similarity index 100% rename from windows/Win32/Main.small.ico rename to packages/app/windows/Win32/Main.small.ico diff --git a/windows/Win32/Package.appxmanifest b/packages/app/windows/Win32/Package.appxmanifest similarity index 100% rename from windows/Win32/Package.appxmanifest rename to packages/app/windows/Win32/Package.appxmanifest diff --git a/windows/Win32/ReactApp.Package.wapproj b/packages/app/windows/Win32/ReactApp.Package.wapproj similarity index 100% rename from windows/Win32/ReactApp.Package.wapproj rename to packages/app/windows/Win32/ReactApp.Package.wapproj diff --git a/windows/Win32/ReactApp.vcxproj b/packages/app/windows/Win32/ReactApp.vcxproj similarity index 100% rename from windows/Win32/ReactApp.vcxproj rename to packages/app/windows/Win32/ReactApp.vcxproj diff --git a/windows/Win32/ReactApp.vcxproj.filters b/packages/app/windows/Win32/ReactApp.vcxproj.filters similarity index 100% rename from windows/Win32/ReactApp.vcxproj.filters rename to packages/app/windows/Win32/ReactApp.vcxproj.filters diff --git a/windows/Win32/pch.cpp b/packages/app/windows/Win32/pch.cpp similarity index 100% rename from windows/Win32/pch.cpp rename to packages/app/windows/Win32/pch.cpp diff --git a/windows/Win32/pch.h b/packages/app/windows/Win32/pch.h similarity index 100% rename from windows/Win32/pch.h rename to packages/app/windows/Win32/pch.h diff --git a/windows/Win32/resource.h b/packages/app/windows/Win32/resource.h similarity index 100% rename from windows/Win32/resource.h rename to packages/app/windows/Win32/resource.h diff --git a/windows/Win32/targetver.h b/packages/app/windows/Win32/targetver.h similarity index 100% rename from windows/Win32/targetver.h rename to packages/app/windows/Win32/targetver.h diff --git a/windows/app.mjs b/packages/app/windows/app.mjs similarity index 97% rename from windows/app.mjs rename to packages/app/windows/app.mjs index 85d21096b..65344dc26 100755 --- a/windows/app.mjs +++ b/packages/app/windows/app.mjs @@ -9,7 +9,6 @@ import { isMain, readTextFile, requireTransitive, - v, writeTextFile, } from "../scripts/helpers.js"; import * as colors from "../scripts/utils/colors.mjs"; @@ -204,7 +203,7 @@ export async function generateSolution(destPath, options, fs = nodefs) { /** @type {typeof import("mustache")} */ const mustache = requireTransitive( ["@react-native-windows/cli", "mustache"], - rnWindowsPath + fs.realpathSync(rnWindowsPath) ); const slnPath = path.join(destPath, `${info.bundle.appName}.sln`); const vcxprojPath = path.join(projectFilesDestPath, projectFileName); @@ -256,7 +255,7 @@ export async function generateSolution(destPath, options, fs = nodefs) { console.log(colors.cyan(colors.bold("info")), `'${props}' already exists`); } else { const { msbuildprops, useHermes } = options; - const { useExperimentalNuGet, useFabric, versionNumber } = info; + const { useExperimentalNuGet, useFabric } = info; const url = new URL(experimentalFeaturesPropsFilename, import.meta.url); await copyAndReplaceAsync( fileURLToPath(url), @@ -264,7 +263,7 @@ export async function generateSolution(destPath, options, fs = nodefs) { { "false": `${useFabric}`, "false": `${useFabric}`, - "true": `${useHermes == null ? versionNumber >= v(0, 73, 0) : useHermes}`, + "true": `${useHermes !== false}`, "false": `${useFabric}`, "false": `${useExperimentalNuGet}`, "": msbuildprops ?? "", @@ -355,12 +354,12 @@ if (isMain(import.meta.url)) { type: "string", }, "use-fabric": { - description: "Use New Architecture [experimental] (supported on 0.73+)", + description: "Use New Architecture [experimental]", type: "boolean", }, "use-hermes": { description: - "Use Hermes instead of Chakra as the JS engine (enabled by default on 0.73+)", + "Use Hermes instead of Chakra as the JS engine (enabled by default)", type: "boolean", }, "use-nuget": { diff --git a/windows/project.mjs b/packages/app/windows/project.mjs similarity index 98% rename from windows/project.mjs rename to packages/app/windows/project.mjs index d1ab54f5f..c2931b9b5 100644 --- a/windows/project.mjs +++ b/packages/app/windows/project.mjs @@ -12,7 +12,6 @@ import { readJSONFile, readTextFile, toVersionNumber, - v, } from "../scripts/helpers.js"; import * as colors from "../scripts/utils/colors.mjs"; @@ -414,12 +413,7 @@ export async function projectInfo( ) { const version = getPackageVersion("react-native-windows", rnWindowsPath, fs); const versionNumber = toVersionNumber(version); - - const newArch = - Boolean(useFabric) && (versionNumber === 0 || versionNumber >= v(0, 74, 0)); - if (useFabric && !newArch) { - warn("New Architecture requires `react-native-windows` 0.74+"); - } + const newArch = Boolean(useFabric); return { version, diff --git a/windows/uwp.mjs b/packages/app/windows/uwp.mjs similarity index 100% rename from windows/uwp.mjs rename to packages/app/windows/uwp.mjs diff --git a/windows/win32.mjs b/packages/app/windows/win32.mjs similarity index 100% rename from windows/win32.mjs rename to packages/app/windows/win32.mjs diff --git a/packages/null/index.js b/packages/null/index.js new file mode 100644 index 000000000..f053ebf79 --- /dev/null +++ b/packages/null/index.js @@ -0,0 +1 @@ +module.exports = {}; diff --git a/packages/null/package.json b/packages/null/package.json new file mode 100644 index 000000000..74bad803f --- /dev/null +++ b/packages/null/package.json @@ -0,0 +1,21 @@ +{ + "private": true, + "name": "@microsoft/null", + "version": "0.0.1-dev", + "description": "Meta package for preventing packages from being installed", + "homepage": "https://github.com/microsoft/react-native-test-app", + "license": "MIT", + "author": { + "name": "Microsoft Open Source", + "email": "microsoftopensource@users.noreply.github.com" + }, + "files": [ + "index.js" + ], + "main": "index.js", + "repository": { + "type": "git", + "url": "https://github.com/microsoft/react-native-test-app.git", + "directory": "packages/null" + } +} diff --git a/scripts/build/affected.mts b/scripts/affected.mts similarity index 100% rename from scripts/build/affected.mts rename to scripts/affected.mts diff --git a/scripts/build/clang-format-diff.sh b/scripts/clang-format-diff.sh similarity index 57% rename from scripts/build/clang-format-diff.sh rename to scripts/clang-format-diff.sh index 515074013..b0564b1f7 100755 --- a/scripts/build/clang-format-diff.sh +++ b/scripts/clang-format-diff.sh @@ -3,8 +3,8 @@ set -eo pipefail if [[ -z $DEBUG ]]; then brew install clang-format - curl --silent --show-error --remote-name https://raw.githubusercontent.com/llvm/llvm-project/release/18.x/clang/tools/clang-format/clang-format-diff.py + curl --silent --show-error --remote-name https://raw.githubusercontent.com/llvm/llvm-project/release/21.x/clang/tools/clang-format/clang-format-diff.py fi git diff --unified=0 --no-color @^ \ - | python clang-format-diff.py -p1 -regex '.*\.(cpp|cc|c\+\+|cxx|c|cl|h|hh|hpp|m|mm|inc)' -sort-includes \ + | python3 clang-format-diff.py -p1 -regex '.*\.(cpp|cc|c\+\+|cxx|c|cl|h|hh|hpp|m|mm|inc)' -sort-includes \ | npx suggestion-bot diff --git a/scripts/build/copy-yarnrc.mjs b/scripts/copy-yarnrc.mjs similarity index 67% rename from scripts/build/copy-yarnrc.mjs rename to scripts/copy-yarnrc.mjs index e60e83a1a..ed0ffed71 100644 --- a/scripts/build/copy-yarnrc.mjs +++ b/scripts/copy-yarnrc.mjs @@ -16,13 +16,16 @@ function main(src, dst) { }); const yml = fs.readFileSync(src, { encoding: "utf-8" }); - const rc = /** @type {Record} */ (yaml.load(yml)); + const rc = /** @type {Record} */ (yaml.load(yml)); rc["nmHoistingLimits"] = undefined; - rc["plugins"] = undefined; + rc["plugins"] = []; + if (rc.globalFolder) { + rc["globalFolder"] = path.join(path.dirname(src), rc.globalFolder.toString()); + } if (rc.yarnPath) { - rc["yarnPath"] = path.join(path.dirname(src), rc.yarnPath); + rc["yarnPath"] = path.join(path.dirname(src), rc.yarnPath.toString()); } fs.writeFileSync(dst, yaml.dump(rc)); diff --git a/scripts/build/install-test-template.sh b/scripts/install-test-template.sh similarity index 65% rename from scripts/build/install-test-template.sh rename to scripts/install-test-template.sh index f446db3df..7b5d55eaf 100755 --- a/scripts/build/install-test-template.sh +++ b/scripts/install-test-template.sh @@ -6,6 +6,7 @@ platforms=(all android ios macos visionos windows) version=$(node --print 'require("./package.json").version') tarball=react-native-test-app-$version.$(git rev-parse --short HEAD).tgz +current_dir="$(pwd)" script_dir="$(cd -P "$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")" >/dev/null 2>&1 && pwd)" function print_usage { @@ -35,24 +36,30 @@ while true; do done # Use tarballs to ensure that published packages are consumable +pushd "$script_dir/../packages/app" 1> /dev/null npm pack mv react-native-test-app-$version.tgz $tarball +popd 1> /dev/null yarn + +v=$(cat packages/app/example/package.json | jq '.dependencies["react-native"]' | grep -o -E '[0-9]+\.[0-9]+') if [[ "$platform" == "all" ]]; then - yarn init-test-app \ - --destination template-example \ - --name TemplateExample \ - --platform android \ - --platform ios \ - --platform macos \ - --platform visionos \ - --platform windows + node packages/app/scripts/init.mjs \ + --destination template-example \ + --name TemplateExample \ + --platform android \ + --platform ios \ + --platform macos \ + --platform visionos \ + --platform windows \ + --version $v else - yarn init-test-app \ - --destination template-example \ - --name TemplateExample \ - --platform "$platform" + node packages/app/scripts/init.mjs \ + --destination template-example \ + --name TemplateExample \ + --platform "$platform" \ + --version $v fi pushd template-example 1> /dev/null @@ -65,7 +72,7 @@ else touch yarn.lock fi -script="s/\"react-native-test-app\": \".*\"/\"react-native-test-app\": \"..\/$tarball\"/" +script="s/\"react-native-test-app\": \".*\"/\"react-native-test-app\": \"..\/packages\/app\/$tarball\"/" if sed --version &> /dev/null; then sed -i'' "$script" package.json else diff --git a/scripts/testing/react-native.mts b/scripts/react-native.mts similarity index 100% rename from scripts/testing/react-native.mts rename to scripts/react-native.mts diff --git a/scripts/build/xcodebuild.sh b/scripts/xcodebuild.sh similarity index 100% rename from scripts/build/xcodebuild.sh rename to scripts/xcodebuild.sh diff --git a/yarn.lock b/yarn.lock index b95339629..d59cfa56b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -64,9 +64,9 @@ __metadata: languageName: node linkType: hard -"@appium/docutils@link:./example::locator=react-native-test-app%40workspace%3A.": +"@appium/docutils@link:./packages/null::locator=%40microsoft%2Froot%40workspace%3A.": version: 0.0.0-use.local - resolution: "@appium/docutils@link:./example::locator=react-native-test-app%40workspace%3A." + resolution: "@appium/docutils@link:./packages/null::locator=%40microsoft%2Froot%40workspace%3A." languageName: node linkType: soft @@ -2724,6 +2724,23 @@ __metadata: languageName: node linkType: hard +"@microsoft/root@workspace:.": + version: 0.0.0-use.local + resolution: "@microsoft/root@workspace:." + dependencies: + "@nx/js": "npm:^21.0.0" + "@rnx-kit/lint-lockfile": "npm:^0.1.0" + "@types/js-yaml": "npm:^4.0.5" + "@types/node": "npm:^22.0.0" + js-yaml: "npm:^4.1.0" + minimatch: "npm:^9.0.0" + nx: "npm:^21.0.0" + prettier: "npm:^3.0.0" + prettier-plugin-organize-imports: "npm:^4.1.0" + typescript: "npm:^5.0.0" + languageName: unknown + linkType: soft + "@napi-rs/wasm-runtime@npm:0.2.4": version: 0.2.4 resolution: "@napi-rs/wasm-runtime@npm:0.2.4" @@ -3330,7 +3347,7 @@ __metadata: languageName: node linkType: hard -"@react-native-community/cli-types@npm:15.1.3": +"@react-native-community/cli-types@npm:15.1.3, @react-native-community/cli-types@npm:^15.0.1": version: 15.1.3 resolution: "@react-native-community/cli-types@npm:15.1.3" dependencies: @@ -4736,7 +4753,7 @@ __metadata: languageName: node linkType: hard -"@wdio/types@npm:9.16.2": +"@wdio/types@npm:9.16.2, @wdio/types@npm:^9.16.0": version: 9.16.2 resolution: "@wdio/types@npm:9.16.2" dependencies: @@ -7880,9 +7897,9 @@ __metadata: languageName: node linkType: hard -"example@workspace:example": +"example@workspace:packages/app/example": version: 0.0.0-use.local - resolution: "example@workspace:example" + resolution: "example@workspace:packages/app/example" dependencies: "@babel/core": "npm:^7.20.0" "@babel/preset-env": "npm:^7.20.0" @@ -12411,19 +12428,19 @@ __metadata: languageName: node linkType: hard -"react-native-test-app@workspace:*, react-native-test-app@workspace:.": +"react-native-test-app@workspace:*, react-native-test-app@workspace:packages/app": version: 0.0.0-use.local - resolution: "react-native-test-app@workspace:." + resolution: "react-native-test-app@workspace:packages/app" dependencies: "@babel/core": "npm:^7.20.0" "@babel/preset-env": "npm:^7.20.0" "@expo/config-plugins": "npm:^10.0.0" + "@expo/json-file": "npm:~9.1.5" "@microsoft/eslint-plugin-sdl": "npm:^1.0.0" - "@nx/js": "npm:^21.0.0" "@react-native-community/cli": "npm:^15.0.1" + "@react-native-community/cli-types": "npm:^15.0.1" "@react-native-community/template": "npm:^0.78.0" "@rnx-kit/eslint-plugin": "npm:^0.8.0" - "@rnx-kit/lint-lockfile": "npm:^0.1.0" "@rnx-kit/react-native-host": "npm:^0.5.11" "@rnx-kit/tools-react-native": "npm:^2.1.0" "@rnx-kit/tsconfig": "npm:^2.0.0" @@ -12434,6 +12451,7 @@ __metadata: "@types/node": "npm:^22.0.0" "@types/prompts": "npm:~2.4.0" "@types/semver": "npm:^7.3.6" + "@wdio/types": "npm:^9.16.0" ajv: "npm:^8.0.0" cliui: "npm:^8.0.0" eslint: "npm:^9.12.0" @@ -12441,8 +12459,6 @@ __metadata: fast-xml-parser: "npm:^4.0.0" js-yaml: "npm:^4.1.0" memfs: "npm:^4.0.0" - minimatch: "npm:^9.0.0" - nx: "npm:^21.0.0" prettier: "npm:^3.0.0" prettier-plugin-organize-imports: "npm:^4.1.0" prompts: "npm:^2.4.0" @@ -12455,12 +12471,12 @@ __metadata: typescript: "npm:^5.0.0" uuid: "npm:^11.0.0" peerDependencies: - "@callstack/react-native-visionos": 0.73 - 0.79 + "@callstack/react-native-visionos": 0.76 - 0.79 "@expo/config-plugins": ">=5.0" - react: 18.1 - 19.1 - react-native: 0.70 - 0.81 || >=0.82.0-0 <0.82.0 - react-native-macos: ^0.0.0-0 || 0.71 - 0.79 - react-native-windows: ^0.0.0-0 || 0.70 - 0.79 + react: 18.2 - 19.1 + react-native: 0.76 - 0.82 || >=0.83.0-0 <0.83.0 + react-native-macos: ^0.0.0-0 || 0.76 - 0.79 + react-native-windows: ^0.0.0-0 || 0.76 - 0.79 peerDependenciesMeta: "@callstack/react-native-visionos": optional: true