Skip to content

fix: add repository.directory so published READMEs' relative links resolve#1903

Open
yashrao2607 wants to merge 2 commits into
rrweb-io:mainfrom
yashrao2607:fix/1738-npm-readme-relative-links
Open

fix: add repository.directory so published READMEs' relative links resolve#1903
yashrao2607 wants to merge 2 commits into
rrweb-io:mainfrom
yashrao2607:fix/1738-npm-readme-relative-links

Conversation

@yashrao2607

Copy link
Copy Markdown

Summary

npm rewrites relative links in a published README into absolute GitHub URLs, but it can only do that correctly if package.json's repository.directory field tells it where the package actually lives in the repo. None of this monorepo's 20 publishable packages set it, so npm assumes every README lives at the repo root — any relative link (to guide.md, CONTRIBUTING.md, a sibling package, etc.) resolves to the wrong path on GitHub and 404s.

This adds the missing directory field to repository in every publishable package's package.json, pointing at that package's actual subfolder (e.g. packages/rrweb, packages/plugins/rrweb-plugin-console-record). packages/web-extension is skipped since it's "private": true and never published.

Test plan

  • Verified all 20 edited package.json files still parse as valid JSON
  • Diff reviewed to confirm only the directory field was added, nothing else changed
  • Once published, npm's README renderer will resolve relative links against each package's own repository.directory instead of the repo root

Fixes #1738

npm resolves relative links in a package README against the repo
root unless package.json's repository.directory points at the
package's actual subfolder. None of the monorepo's publishable
packages set it, so every relative link in every published README
(e.g. links to guide.md, CONTRIBUTING.md, sibling packages) 404s on
npmjs.com.

Fixes rrweb-io#1738
@changeset-bot

changeset-bot Bot commented Jul 17, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 919c7c5

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 22 packages
Name Type
@rrweb/all Patch
@rrweb/browser-client Patch
@rrweb/packer Patch
@rrweb/record Patch
@rrweb/replay Patch
rrdom-nodejs Patch
rrdom Patch
rrvideo Patch
rrweb-player Patch
rrweb-snapshot Patch
rrweb Patch
@rrweb/types Patch
@rrweb/utils Patch
@rrweb/rrweb-plugin-canvas-webrtc-record Patch
@rrweb/rrweb-plugin-canvas-webrtc-replay Patch
@rrweb/rrweb-plugin-console-record Patch
@rrweb/rrweb-plugin-console-replay Patch
@rrweb/rrweb-plugin-network-record Patch
@rrweb/rrweb-plugin-network-replay Patch
@rrweb/rrweb-plugin-sequential-id-record Patch
@rrweb/rrweb-plugin-sequential-id-replay Patch
@rrweb/web-extension Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
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.

[Docs]: Relative Links Don't Work

1 participant