Skip to content

Feat/nitro bump up#344

Merged
patrickkabwe merged 2 commits intomainfrom
feat/nitro-bum-up
Sep 10, 2025
Merged

Feat/nitro bump up#344
patrickkabwe merged 2 commits intomainfrom
feat/nitro-bum-up

Conversation

@patrickkabwe
Copy link
Owner

@patrickkabwe patrickkabwe commented Sep 10, 2025

Summary by CodeRabbit

  • Chores

    • CI now uses the nitrogen CLI for code generation.
    • Dependabot groups updated to track nitrogen instead of nitro-codegen (both in the main repo and the template).
    • Template dependencies updated: adopt nitrogen for codegen, bump react-native-nitro-modules and TypeScript.
  • Refactor

    • Migrated code generation tooling from nitro-codegen to nitrogen across build and install flows; behavior remains unchanged for users.

@patrickkabwe patrickkabwe self-assigned this Sep 10, 2025
@coderabbitai
Copy link

coderabbitai bot commented Sep 10, 2025

Walkthrough

The codebase replaces all references to the nitro-codegen tool with nitrogen across CI, templates, Dependabot configs, and the generator script. Version resolution and devDependency keys are updated accordingly. No public API signatures change. Control flow remains the same; only the invoked tool and dependency names are updated.

Changes

Cohort / File(s) Summary
CI codegen action
.github/actions/run-codegen-build/action.yml
Switch codegen invocation from bunx nitro-codegen to bunx nitrogen; other steps and error handling unchanged.
Dependabot configs
.github/dependabot.yml, assets/template/.github/dependabot.yml
Update nitro group patterns: replace 'nitro-codegen' with 'nitrogen'; retain 'react-native-nitro-modules'. No schedule/group structural changes.
Template dependencies
assets/template/package.json
Replace devDependency nitro-codegen with nitrogen@^0.29.4; bump react-native-nitro-modules to ^0.2942; bump typescript to ^5.8.3.
Generator script updates
src/generate-nitro-package.ts
Rename tool references and variables from nitro-codegen to nitrogen; update version pinning and package.json script generation; change install/run invocation to use nitrogen. No API signature changes.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor Dev as Developer
  participant GH as GitHub Action
  participant Bun as Bun (bunx)
  participant Nitrogen as nitrogen CLI

  Dev->>GH: Trigger run-codegen-build
  GH->>Bun: bunx nitrogen --logLevel=debug
  Bun->>Nitrogen: Execute codegen
  Nitrogen-->>GH: Exit status (success/failure)
  GH-->>Dev: Job result
Loading
sequenceDiagram
  autonumber
  participant Gen as generate-nitro-package.ts
  participant NPM as Package.json
  participant Reg as Registry
  participant Nitrogen as nitrogen CLI

  Gen->>Reg: Resolve versions (nitrogen, nitro modules)
  Reg-->>Gen: Latest versions
  Gen->>NPM: Write devDependencies { nitrogen, react-native-nitro-modules }
  Gen->>NPM: Write scripts { codegen: "nitrogen ..." }
  Gen->>Nitrogen: Invoke codegen during install/build
  Nitrogen-->>Gen: Complete
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested labels

released

Pre-merge checks (2 passed, 1 warning)

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Title Check ⚠️ Warning The current title “Feat/nitro bump up” fails to concisely and clearly summarize the main change of migrating from nitro-codegen to nitrogen across build and dependency configurations, instead using a vague phrase with no clear context about what is being bumped. Please update the title to clearly reflect the primary change, for example “Migrate codegen tool from nitro-codegen to nitrogen” or “Replace nitro-codegen with nitrogen in build workflows,” to give reviewers immediate context.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.

Poem

A nibble of code, a hop through the night,
Swapped Nitro for Nitrogen—quick, light and tight.
Dependencies groomed, the garden in line,
Pipelines hum softly, everything fine.
Thump goes my foot—green builds in sight! 🐇✨

Tip

👮 Agentic pre-merge checks are now available in preview!

Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.

  • Built-in checks – Quickly apply ready-made checks to enforce title conventions, require pull request descriptions that follow templates, validate linked issues for compliance, and more.
  • Custom agentic checks – Define your own rules using CodeRabbit’s advanced agentic capabilities to enforce organization-specific policies and workflows. For example, you can instruct CodeRabbit’s agent to verify that API documentation is updated whenever API schema files are modified in a PR. Note: Upto 5 custom checks are currently allowed during the preview period. Pricing for this feature will be announced in a few weeks.

Please see the documentation for more information.

Example:

reviews:
  pre_merge_checks:
    custom_checks:
      - name: "Undocumented Breaking Changes"
        mode: "warning"
        instructions: |
          Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).

Please share your feedback with us on this Discord post.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/nitro-bum-up

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.

@patrickkabwe patrickkabwe changed the title Feat/nitro bum up Feat/nitro bump up Sep 10, 2025
Copy link

@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

Caution

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

⚠️ Outside diff range comments (1)
.github/actions/run-codegen-build/action.yml (1)

17-21: Make codegen runner PM-aware or reuse the package.json script to avoid Bun requirement

The step hardcodes bunx, which will fail if Bun isn’t installed on the runner. Either run the codegen script (<pm> run codegen, which you already add to package.json) or map to the correct “exec” per PM.

Apply one of the following:

Option A (reuse script — simplest and consistent):

-              bunx nitrogen --logLevel="debug"
-              ${{ inputs.pm }} run build
+              ${{ inputs.pm }} run codegen

Option B (PM-aware exec mapping):

-              bunx nitrogen --logLevel="debug"
+              case "${{ inputs.pm }}" in
+                npm)  npx --yes nitrogen --logLevel="debug" ;;
+                pnpm) pnpm exec nitrogen --logLevel="debug" ;;
+                yarn) yarn dlx nitrogen --logLevel="debug" ;;
+                bun)  bunx nitrogen --logLevel="debug" ;;
+                *) echo "Unsupported package manager: ${{ inputs.pm }}" >&2; exit 1 ;;
+              esac
               ${{ inputs.pm }} run build
🧹 Nitpick comments (2)
.github/actions/run-codegen-build/action.yml (1)

2-2: Nit: update description to reflect “nitrogen”

The description still says “Run nitro codegen…”. Consider “Run nitrogen codegen…”.

src/generate-nitro-package.ts (1)

190-205: Guard against bad template fallbacks if version discovery fails

If npm view/pnpm view fail, you fall back to templatePackageJson.devDependencies[...]. Given the template currently has a malformed react-native-nitro-modules version, installs can still break. Consider validating with semver before applying the fallback.

Minimal guard:

+        const isValid = (v?: string|null) => !!v && /^\d+\.\d+\.\d+/.test(v.replace(/^[^\d]*/, ''))
         newWorkspacePackageJsonFile.devDependencies = {
           ...newWorkspacePackageJsonFile.devDependencies,
           [nitroModules]:
-              nitroModulesVersion ??
-              newWorkspacePackageJsonFile.devDependencies?.[nitroModules] ??
-              templatePackageJson.devDependencies[nitroModules],
+              (isValid(nitroModulesVersion) && nitroModulesVersion) ??
+              (isValid(newWorkspacePackageJsonFile.devDependencies?.[nitroModules]) && newWorkspacePackageJsonFile.devDependencies?.[nitroModules]) ??
+              (isValid(templatePackageJson.devDependencies[nitroModules]) && templatePackageJson.devDependencies[nitroModules]) ??
+              '*',
           [nitrogen]:
-              nitrogenVersion ??
-              newWorkspacePackageJsonFile.devDependencies?.[nitrogen] ??
-              templatePackageJson.devDependencies[nitrogen],
+              (isValid(nitrogenVersion) && nitrogenVersion) ??
+              (isValid(newWorkspacePackageJsonFile.devDependencies?.[nitrogen]) && newWorkspacePackageJsonFile.devDependencies?.[nitrogen]) ??
+              (isValid(templatePackageJson.devDependencies[nitrogen]) && templatePackageJson.devDependencies[nitrogen]) ??
+              '^0',
         }
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 646348c and 5b7b94c.

📒 Files selected for processing (5)
  • .github/actions/run-codegen-build/action.yml (1 hunks)
  • .github/dependabot.yml (1 hunks)
  • assets/template/.github/dependabot.yml (1 hunks)
  • assets/template/package.json (1 hunks)
  • src/generate-nitro-package.ts (3 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
assets/template/package.json (1)
src/types.ts (1)
  • Nitro (43-46)
🔇 Additional comments (5)
assets/template/package.json (1)

57-57: Verify nitrogen and TypeScript versions

  • npm view nitrogen version ⇒ 0.29.4 matches ^0.29.4
  • npm view typescript version ⇒ 5.9.2 (so ^5.8.3 will resolve within 5.x); confirm that TS 5.x is supported by React Native 0.81.x’s CLI template and your bob setup
.github/dependabot.yml (2)

31-34: LGTM — group now tracks ‘nitrogen’

Grouping nitrogen with react-native-nitro-modules aligns with the migration.


10-14: Confirm Dependabot bun support in root config

Root config uses package-ecosystem: bun but doesn’t set enable-beta-ecosystems: true (present in the template config). If required for your org, mirror that here to avoid Dependabot ignoring Bun updates.

assets/template/.github/dependabot.yml (1)

54-57: LGTM — npm nitro group now tracks ‘nitrogen’

Matches the tool rename; grouping remains coherent.

src/generate-nitro-package.ts (1)

183-185: Good: consolidated codegen script with Kotlin post-script gating

Script composes nitrogen, build, and optional post-script cleanly.

Comment on lines +61 to 62
"react-native-nitro-modules": "^0.2942",
"conventional-changelog-conventionalcommits": "^9.1.0",
Copy link

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

Suspicious version string for react-native-nitro-modules — likely typo

^0.2942 looks malformed (missing a dot). This will fail resolution and could cascade into install failures when getLatestVersion returns null and we fall back to the template value.

Proposed fix (pick a valid semver for the intended bump; placeholder uses the nearest plausible range):

-    "react-native-nitro-modules": "^0.2942",
+    "react-native-nitro-modules": "^0.29.4",

To verify available versions:


🏁 Script executed:

#!/bin/bash
npm view react-native-nitro-modules versions --json | jq '.[-10:]'

Length of output: 122


Fix malformed react-native-nitro-modules version
Replace in assets/template/package.json:

-    "react-native-nitro-modules": "^0.2942",
+    "react-native-nitro-modules": "^0.29.4",

to match the latest published 0.29.4 release.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"react-native-nitro-modules": "^0.2942",
"conventional-changelog-conventionalcommits": "^9.1.0",
"react-native-nitro-modules": "^0.29.4",
"conventional-changelog-conventionalcommits": "^9.1.0",
🤖 Prompt for AI Agents
In assets/template/package.json around lines 61 to 62, the
react-native-nitro-modules version is malformed ("^0.2942"); update that
dependency value to the correct published release by replacing it with "^0.29.4"
(preserve the caret if semantic-range behavior is desired) and save the file.

Comment on lines 498 to 502
let packageManager =
this.config.pm === 'npm' ? 'npx --yes' : this.config.pm
let codegenCommand = `${packageManager} nitro-codegen --logLevel="debug" && ${this.config.pm} run build${this.config.langs.includes(SupportedLang.KOTLIN) ? ' && node post-script.js' : ''}`
let codegenCommand = `${packageManager} nitrogen --logLevel="debug" && ${this.config.pm} run build${this.config.langs.includes(SupportedLang.KOTLIN) ? ' && node post-script.js' : ''}`
await execAsync(codegenCommand, { cwd: this.config.cwd })
}
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Codegen invocation breaks for pnpm/bun; prefer running the script or PM-aware exec

packageManager = this.config.pm === 'npm' ? 'npx --yes' : this.config.pm leads to:

  • pnpm: pnpm nitrogen (invalid; should be pnpm exec nitrogen or pnpm dlx)
  • bun: bun nitrogen (invalid; should be bunx or a script)
  • yarn: may work via bin shim, but inconsistent

You already define a codegen script; just run it.

Apply:

-        let packageManager =
-            this.config.pm === 'npm' ? 'npx --yes' : this.config.pm
-        let codegenCommand = `${packageManager} nitrogen --logLevel="debug" && ${this.config.pm} run build${this.config.langs.includes(SupportedLang.KOTLIN) ? ' && node post-script.js' : ''}`
-        await execAsync(codegenCommand, { cwd: this.config.cwd })
+        await execAsync(`${this.config.pm} run codegen`, { cwd: this.config.cwd })

Alternative (PM-aware exec) if you don’t want to rely on the script:

-        let packageManager =
-            this.config.pm === 'npm' ? 'npx --yes' : this.config.pm
-        let codegenCommand = `${packageManager} nitrogen --logLevel="debug" && ${this.config.pm} run build${this.config.langs.includes(SupportedLang.KOTLIN) ? ' && node post-script.js' : ''}`
-        await execAsync(codegenCommand, { cwd: this.config.cwd })
+        const pm = this.config.pm
+        const x =
+          pm === 'npm'  ? 'npx --yes' :
+          pm === 'pnpm' ? 'pnpm exec' :
+          pm === 'yarn' ? 'yarn dlx' :
+          pm === 'bun'  ? 'bunx' : null
+        if (!x) throw new Error(`Unsupported package manager: ${pm}`)
+        await execAsync(`${x} nitrogen --logLevel="debug"`, { cwd: this.config.cwd })
+        await execAsync(`${pm} run build${this.config.langs.includes(SupportedLang.KOTLIN) ? ' && node post-script.js' : ''}`, { cwd: this.config.cwd })
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
let packageManager =
this.config.pm === 'npm' ? 'npx --yes' : this.config.pm
let codegenCommand = `${packageManager} nitro-codegen --logLevel="debug" && ${this.config.pm} run build${this.config.langs.includes(SupportedLang.KOTLIN) ? ' && node post-script.js' : ''}`
let codegenCommand = `${packageManager} nitrogen --logLevel="debug" && ${this.config.pm} run build${this.config.langs.includes(SupportedLang.KOTLIN) ? ' && node post-script.js' : ''}`
await execAsync(codegenCommand, { cwd: this.config.cwd })
}
await execAsync(`${this.config.pm} run codegen`, { cwd: this.config.cwd })
}
🤖 Prompt for AI Agents
In src/generate-nitro-package.ts around lines 498 to 502, the current
packageManager construction (`this.config.pm === 'npm' ? 'npx --yes' :
this.config.pm`) produces invalid invocations for pnpm/bun and is brittle;
instead invoke the already-defined npm script or use PM-aware exec. Replace the
constructed direct binary call with a script invocation like `${this.config.pm}
run codegen` (so pnpm/yarn/npm/bun will run the project script correctly), then
chain the build and optional post-script as before, and run via execAsync with
the same cwd; alternatively, if you prefer not to rely on the script, detect pm
values and map to the correct exec form (pnpm -> `pnpm exec`, bun -> `bunx` or
run script) before composing the command.

@patrickkabwe patrickkabwe merged commit 96f4748 into main Sep 10, 2025
26 checks passed
@patrickkabwe patrickkabwe deleted the feat/nitro-bum-up branch September 10, 2025 13:58
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