fix: skip postcodegen when kotlin is enabled#354
Conversation
WalkthroughUpdates 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
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
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested labels
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests
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.
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (2)
src/generate-nitro-package.ts (2)
184-186: Conditionally omit the key instead of assigningundefined.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
postcodegenis 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
📒 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.
Summary
Testing
Summary by CodeRabbit
Chores
Build