Skip to content

feat: align nitro view specs and auto-select languages#431

Merged
patrickkabwe merged 1 commit intomainfrom
feat/rename-view-specs
Dec 15, 2025
Merged

feat: align nitro view specs and auto-select languages#431
patrickkabwe merged 1 commit intomainfrom
feat/rename-view-specs

Conversation

@patrickkabwe
Copy link
Owner

@patrickkabwe patrickkabwe commented Dec 15, 2025

Summary by CodeRabbit

  • Refactor
    • Consolidated Nitro View specification files to use the specs directory structure consistently
    • Improved platform-based language detection for Nitro View projects during setup

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Dec 15, 2025

Walkthrough

The pull request consolidates the Nitro View file structure by relocating modules from /src/views to /src/specs across documentation, code generation, and configuration files. Additionally, view language selection logic is now platform-aware, deriving languages (Swift/Kotlin) based on selected platforms rather than defaulting to hardcoded values.

Changes

Cohort / File(s) Change Summary
Documentation Structure
docs/docs/intro.md
Removed "views" segment from directory path listing, updating tree from "specs|views" to "specs" only
View Language Resolution
src/cli/create.ts
Added resolveViewLanguages() helper to map selected platforms to languages (iOS → Swift, Android → Kotlin). Updated both CI and interactive flows to use platform-based language derivation for Nitro.View packages instead of hardcoded defaults
Import Path Updates
src/code-snippets/code.js.ts, src/file-generators/js-file-generator.ts
Changed Nitro View module import and generation paths from ./views/${moduleName}.nitro to ./specs/${moduleName}.nitro. Updated nitroSpecFolder from conditional assignment to fixed /src/specs value

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

  • Areas requiring attention:
    • src/cli/create.ts: Verify resolveViewLanguages() logic correctly maps all platform variants and integrates properly with both CI and interactive flows
    • Cross-file consistency: Ensure all four files now uniformly reference /specs path for Nitro View modules without breaking existing functionality

Possibly related PRs

  • PR #273: Modifies src/cli/create.ts and packageType handling, adding packageType to options and signature changes that complement the platform-based language resolution introduced in this PR

Poem

🐰 Hops through the specs with glee,
Views consolidated, paths now free,
Swift on iOS, Kotlin on Android too,
Platform-aware languages, shiny and new!

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 'align nitro view specs and auto-select languages' accurately reflects the main changes: relocating view specs from /src/views to /src/specs and implementing language auto-selection based on platforms.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/rename-view-specs

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between eacbfc4 and 1e01775.

📒 Files selected for processing (4)
  • docs/docs/intro.md (1 hunks)
  • src/cli/create.ts (2 hunks)
  • src/code-snippets/code.js.ts (1 hunks)
  • src/file-generators/js-file-generator.ts (2 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
src/cli/create.ts (1)
src/types.ts (3)
  • PackageManager (38-41)
  • CreateModuleOptions (30-36)
  • UserAnswers (4-11)
🔇 Additional comments (6)
src/file-generators/js-file-generator.ts (1)

13-13: LGTM! Clean consolidation of Nitro View specs location.

The change from conditional folder selection to a fixed /src/specs path simplifies the codebase and aligns perfectly with the updated import paths in src/code-snippets/code.js.ts (line 96) and the documentation structure update.

Also applies to: 43-43

docs/docs/intro.md (1)

34-34: LGTM! Documentation accurately reflects the consolidated structure.

The project structure update correctly shows the unified /src/specs location for both Nitro Module and Nitro View specs, matching the implementation changes.

src/code-snippets/code.js.ts (1)

96-96: LGTM! Import path correctly updated to match new specs location.

The import path update from ./views/${moduleName}.nitro to ./specs/${moduleName}.nitro is essential for the generated code to work correctly with the new file structure. This aligns with the file generation change in src/file-generators/js-file-generator.ts (line 43).

src/cli/create.ts (3)

177-186: LGTM! Clean platform-to-language derivation for Nitro Views.

The resolveViewLanguages function correctly maps platforms to their native UI languages (iOS → Swift, Android → Kotlin). This is appropriate for Nitro Views which require platform-specific UI implementations and cannot use C++ for view components.


194-204: LGTM! CI path now uses platform-aware language selection for Nitro Views.

The conditional language selection correctly applies resolveViewLanguages for Nitro View packages and maintains the Swift & Kotlin default for Nitro Module packages. Since CI mode always uses both iOS and Android platforms, this change primarily improves code consistency with the interactive flow while maintaining the same functional behavior.


283-289: LGTM! Interactive flow auto-selects languages for Nitro Views.

Excellent UX improvement! For Nitro View packages, languages are now automatically derived from selected platforms (eliminating an unnecessary prompt), while Nitro Module packages continue through the existing selectLanguages flow where users can choose between Swift/Kotlin or C++.


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 merged commit 6fc6320 into main Dec 15, 2025
27 of 28 checks passed
@patrickkabwe patrickkabwe deleted the feat/rename-view-specs branch December 15, 2025 09:27
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