chore: only check for min android runtime version for scoped runtime#6067
Conversation
📝 WalkthroughWalkthroughThis change modifies android-project-service.ts to restrict two existing minimum runtime version checks (related to Gradle support) so they only apply when the Android runtime package name matches the scoped runtime constant, derived from projectData.nsConfig.android?.runtimePackageName. ChangesScoped Runtime Version Gating
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~4 minutes
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
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.
🧹 Nitpick comments (1)
lib/services/android-project-service.ts (1)
331-342: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winDuplicate
packageNameresolution logic across two methods.Both
createProjectandupdatePlatformrepeat the identical expressionprojectData.nsConfig.android?.runtimePackageName || constants.SCOPED_ANDROID_RUNTIME_NAME. Extract this into a shared private helper (e.g.isScopedAndroidRuntime(projectData)) to avoid drift if the fallback logic changes later.♻️ Suggested refactor
+ private isScopedAndroidRuntime(projectData: IProjectData): boolean { + const packageName = + projectData.nsConfig.android?.runtimePackageName || + constants.SCOPED_ANDROID_RUNTIME_NAME; + return packageName === constants.SCOPED_ANDROID_RUNTIME_NAME; + } + public async createProject( frameworkDir: string, frameworkVersion: string, projectData: IProjectData ): Promise<void> { - const packageName = projectData.nsConfig.android?.runtimePackageName || constants.SCOPED_ANDROID_RUNTIME_NAME; if ( - packageName === constants.SCOPED_ANDROID_RUNTIME_NAME && + this.isScopedAndroidRuntime(projectData) && semver.lt(): Promise<boolean> { - const packageName = projectData.nsConfig.android?.runtimePackageName || constants.SCOPED_ANDROID_RUNTIME_NAME; if ( - packageName === constants.SCOPED_ANDROID_RUNTIME_NAME && + this.isScopedAndroidRuntime(projectData) && semver.eq(Also applies to: 523-536
🤖 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 `@lib/services/android-project-service.ts` around lines 331 - 342, The `packageName` fallback logic is duplicated in both `createProject` and `updatePlatform`, so extract `projectData.nsConfig.android?.runtimePackageName || constants.SCOPED_ANDROID_RUNTIME_NAME` into a shared private helper on `AndroidProjectService` (for example, `isScopedAndroidRuntime(projectData)` or a similar resolver) and update both call sites to use it, keeping the semver check and existing `this.$errors.fail` behavior unchanged.
🤖 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.
Nitpick comments:
In `@lib/services/android-project-service.ts`:
- Around line 331-342: The `packageName` fallback logic is duplicated in both
`createProject` and `updatePlatform`, so extract
`projectData.nsConfig.android?.runtimePackageName ||
constants.SCOPED_ANDROID_RUNTIME_NAME` into a shared private helper on
`AndroidProjectService` (for example, `isScopedAndroidRuntime(projectData)` or a
similar resolver) and update both call sites to use it, keeping the semver check
and existing `this.$errors.fail` behavior unchanged.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 49720012-3767-4cef-83de-95d36daa7e8d
📒 Files selected for processing (1)
lib/services/android-project-service.ts
We were checking for runtime > 1.5.0. Does not make sense with custom runtimes
Summary by CodeRabbit