fix(convert): resolve directory pruning failure on Windows due to pat…#148
fix(convert): resolve directory pruning failure on Windows due to pat…#148Adityakk9031 wants to merge 2 commits into
Conversation
…h separator mismatches
|
Warning Review limit reached
Next review available in: 51 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (1)
✨ 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 |
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes — a Windows-only fix in pruneOrphanedOutputs so that empty parent directories left by pruned .md files are actually removed.
- Normalize parent paths before the prefix check —
orphansare produced by fast-glob, which returns POSIX forward-slash paths on every platform, whileresolve(outDir)returns backslash paths on Windows. The olddir.startsWith(resolvedOutDir + sep)guard therefore never matched on Windows, so empty directories were never swept. Wrapping the parent derivation (resolve(dirname(filePath))and the loop stepresolve(dirname(dir))) normalizes to platform-native separators, restoring correct behavior.
The change is minimal and correct. One harmless redundancy worth noting for a future pass: after the first loop iteration dir is already resolved and dirname of a native path stays native, so the loop-step resolve() is a no-op — not worth changing on its own.
Claude Opus | 𝕏
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes — a one-line cleanup in pruneOrphanedOutputs that removes the redundant loop-step resolve() flagged by the prior review.
- Drop redundant
resolve()in the directory-sweep loop — the loop step is nowdir = dirname(dir)instead ofdir = resolve(dirname(dir)). Since theparentsset is seeded withresolve(dirname(filePath)),dirstarts as a platform-native path anddirnameof a native path stays native, so the removedresolve()was a no-op. Behavior is unchanged and the Windows prefix check still holds.
Claude Opus | 𝕏

close:#146
Description
During output pruning (
convertAllMdx --prune), empty parent directories left behind by deleted markdown files were not being deleted on Windows. This was caused by a path separator mismatch between glob output paths (which use/) and resolved output directories (which use\).This PR normalizes all paths to platform-specific format using
path.resolve()before performing prefix/directory matching.Cause
In
pruneOrphanedOutputs, the directory sweep checks if a parent directory is insideoutDirusing: