Skip to content

Feat/react native harness support#475

Open
patrickkabwe wants to merge 9 commits into
mainfrom
feat/react-native-harness-support
Open

Feat/react native harness support#475
patrickkabwe wants to merge 9 commits into
mainfrom
feat/react-native-harness-support

Conversation

@patrickkabwe
Copy link
Copy Markdown
Owner

@patrickkabwe patrickkabwe commented Mar 19, 2026

Summary by CodeRabbit

  • New Features

    • CLI option to include React Native Harness; generated example apps can include Harness scaffolding and test scripts for Android/iOS.
  • Documentation

    • README and CLI/usage docs updated with a “With React Native Harness” section and examples across package managers.
  • Chores / CI & Tests

    • CI switched to harness-based Android/iOS jobs; Maestro E2E setup removed; scripts and workflows updated to use iPhone 17.
  • Repository

    • Templates now ignore .harness in .gitignore.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 19, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Adds an optional React Native Harness generation path (CLI flag --include-harness) and monorepo-aware packaging: wires CLI input, generator types, harness code/workflow templates, example app scripts/devDeps, README/docs, and CI workflow changes to run harness tests on Android/iOS.

Changes

React Native Harness and package generation

Layer / File(s) Summary
Type definitions and contracts
src/types.ts
Add includeHarness and monorepo to UserAnswers/CreateModuleOptions; change InstructionsParams to modulePath, add packagePath, monorepo, optional includeHarness, and platforms: SupportedPlatform[].
CLI option registration and input flow
src/cli/index.ts, src/cli/create.ts
Register --include-harness; collect/validate includeHarness and monorepo for CI/interactive flows; disallow --skip-example + --include-harness; compute finalPackageName, targetModulePath, shouldCleanupModulePath; forward includeHarness/platforms and set cwd for NitroModuleFactory.
Instruction text and templates
src/constants.ts
Switch generated instructions to use modulePath and packagePath, and conditionally render platform-specific "Run your React Native Harness tests" steps when includeHarness is true and skipExample is false.
Harness code snippet generators
src/code-snippets/code.js.ts
Add harness snippet exports: harnessConfigCode, harnessJestConfigCode, harnessTestCode, harnessWorkflowCode; implement platform runner/Jest/workflow templates and package-manager helpers; stringify Android postScript settled-results.
Example app generation and wiring
src/generate-nitro-package.ts
Import harness snippets; support monorepo workspace root and adjust cwd/paths; resolve/pin Nitro tool versions; when includeHarness add harness config, jest/test files, example test:harness:<platform> scripts and devDependencies; emit harness-<platform>.yml workflows; derive iOS bundle id; update workflow root handling.
CI/workflow and action updates
.github/workflows/ci-packages.yml, .github/actions/ios-build-xcode/action.yml
Add --include-harness to package generation; replace previous Maestro/E2E matrix/flows with harness matrices (ios-harness/android-harness) and new harness-ios/harness-android jobs that build apps and run bun run test:harness:<platform>; change Xcode simulator destination to iPhone 17.
Scripts, tests, and e2e artifacts
test-local.sh, scripts/e2e-maestro.sh, e2e-tests/*.e2e.yaml
Update embedded expect automation to answer prompts (module type, include harness), change simulator targeting to iPhone 17, remove Maestro launchApp/assert steps from e2e YAMLs, and adjust simulator boot/logging variables.
Templates, docs and repo files
README.md, docs/docs/commands.md, docs/docs/usage/create-a-nitro-module.md, assets/template/gitignore, package.json
Document --include-harness in README and CLI docs; add "With React Native Harness" usage examples; ignore .harness in template gitignore; remove legacy ios:e2e/android:e2e scripts from package.json.
Small cleanups and linting
eslint.config.js, src/utils.ts, src/file-generators/cpp-file-generator.ts
Broaden ESLint TS glob to src/**/*.ts; remove exported LANGS and validateTemplate; avoid pre-creating cpp folder before generating C++ files.
sequenceDiagram
  participant CLI as CLI (create)
  participant Factory as NitroModuleFactory
  participant FS as Filesystem (example, workflows)
  participant CI as GitHub Actions

  CLI->>Factory: call create with includeHarness, monorepo, packagePath
  Factory->>FS: write example app, harness config, jest, tests, scripts
  Factory->>FS: emit/transform workflows (harness-<platform>.yml), workspace files
  CI->>FS: pick up generated workflows/artifacts
  CI->>Factory: run harness jobs -> execute bun run test:harness:<platform>
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

Poem

🐰 I stitched a harness with a happy hop,
Workflows and tests all lined up on the crop,
Android and iOS runners hum and start,
A tiny rabbit cheers with a thumping heart,
Green CI lights, a joyful cart.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title accurately describes the main feature being added: React Native Harness support is a substantial new feature integrated across CLI options, code generation, documentation, and CI workflows.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/react-native-harness-support

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@test-local.sh`:
- Around line 72-73: The expect script currently sends "n\r" to decline the
React Native harness prompt; change the send to just "\r" to accept the default
(consistent with other prompts) for the prompt matching "Include React Native
Harness for native Android and iOS tests?" in test-local.sh; this aligns with
the CLI's initialValue: false setting in src/cli/create.ts and makes the test
pattern consistent with the other default prompts.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 05f91da0-d51d-4324-8eaf-3b01415a827b

📥 Commits

Reviewing files that changed from the base of the PR and between 1995733 and 9ec8597.

📒 Files selected for processing (13)
  • README.md
  • docs/docs/commands.md
  • docs/docs/usage/create-a-nitro-module.md
  • eslint.config.js
  • src/cli/create.ts
  • src/cli/index.ts
  • src/code-snippets/code.js.ts
  • src/constants.ts
  • src/file-generators/cpp-file-generator.ts
  • src/generate-nitro-package.ts
  • src/types.ts
  • src/utils.ts
  • test-local.sh
💤 Files with no reviewable changes (2)
  • src/file-generators/cpp-file-generator.ts
  • src/utils.ts

Comment thread test-local.sh
Comment on lines +72 to +73
# React Native Harness (Default to no)
expect "Include React Native Harness for native Android and iOS tests?" {send "n\r"}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Description: Check `@clack/prompts` documentation for confirm prompt input handling

rg -A 10 'initialValue.*false' --type ts -g '**/src/cli/create.ts' | head -20

Repository: patrickkabwe/create-nitro-module

Length of output: 821


🏁 Script executed:

# Find and read the test-local.sh file around lines 72-73
fd -t f test-local.sh

Repository: patrickkabwe/create-nitro-module

Length of output: 90


🏁 Script executed:

# Search for the React Native Harness prompt in create.ts
rg 'React Native Harness' --type ts -B 5 -A 5

Repository: patrickkabwe/create-nitro-module

Length of output: 4981


🏁 Script executed:

# Check for other expect patterns in test files to compare patterns
rg 'expect.*send' -g '*.sh' -B 1 -A 1 | head -50

Repository: patrickkabwe/create-nitro-module

Length of output: 730


Use "\r" to accept the default "no" response, consistent with other default prompts in the test file.

The prompt at line 72-73 sends "n\r" to decline the harness option. However, the test file uses "\r" alone to accept defaults for module type (line 74) and package manager (line 77). Since the harness prompt specifies initialValue: false in src/cli/create.ts line 531, sending just "\r" would be more consistent with the established pattern and less fragile:

expect "Include React Native Harness for native Android and iOS tests?" {send \r}

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@test-local.sh` around lines 72 - 73, The expect script currently sends "n\r"
to decline the React Native harness prompt; change the send to just "\r" to
accept the default (consistent with other prompts) for the prompt matching
"Include React Native Harness for native Android and iOS tests?" in
test-local.sh; this aligns with the CLI's initialValue: false setting in
src/cli/create.ts and makes the test pattern consistent with the other default
prompts.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@scripts/e2e-maestro.sh`:
- Around line 67-69: The variable holding the simulator UUID is assigned to
iphone16Id but later checks use iphone17Id, causing the boot-state logic to
reference the wrong variable; update the boot-state check (and any other
occurrences) to use the same identifier you assigned (either change the
assignment to iphone17Id or replace all iphone17Id references with iphone16Id)
so the echo, boot check and subsequent boot logic consistently reference the
same variable (iphone16Id/iphone17Id) throughout the script.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: a02fa0a9-b84d-485b-9a31-e2b6ca838ee7

📥 Commits

Reviewing files that changed from the base of the PR and between 9ec8597 and d1064f0.

📒 Files selected for processing (7)
  • .github/actions/ios-build-xcode/action.yml
  • assets/template/.github/workflows/ios-build.yml
  • assets/template/gitignore
  • scripts/e2e-maestro.sh
  • src/code-snippets/code.js.ts
  • src/generate-nitro-package.ts
  • test-local.sh
✅ Files skipped from review due to trivial changes (1)
  • assets/template/gitignore
🚧 Files skipped from review as they are similar to previous changes (3)
  • test-local.sh
  • src/code-snippets/code.js.ts
  • src/generate-nitro-package.ts

Comment thread scripts/e2e-maestro.sh Outdated
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/ci-packages.yml:
- Around line 76-77: The workflow uses hyphenated output keys (e.g.,
ios-harness, android-harness) in job outputs and expression references which
breaks GitHub Actions dot-notation parsing; change all output key names to use
underscores to match the step outputs (ios_harness, android_harness) and update
every reference that reads them (for example any
needs.define-matrix.outputs.android-harness or .ios-harness at locations like
the ones mentioned) to the underscore form
(needs.define-matrix.outputs.android_harness and ios_harness), and ensure the
job output mappings that expose step outputs also use the underscore keys so all
producers and consumers use the same underscore-keyed names.

In `@src/generate-nitro-package.ts`:
- Around line 742-753: The current extraction uses the first match of
PRODUCT_BUNDLE_IDENTIFIER (bundleIdMatch) which can pick a Tests/UITests target;
update the logic in the function that reads projectFileContent to find all
PRODUCT_BUNDLE_IDENTIFIER occurrences and choose the one belonging to the main
app target: parse projectFileContent for target blocks (or scan with a global
regex), for each match examine surrounding context (e.g., the target name or the
block that contains the identifier) and skip targets whose names include
"Test"/"Tests"/"UITest"/"UITests" (or otherwise identify non-app targets), then
return the bundle id from the first remaining app target (trim and
replaceAll('"','') as before) and throw the existing error only if no suitable
app bundle id is found.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 76ed2ba6-6469-4a5a-985e-0864e7937f1c

📥 Commits

Reviewing files that changed from the base of the PR and between f9e21a8 and 4439871.

📒 Files selected for processing (7)
  • .github/workflows/ci-packages.yml
  • src/cli/create.ts
  • src/cli/index.ts
  • src/code-snippets/code.js.ts
  • src/constants.ts
  • src/generate-nitro-package.ts
  • src/types.ts
🚧 Files skipped from review as they are similar to previous changes (3)
  • src/code-snippets/code.js.ts
  • src/constants.ts
  • src/cli/create.ts

Comment on lines +76 to +77
ios-harness: ${{ steps.set-matrix.outputs.ios_harness }}
android-harness: ${{ steps.set-matrix.outputs.android_harness }}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Verify hyphenated output keys and dot-notation usages in this workflow.
rg -n "ios-harness|android-harness|outputs\.(ios|android)-harness" .github/workflows/ci-packages.yml

Repository: patrickkabwe/create-nitro-module

Length of output: 394


🏁 Script executed:

cat -n .github/workflows/ci-packages.yml | sed -n '50,100p'

Repository: patrickkabwe/create-nitro-module

Length of output: 2224


🏁 Script executed:

cat -n .github/workflows/ci-packages.yml | sed -n '79,130p'

Repository: patrickkabwe/create-nitro-module

Length of output: 2400


🏁 Script executed:

cat -n .github/workflows/ci-packages.yml | sed -n '130,250p'

Repository: patrickkabwe/create-nitro-module

Length of output: 5507


🏁 Script executed:

cat -n .github/workflows/ci-packages.yml | sed -n '330,345p'

Repository: patrickkabwe/create-nitro-module

Length of output: 776


🏁 Script executed:

cat -n .github/workflows/ci-packages.yml | sed -n '414,430p'

Repository: patrickkabwe/create-nitro-module

Length of output: 778


Use underscore-keyed outputs consistently; dot notation with hyphens breaks in GitHub Actions expressions

The step set-matrix produces outputs with underscores (ios_harness, android_harness), but job outputs expose them with hyphens. Lines 337 and 421 then attempt to access these hyphenated keys using dot notation (needs.define-matrix.outputs.android-harness), which fails because GitHub Actions expression parsing cannot handle hyphens in dot notation. Rename all output keys to use underscores throughout for consistency.

Suggested fix
-            ios-harness: ${{ steps.set-matrix.outputs.ios_harness }}
-            android-harness: ${{ steps.set-matrix.outputs.android_harness }}
+            ios_harness: ${{ steps.set-matrix.outputs.ios_harness }}
+            android_harness: ${{ steps.set-matrix.outputs.android_harness }}
...
-            matrix: ${{ fromJson(needs.define-matrix.outputs.android-harness) }}
+            matrix: ${{ fromJson(needs.define-matrix.outputs.android_harness) }}
...
-            matrix: ${{ fromJson(needs.define-matrix.outputs.ios-harness) }}
+            matrix: ${{ fromJson(needs.define-matrix.outputs.ios_harness) }}

Also applies to: 337, 421

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/ci-packages.yml around lines 76 - 77, The workflow uses
hyphenated output keys (e.g., ios-harness, android-harness) in job outputs and
expression references which breaks GitHub Actions dot-notation parsing; change
all output key names to use underscores to match the step outputs (ios_harness,
android_harness) and update every reference that reads them (for example any
needs.define-matrix.outputs.android-harness or .ios-harness at locations like
the ones mentioned) to the underscore form
(needs.define-matrix.outputs.android_harness and ios_harness), and ensure the
job output mappings that expose step outputs also use the underscore keys so all
producers and consumers use the same underscore-keyed names.

Comment on lines +742 to +753
const bundleIdMatch = projectFileContent.match(
/PRODUCT_BUNDLE_IDENTIFIER = ([^;]+);/
)

if (bundleIdMatch == null) {
throw new Error(
`Failed to resolve iOS bundle identifier for React Native Harness from ${projectFilePath}`
)
}

return bundleIdMatch[1].trim().replaceAll('"', '')
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Bundle ID extraction can target the wrong iOS target

On Line 742, taking the first PRODUCT_BUNDLE_IDENTIFIER match is unsafe in multi-target projects (Tests/UITests can appear first), which can break generated harness config.

Suggested fix
-        const bundleIdMatch = projectFileContent.match(
-            /PRODUCT_BUNDLE_IDENTIFIER = ([^;]+);/
-        )
-
-        if (bundleIdMatch == null) {
+        const bundleIds = Array.from(
+            projectFileContent.matchAll(/PRODUCT_BUNDLE_IDENTIFIER = ([^;]+);/g),
+            match => match[1].trim().replaceAll('"', '')
+        )
+        const bundleId = bundleIds.find(
+            id => !id.endsWith('Tests') && !id.endsWith('UITests')
+        )
+
+        if (bundleId == null) {
             throw new Error(
                 `Failed to resolve iOS bundle identifier for React Native Harness from ${projectFilePath}`
             )
         }
-
-        return bundleIdMatch[1].trim().replaceAll('"', '')
+        return bundleId
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/generate-nitro-package.ts` around lines 742 - 753, The current extraction
uses the first match of PRODUCT_BUNDLE_IDENTIFIER (bundleIdMatch) which can pick
a Tests/UITests target; update the logic in the function that reads
projectFileContent to find all PRODUCT_BUNDLE_IDENTIFIER occurrences and choose
the one belonging to the main app target: parse projectFileContent for target
blocks (or scan with a global regex), for each match examine surrounding context
(e.g., the target name or the block that contains the identifier) and skip
targets whose names include "Test"/"Tests"/"UITest"/"UITests" (or otherwise
identify non-app targets), then return the bundle id from the first remaining
app target (trim and replaceAll('"','') as before) and throw the existing error
only if no suitable app bundle id is found.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/generate-nitro-package.ts (1)

683-697: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Use monorepo-aware node_modules paths in build.gradle.

These replacements are correct for the single-package layout, but in monorepo mode example/android/app/build.gradle sits under packages/<name>/.... ../../../node_modules and $rootDir/../../node_modules then resolve inside the package workspace, not the monorepo root, so Android builds/codegen won't find React Native, Codegen, or Hermes.

Suggested fix
-        const gradleReplacements = {
+        const appNodeModulesPath = this.config.monorepo
+            ? '../../../../../node_modules'
+            : '../../../node_modules'
+        const androidNodeModulesPath = this.config.monorepo
+            ? '../../../../node_modules'
+            : '../../node_modules'
+
+        const gradleReplacements = {
             '// reactNativeDir = file("../../node_modules/react-native")':
-                'reactNativeDir = file("../../../node_modules/react-native")',
+                `reactNativeDir = file("${appNodeModulesPath}/react-native")`,
             '// codegenDir = file("../../node_modules/@react-native/codegen")':
-                'codegenDir = file("../../../node_modules/@react-native/codegen")',
+                `codegenDir = file("${appNodeModulesPath}/@react-native/codegen")`,
             '// cliFile = file("../../node_modules/react-native/cli.js")':
-                'cliFile = file("../../../node_modules/react-native/cli.js")',
+                `cliFile = file("${appNodeModulesPath}/react-native/cli.js")`,
             '// hermesCommand = "$rootDir/my-custom-hermesc/bin/hermesc"':
-                'hermesCommand = "$rootDir/../../node_modules/hermes-compiler/hermesc/%OS-BIN%/hermesc"',
+                `hermesCommand = "$rootDir/${androidNodeModulesPath}/hermes-compiler/hermesc/%OS-BIN%/hermesc"`,
         }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/generate-nitro-package.ts` around lines 683 - 697, The gradleReplacements
object currently inserts paths that only work for single-package layouts; update
the replacements so they are monorepo-aware by using one more ../ level: change
the three-parent paths to four-parent paths (use
'file("../../../../node_modules/react-native")',
'file("../../../../node_modules/@react-native/codegen")',
'file("../../../../node_modules/react-native/cli.js")') and change the
hermesCommand rootDir replacement to
'$rootDir/../../../node_modules/hermes-compiler/hermesc/%OS-BIN%/hermesc' so
that replacePlaceholder (called when creating androidBuildGradleData) will point
at the monorepo root node_modules when example/android/app is under
packages/<name>/...
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/generate-nitro-package.ts`:
- Around line 541-554: The harness version probing still calls getLatestVersion
even when skip-install is requested; update the includeHarness branch in
generate-nitro-package.ts to check the skipInstall option (e.g.
this.options.skipInstall or equivalent) before invoking getLatestVersion and, if
skipInstall is true, short-circuit the Promise.all to return null/undefined
versions for react-native-harness, `@react-native-harness/platform-android`,
`@react-native-harness/platform-apple` and the optional `@react-native-harness/ui`
(based on this.config.packageType === Nitro.View) so no npm/pnpm view network
calls are made; modify the code around this.config.includeHarness and the
Promise.all that calls getLatestVersion to respect skipInstall.

---

Outside diff comments:
In `@src/generate-nitro-package.ts`:
- Around line 683-697: The gradleReplacements object currently inserts paths
that only work for single-package layouts; update the replacements so they are
monorepo-aware by using one more ../ level: change the three-parent paths to
four-parent paths (use 'file("../../../../node_modules/react-native")',
'file("../../../../node_modules/@react-native/codegen")',
'file("../../../../node_modules/react-native/cli.js")') and change the
hermesCommand rootDir replacement to
'$rootDir/../../../node_modules/hermes-compiler/hermesc/%OS-BIN%/hermesc' so
that replacePlaceholder (called when creating androidBuildGradleData) will point
at the monorepo root node_modules when example/android/app is under
packages/<name>/...
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 36c6992e-111e-4b46-a86b-dd297d863d4b

📥 Commits

Reviewing files that changed from the base of the PR and between 4439871 and 6fffa2c.

📒 Files selected for processing (3)
  • .github/actions/ios-build-xcode/action.yml
  • src/code-snippets/code.js.ts
  • src/generate-nitro-package.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • .github/actions/ios-build-xcode/action.yml
  • src/code-snippets/code.js.ts

Comment on lines +541 to +554
if (this.config.includeHarness) {
const [
reactNativeHarnessVersion,
androidHarnessVersion,
appleHarnessVersion,
uiHarnessVersion,
] = await Promise.all([
this.getLatestVersion('react-native-harness'),
this.getLatestVersion('@react-native-harness/platform-android'),
this.getLatestVersion('@react-native-harness/platform-apple'),
this.config.packageType === Nitro.View
? this.getLatestVersion('@react-native-harness/ui')
: Promise.resolve(null),
])
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Honor skipInstall before probing harness package versions.

This branch still shells out to npm/pnpm view even when --skip-install is set. That makes the skip-install path depend on registry availability and slows down/offlines the exact scenario this flag is meant to support.

Suggested fix
         if (this.config.includeHarness) {
-            const [
-                reactNativeHarnessVersion,
-                androidHarnessVersion,
-                appleHarnessVersion,
-                uiHarnessVersion,
-            ] = await Promise.all([
-                this.getLatestVersion('react-native-harness'),
-                this.getLatestVersion('@react-native-harness/platform-android'),
-                this.getLatestVersion('@react-native-harness/platform-apple'),
-                this.config.packageType === Nitro.View
-                    ? this.getLatestVersion('@react-native-harness/ui')
-                    : Promise.resolve(null),
-            ])
+            const [
+                reactNativeHarnessVersion,
+                androidHarnessVersion,
+                appleHarnessVersion,
+                uiHarnessVersion,
+            ] = this.config.skipInstall
+                ? [null, null, null, null]
+                : await Promise.all([
+                      this.getLatestVersion('react-native-harness'),
+                      this.getLatestVersion(
+                          '@react-native-harness/platform-android'
+                      ),
+                      this.getLatestVersion(
+                          '@react-native-harness/platform-apple'
+                      ),
+                      this.config.packageType === Nitro.View
+                          ? this.getLatestVersion('@react-native-harness/ui')
+                          : Promise.resolve(null),
+                  ])
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/generate-nitro-package.ts` around lines 541 - 554, The harness version
probing still calls getLatestVersion even when skip-install is requested; update
the includeHarness branch in generate-nitro-package.ts to check the skipInstall
option (e.g. this.options.skipInstall or equivalent) before invoking
getLatestVersion and, if skipInstall is true, short-circuit the Promise.all to
return null/undefined versions for react-native-harness,
`@react-native-harness/platform-android`, `@react-native-harness/platform-apple` and
the optional `@react-native-harness/ui` (based on this.config.packageType ===
Nitro.View) so no npm/pnpm view network calls are made; modify the code around
this.config.includeHarness and the Promise.all that calls getLatestVersion to
respect skipInstall.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant