Skip to content

fix(targets): use relative symlinks on non-Win#22

Merged
fbosch merged 2 commits into
masterfrom
fix/relative-symlinks
Feb 4, 2026
Merged

fix(targets): use relative symlinks on non-Win#22
fbosch merged 2 commits into
masterfrom
fix/relative-symlinks

Conversation

@fbosch
Copy link
Copy Markdown
Owner

@fbosch fbosch commented Feb 4, 2026

Summary by CodeRabbit

  • Bug Fixes
    • Symlink targets on non-Windows platforms now use relative paths instead of absolute paths, improving portability and link resolution across different directory structures.
  • Tests
    • Added cross-platform test coverage validating relative symlink behavior on non-Windows systems (skips on Windows).

Copilot AI review requested due to automatic review settings February 4, 2026 17:47
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Feb 4, 2026

📝 Walkthrough

Walkthrough

Modified symlink creation logic to compute the linkTarget as a path relative to the target's parent directory on non-Windows platforms; Windows still uses the absolute sourceDir. A new test verifies the relative symlink behavior on non-Windows systems.

Changes

Cohort / File(s) Summary
Symlink path computation
src/cache/targets.ts
Changed symlink creation to use a relative linkTarget (relative to the target's parent dir) on non-Windows platforms; Windows behavior remains absolute.
Symlink behavior validation
tests/targets.test.js
Added test that (non-Windows only) creates source/target dirs, runs applyTargetDir with mode "symlink", and asserts the symlink points to the relative path from the parent directory to the source.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 I hopped through folders, soft and bright,
Tied paths together, hidden from sight,
On Unix I curled the link just so,
Windows stays straight where absolute paths go,
A little hop, and portability takes flight! 🎋

🚥 Pre-merge checks | ✅ 3
✅ 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 'fix(targets): use relative symlinks on non-Win' directly and clearly summarizes the main change: implementing relative symlinks on non-Windows platforms in the targets module.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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 fix/relative-symlinks

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.

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Feb 4, 2026

Open in StackBlitz

npx https://pkg.pr.new/fbosch/docs-cache@22

commit: 54d8d3c

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates applyTargetDir to create relative symlink targets on non-Windows platforms, improving portability of created target links.

Changes:

  • Compute a relative linkTarget for fs.symlink on non-Windows (path.relative(parentDir, sourceDir)), while keeping Windows behavior unchanged.
  • Add a unit test asserting the symlink target is relative on non-Windows platforms.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/cache/targets.ts Switches non-Windows symlink creation to use relative link targets.
tests/targets.test.js Adds coverage verifying the created symlink target is relative (non-Windows only).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tests/targets.test.js Outdated
@fbosch fbosch merged commit bbc9c2b into master Feb 4, 2026
13 checks passed
@fbosch fbosch deleted the fix/relative-symlinks branch February 4, 2026 17:58
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.

2 participants