Skip to content

fix: skip postcodegen when kotlin is enabled#354

Merged
patrickkabwe merged 2 commits intomainfrom
fix/skip-postcodegen-kotlin
Sep 16, 2025
Merged

fix: skip postcodegen when kotlin is enabled#354
patrickkabwe merged 2 commits intomainfrom
fix/skip-postcodegen-kotlin

Conversation

@patrickkabwe
Copy link
Owner

@patrickkabwe patrickkabwe commented Sep 16, 2025

Summary

  • skip adding the example postcodegen script when Kotlin support is selected so the Kotlin post-script can run instead
  • bump the example template to react-native 0.81.4 to align with the latest published version

Testing

  • not run

Summary by CodeRabbit

  • Chores

    • Updated the React Native dev dependency in the template to 0.81.4, bringing in the latest stability and compatibility improvements.
  • Build

    • Optimized code generation handling: Kotlin-based projects now automatically skip an unnecessary post-codegen step, while non-Kotlin projects retain existing behavior. This reduces redundant work and can speed up builds with no change to project setup for other configurations.

@coderabbitai
Copy link

coderabbitai bot commented Sep 16, 2025

Walkthrough

Updates the template’s devDependency react-native from 0.81.1 to 0.81.4. Adjusts NitroModuleFactory.updatePackageJsonConfig so the workspace package.json only includes a postcodegen script when Kotlin is not configured; if Kotlin is present, postcodegen is omitted.

Changes

Cohort / File(s) Summary
Template dependency bump
assets/template/package.json
Bumped devDependency react-native from "0.81.1" to "0.81.4". No other edits.
Nitro package generation logic
src/generate-nitro-package.ts
In updatePackageJsonConfig, postcodegen script is now conditional: set to getPostCodegenScript() when Kotlin is not configured; otherwise omitted. No signature changes.

Sequence Diagram(s)

sequenceDiagram
  participant Dev as Developer
  participant N as NitroModuleFactory
  participant P as workspace package.json

  Dev->>N: updatePackageJsonConfig(languages)
  N->>N: Check configured languages
  alt Kotlin included
    N-->>P: Omit postcodegen script
  else Kotlin not included
    N-->>P: Set postcodegen = getPostCodegenScript()
  end
  N-->>Dev: Return updated package.json config
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested labels

released

Poem

I thump my paws, a tiny cheer,
A version hop—0.81 draws near.
Scripts now tiptoe when Kotlin’s seen,
Post-codegen hides, the build stays clean.
In burrows of JSON I swiftly weave—
Carrots, commits, and calm release eve. 🥕✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title accurately and concisely describes the primary change: making the postcodegen script conditional when Kotlin support is enabled, which matches the modifications in src/generate-nitro-package.ts and the PR objectives. It is specific, focused, and avoids noisy or vague phrasing; the react-native template bump is a secondary change that does not need to be included in the title.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/skip-postcodegen-kotlin

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.


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

@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: 0

🧹 Nitpick comments (2)
src/generate-nitro-package.ts (2)

184-186: Conditionally omit the key instead of assigning undefined.

JSON.stringify will drop undefined, but you can avoid creating the key at all with a conditional spread.

Apply:

-            postcodegen: !this.config.langs.includes(SupportedLang.KOTLIN)
-                ? this.getPostCodegenScript()
-                : undefined,
+            ...(this.config.langs.includes(SupportedLang.KOTLIN)
+                ? {}
+                : { postcodegen: this.getPostCodegenScript() }),

184-186: postcodegen: no external callers; extract duplicated codegen logic

  • postcodegen is only referenced in src/generate-nitro-package.ts (script property) and CHANGELOG.md — no other usages (docs/workflows/CI) found.
  • Kotlin gate duplicated at src/generate-nitro-package.ts lines 183 and 502; extract a single getCodegenCommand() helper and use it in both places.
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f5a307b and d249e98.

📒 Files selected for processing (2)
  • assets/template/package.json (1 hunks)
  • src/generate-nitro-package.ts (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (15)
  • GitHub Check: Test Android Build - yarn - view (Release)
  • GitHub Check: Test Android Build - yarn - module (Debug)
  • GitHub Check: Test iOS Build - yarn - module (Release)
  • GitHub Check: Test iOS Build - yarn - view (Debug)
  • GitHub Check: Test iOS Build - bun - module (Release)
  • GitHub Check: Test Android Build - bun - view (Debug)
  • GitHub Check: Test Android Build - yarn - module (Release)
  • GitHub Check: Test Android Build - yarn - view (Debug)
  • GitHub Check: Android E2E Test (view, Release, bun)
  • GitHub Check: Test Android Build - bun - view (Release)
  • GitHub Check: Test Android Build - bun - module (Debug)
  • GitHub Check: Test Android Build - bun - module (Release)
  • GitHub Check: Android E2E Test (module, Release, bun)
  • GitHub Check: iOS E2E Test (view, Release, bun)
  • GitHub Check: iOS E2E Test (module, Release, bun)
🔇 Additional comments (1)
assets/template/package.json (1)

59-59: RN bump to 0.81.4 — confirmed published and tagged as 'latest'.
npm shows react-native@0.81.4 exists and dist-tags 'latest' and '0.81-stable' point to 0.81.4.

@patrickkabwe patrickkabwe merged commit 7106211 into main Sep 16, 2025
26 checks passed
@patrickkabwe patrickkabwe deleted the fix/skip-postcodegen-kotlin branch September 16, 2025 06:05
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