chore: sync upstream PR #8252 - Fix iOS CLI checks and Cordova Package.swift generation race#36
chore: sync upstream PR #8252 - Fix iOS CLI checks and Cordova Package.swift generation race#36
Conversation
WalkthroughThe pull request refactors iOS platform check logic to execute checks sequentially and independently rather than short-circuiting on early success, and converts package file generation from sequential to parallel execution using Promise.all. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
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 |
b34a3a9 to
e4ab3c1
Compare
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
cli/src/ios/update.ts (1)
70-76: Cordova Package.swift generation race is correctly fixed; async wrapper can be simplifiedUsing
await Promise.all(...)here ensures all per-pluginPackage.swiftfiles are fully written beforecheckPluginsForPackageSwiftruns, which removes the prior race while safely parallelizing independent file writes. The logic looks sound.Optionally, you can drop the extra
async/awaitlayer for brevity:-async function generateCordovaPackageFiles(cordovaPlugins: Plugin[], config: Config) { - await Promise.all( - cordovaPlugins.map(async (plugin) => { - await generateCordovaPackageFile(plugin, config); - }), - ); -} +async function generateCordovaPackageFiles(cordovaPlugins: Plugin[], config: Config) { + await Promise.all(cordovaPlugins.map((plugin) => generateCordovaPackageFile(plugin, config))); +}
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
cli/src/ios/doctor.ts(1 hunks)cli/src/ios/update.ts(1 hunks)cli/src/tasks/add.ts(1 hunks)cli/src/tasks/update.ts(1 hunks)
🧰 Additional context used
🧬 Code graph analysis (3)
cli/src/tasks/update.ts (1)
cli/src/ios/common.ts (2)
checkBundler(28-43)checkCocoaPods(45-53)
cli/src/ios/doctor.ts (2)
cli/src/common.ts (2)
check(16-22)checkWebDir(24-56)cli/src/ios/common.ts (2)
checkBundler(28-43)checkCocoaPods(45-53)
cli/src/tasks/add.ts (1)
cli/src/ios/common.ts (3)
checkIOSPackage(15-17)checkBundler(28-43)checkCocoaPods(45-53)
⏰ 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). (2)
- GitHub Check: test-android
- GitHub Check: test-core
🔇 Additional comments (3)
cli/src/tasks/update.ts (1)
49-55: Fixes misuse of async checks; Bundler and CocoaPods are now both validatedSplitting the iOS branch into two separate checks ensures
checkBundlerandcheckCocoaPodsboth execute and report independently, instead of short‑circuiting on the first Promise. This is the correct wiring forcheck()and will surface missing CocoaPods duringupdatewhere it was previously silent.cli/src/tasks/add.ts (1)
113-116: IOS add checks are now correctly split; all three validations will runReturning
[checkIOSPackage, checkBundler, checkCocoaPods]as separate check functions is the right pattern for the sharedcheck()helper. This ensures that package presence, Bundler, and CocoaPods are each validated when runningadd ios, instead of accidentally short‑circuiting and skipping the CocoaPods check.Given this is now always executed for iOS adds, it’s worth double‑checking that
checkCocoaPodsstill behaves as intended on non‑macOS environments (i.e., doesn’t block add flows where CocoaPods isn’t required).cli/src/ios/doctor.ts (1)
21-23: Doctor now runs all iOS checks independently, which is the correct patternPassing each of
checkBundler,checkCocoaPods,checkWebDir, andcheckXcodeas separateCheckFunctions ensures the doctor command evaluates all iOS preconditions and reports all issues at once, instead of short‑circuiting on the first passing or failing check. The wiring intocheck()looks correct.
Upstream PR Sync
This PR syncs changes from an external contributor's PR on the official Capacitor repository.
Original PR
Automation
Synced from upstream by Capacitor+ Bot
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.