diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 07e44d52..50dccd4a 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -222,7 +222,8 @@ jobs: run: npx react-native bundle --entry-file index.js --platform macos --dev false --minify false --bundle-output dist/main.macos.jsbundle --assets-dest dist/res working-directory: apps/macos-test-app - name: Build test app - run: xcodebuild archive -workspace MacOSTestApp.xcworkspace -configuration Release -scheme MacOSTestApp-macOS -destination generic/platform="macOS" -archivePath ./build/macos-test-app.xcarchive | xcbeautify + # pipefail so an xcodebuild failure is not masked by xcbeautify's exit code + run: set -o pipefail && xcodebuild archive -workspace MacOSTestApp.xcworkspace -configuration Release -scheme MacOSTestApp-macOS -destination generic/platform="macOS" -archivePath ./build/macos-test-app.xcarchive | xcbeautify working-directory: apps/macos-test-app/macos - name: Run test app run: npx mocha-remote --exit-on-error -- macos/build/macos-test-app.xcarchive/Products/Applications/MacOSTestApp.app/Contents/MacOS/MacOSTestApp diff --git a/apps/test-app/metro.config.js b/apps/test-app/metro.config.js index 395431b6..bea1a4e0 100644 --- a/apps/test-app/metro.config.js +++ b/apps/test-app/metro.config.js @@ -17,6 +17,15 @@ if (config.projectRoot.endsWith("macos-test-app")) { // duplicate react-native version and pollution of the package lock. const path = require("node:path"); config.watchFolders.push(path.resolve(__dirname, "../..")); + + // Resolve workspace packages (and the specifiers the babel plugin rewrites + // their `*.node` requires to) from this app's own node_modules, independent of + // the root package manager's hoisting layout. + config.resolver = config.resolver || {}; + config.resolver.nodeModulesPaths = [ + ...(config.resolver.nodeModulesPaths || []), + path.resolve(__dirname, "node_modules"), + ]; } module.exports = config; diff --git a/scripts/init-macos-test-app.ts b/scripts/init-macos-test-app.ts index 84708634..bf3d962c 100644 --- a/scripts/init-macos-test-app.ts +++ b/scripts/init-macos-test-app.ts @@ -4,8 +4,10 @@ import fs from "node:fs"; import path from "node:path"; import { readPackage } from "read-pkg"; -const REACT_NATIVE_VERSION = "0.81.5"; -const REACT_NATIVE_MACOS_VERSION = "0.81.1"; +// react-native-macos peer-pins an exact react-native core version +// (react-native-macos 0.81.8 -> react-native 0.81.6); keep these two in lockstep. +const REACT_NATIVE_VERSION = "0.81.6"; +const REACT_NATIVE_MACOS_VERSION = "0.81.8"; const REACT_VERSION = "^19.1.4"; const ROOT_PATH = path.join(import.meta.dirname, ".."); @@ -88,6 +90,8 @@ async function patchPackageJson() { const transferredDependencies = new Set([ "@rnx-kit/metro-config", + // Needed by mocha-remote-server at runtime (not hoisted for this standalone app). + "mocha", "mocha-remote-cli", "mocha-remote-react-native", ]);