Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .github/actions/setup-react-native/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ runs:
- name: Set up react-native@${{ inputs.version }}
run: |
rm example/ios/Podfile.lock
rm example/macos/Podfile.lock
rm example/visionos/Podfile.lock
node --run set-react-version -- ${{ inputs.version }}
shell: bash
working-directory: packages/app
36 changes: 20 additions & 16 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ jobs:
yarn dedupe --check
- name: Install npm dependencies
uses: ./.github/actions/yarn
- name: Lint dependencies
run: |
yarn rnx-align-deps
- name: Lint lockfile
run: |
yarn lint-lockfile
Expand Down Expand Up @@ -358,7 +361,7 @@ jobs:
uses: ./.github/actions/setup-toolchain
with:
platform: macos
project-root: packages/app/example
project-root: packages/example-macos
cache-key-prefix: example
xcode-developer-dir: /Applications/Xcode_16.4.app/Contents/Developer
- name: Set up react-native@canary
Expand All @@ -373,7 +376,7 @@ jobs:
- name: Bundle JavaScript
run: |
yarn build:macos
working-directory: packages/app/example
working-directory: packages/example-macos
- name: Determine whether the macOS app needs to be built
id: affected
uses: ./.github/actions/affected
Expand All @@ -382,22 +385,22 @@ jobs:
uses: ./.github/actions/cocoapods
with:
project-directory: macos
working-directory: packages/app/example
working-directory: packages/example-macos
- name: Build
if: ${{ steps.affected.outputs.macos != '' }}
run: |
../../../scripts/xcodebuild.sh macos/Example.xcworkspace build-for-testing
working-directory: packages/app/example
../../scripts/xcodebuild.sh macos/Example.xcworkspace build-for-testing
working-directory: packages/example-macos
- name: Test `react-native config`
if: ${{ steps.affected.outputs.macos != '' }}
run: |
node --test test/config.test.mjs
working-directory: packages/app/example
working-directory: packages/example-macos
- name: Test
if: ${{ steps.affected.outputs.macos != '' && github.event_name != 'schedule' }}
run: |
../../../scripts/xcodebuild.sh macos/Example.xcworkspace test-without-building
working-directory: packages/app/example
../../scripts/xcodebuild.sh macos/Example.xcworkspace test-without-building
working-directory: packages/example-macos
timeout-minutes: 60
macos-template:
name: "macOS [template]"
Expand Down Expand Up @@ -571,14 +574,15 @@ jobs:
- name: Bundle JavaScript
run: |
yarn build:windows
working-directory: packages/example-windows
- name: Generate Visual Studio solution
run: |
node ../windows/app.mjs --msbuildprops WindowsTargetPlatformVersion=$env:WindowsTargetPlatformVersion
working-directory: packages/app/example
node ../app/windows/app.mjs --msbuildprops WindowsTargetPlatformVersion=$env:WindowsTargetPlatformVersion
working-directory: packages/example-windows
- name: Test `react-native config`
run: |
node --test test/config.test.mjs
working-directory: packages/app/example
working-directory: packages/example-windows
- name: Determine whether the Windows app needs to be built
id: affected
uses: ./.github/actions/affected
Expand All @@ -591,7 +595,7 @@ jobs:
} else {
yarn ci:windows --arch ${{ matrix.platform }}
}
working-directory: packages/app/example
working-directory: packages/example-windows
continue-on-error: true
# GitHub Actions currently does not support outputs from jobs with matrices
# The workaround is to upload artifacts to communicate between jobs
Expand All @@ -617,15 +621,15 @@ jobs:
uses: actions/upload-artifact@v7
with:
name: windows-msbuild.binlog
path: packages/app/example/windows/*.binlog
path: packages/example-windows/windows/*.binlog
retention-days: 14
overwrite: true
- name: Test
if: ${{ steps.affected.outputs.windows != '' && matrix.platform == 'x64' && steps.build.outcome == 'success' }}
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: packages/app/example/windows/ReactAppTests
../../../app/scripts/build/MSBuild.ps1 -Configuration ${{ matrix.configuration }} -Platform ${{ matrix.platform }} -Target Build ReactAppTests.vcxproj
../../../app/scripts/build/VSTest.ps1 ${{ matrix.platform }}\${{ matrix.configuration }}\ReactAppTests.dll
working-directory: packages/example-windows/windows/ReactAppTests
timeout-minutes: 60
windows-template:
name: "Windows [template]"
Expand Down
12 changes: 7 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
*.binlog
*.iml
*.log
*.tgz
Expand All @@ -17,18 +18,19 @@
!.yarn/patches/
!.yarn/plugins/
!.yarn/releases/
Pods/
clang-format-diff.py
coverage/
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
packages/example-*/*/.xcode.env
packages/example-*/*/DerivedData/
packages/example-*/*/Pods/
packages/example-*/*/build/
packages/example-*/dist/*
!packages/example-*/dist/.gitignore
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
template-example/
xcuserdata/
Expand Down
7 changes: 7 additions & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
catalog:
"@babel/core": ^7.25.2
"@babel/preset-env": ^7.25.3
"@rnx-kit/cli": ^1.0.0
"@rnx-kit/metro-config": ^2.2.3
"@rnx-kit/polyfills": ^0.2.0
"@rnx-kit/tsconfig": ^3.0.1
compressionLevel: 0
enableGlobalCache: false
enableScripts: false
Expand Down
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
"workspaces": [
".",
"packages/app",
"packages/app/example"
"packages/app/example",
"packages/example-*"
],
"scripts": {
"format": "nx run-many --target format:c,format:js,format:swift",
Expand All @@ -24,10 +25,12 @@
"lint:commit": "git log --format='%s' origin/trunk..HEAD | tail -1 | npx @rnx-kit/commitlint-lite@2.0.0",
"lint:js": "oxlint $(git ls-files 'scripts/*.[cm][jt]s' 'scripts/*.[jt]s')",
"release-notes": "node scripts/release-notes.mts",
"rnx-align-deps": "rnx-align-deps --exclude-packages @microsoft/root,react-native-test-app",
"show-affected": "node scripts/affected.mts"
},
"devDependencies": {
"@nx/js": "^22.0.0",
"@rnx-kit/align-deps": "^3.4.5",
"@rnx-kit/lint-lockfile": "^0.1.0",
"@rnx-kit/oxlint-config": "^1.0.3",
"@swc-node/register": "^1.11.1",
Expand Down
12 changes: 9 additions & 3 deletions packages/app/example/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,17 @@
.gradle/
.idea/
.vs/
.watchman-*
.xcode.env
Pods/
build/
android/app/
android/build/
dist/*
!dist/.gitignore
ios/DerivedData/
ios/Pods/
ios/build/
local.properties
msbuild.binlog
macos/DerivedData/
macos/Pods/
macos/build/
node_modules/
35 changes: 7 additions & 28 deletions packages/app/example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@
},
"dependencies": {
"@react-native-webapis/web-storage": "^0.4.5",
"react": "19.1.0",
"react-native": "^0.81.0",
"react-native-macos": "^0.81.1",
"react-native-safe-area-context": "^5.5.2",
"react": "19.1.4",
"react-native": "^0.81.6",
"react-native-macos": "^0.81.0",
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Curious as to why not a later version of react-native-macos? I thought 81.0 was still on a different version of react as well.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The down-leveling was because of align-deps, but you can see in yarn.lock that it resolved to a later version. It doesn't really make a difference.

"react-native-safe-area-context": "^5.6.0",
"react-native-windows": "^0.81.0"
},
"devDependencies": {
Expand Down Expand Up @@ -85,38 +85,17 @@
}
}
],
"alignDeps//disabled": {
"//": "This configuration is only used for Viewfinder",
"alignDeps": {
"requirements": [
"react-native@0.79"
"react-native@0.81"
],
"capabilities": [
"core-android",
"core-ios",
"core-macos",
"core-windows",
"animation",
"babel-preset-react-native",
"checkbox",
"clipboard",
"datetime-picker",
"filesystem",
"floating-action",
"gestures",
"html",
"masked-view",
"modal",
"navigation/native",
"navigation/stack",
"netinfo",
"popover",
"safe-area",
"screens",
"shimmer",
"sqlite",
"storage",
"svg",
"webview"
"safe-area"
]
}
}
Expand Down
48 changes: 40 additions & 8 deletions packages/app/example/test/config.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,23 @@ import * as path from "node:path";
import { after, before, test } from "node:test";
import { URL, fileURLToPath } from "node:url";

async function getLoadConfig() {
/**
* @param {string} cwd
*/
async function getLoadConfig(cwd) {
try {
// @ts-expect-error `loadConfig` was not exported until 7.0.
return await import("@react-native-community/cli/build/tools/config");
const config = import.meta.resolve(
"@react-native-community/cli/build/tools/config",
cwd
);
return await import(config);
} catch (_) {
// `loadConfig` was made public in 7.0:
// https://github.com/react-native-community/cli/pull/1464
const { default: cli } = await import("@react-native-community/cli");
const rncCli = import.meta.resolve("@react-native-community/cli", cwd);
const { default: cli } = await import(rncCli);
return cli.loadConfig.length === 1
? // @ts-ignore The signature change of `loadConfig` was introduced in 14.0
() => cli.loadConfig({}) // >=14.0
? () => cli.loadConfig({}) // >=14.0
: cli.loadConfig; // <14.0
}
}
Expand All @@ -29,9 +35,9 @@ function regexp(p) {
}

test("react-native config", async (t) => {
const loadConfig = await getLoadConfig();

const currentDir = process.cwd();
const loadConfig = await getLoadConfig(currentDir);

const projectRoot = path.sep + path.join("packages", "app");
const exampleRoot = path.join(projectRoot, "example");
const reactNativePath = path.join(
Expand Down Expand Up @@ -90,6 +96,32 @@ test("react-native config", async (t) => {
}
);

await t.test(
"contains macOS config",
{ skip: process.platform === "win32" },
() => {
const sourceDir = path.join(exampleRoot, "macos");
const config = loadConfig();

equal(typeof config, "object");
match(config.root, regexp(exampleRoot));
match(config.reactNativePath, regexp(reactNativePath));
equal(
config.dependencies["react-native-test-app"].name,
"react-native-test-app"
);
notEqual(config.platforms.macos, undefined);
match(config.project.macos.sourceDir, regexp(sourceDir));

if (fs.existsSync("macos/Pods")) {
equal(config.project.macos.xcodeProject.name, "Example.xcworkspace");
ok(config.project.macos.xcodeProject.isWorkspace);
} else {
equal(config.project.macos.xcodeProject, null);
}
}
);

await t.test(
"contains Windows config",
{ skip: process.platform !== "win32" },
Expand Down
6 changes: 3 additions & 3 deletions packages/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,9 @@
"minimatch": "^10.0.0",
"oxfmt": "^0.41.0",
"oxlint": "^1.51.0",
"react": "19.1.0",
"react-native": "^0.81.0",
"react-native-macos": "^0.81.1",
"react": "19.1.4",
"react-native": "^0.81.6",
"react-native-macos": "^0.81.0",
"react-native-windows": "^0.81.0",
"suggestion-bot": "^4.0.0"
},
Expand Down
1 change: 1 addition & 0 deletions packages/example-macos/.watchmanconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
23 changes: 23 additions & 0 deletions packages/example-macos/android/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
buildscript {
apply(from: {
def searchDir = rootDir.toPath()
do {
def p = searchDir.resolve("node_modules/react-native-test-app/android/dependencies.gradle")
if (p.toFile().exists()) {
return p.toRealPath().toString()
}
} while (searchDir = searchDir.getParent())
throw new GradleException("Could not find `react-native-test-app`");
}())

repositories {
mavenCentral()
google()
}

dependencies {
getReactNativeDependencies().each { dependency ->
classpath(dependency)
}
}
}
Loading
Loading