fix: add repository.directory so published READMEs' relative links resolve#1903
Open
yashrao2607 wants to merge 2 commits into
Open
fix: add repository.directory so published READMEs' relative links resolve#1903yashrao2607 wants to merge 2 commits into
yashrao2607 wants to merge 2 commits into
Conversation
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 detectedLatest commit: 919c7c5 The changes in this PR will be included in the next version bump. This PR includes changesets to release 22 packages
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
npm rewrites relative links in a published README into absolute GitHub URLs, but it can only do that correctly if
package.json'srepository.directoryfield 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 (toguide.md,CONTRIBUTING.md, a sibling package, etc.) resolves to the wrong path on GitHub and 404s.This adds the missing
directoryfield torepositoryin every publishable package'spackage.json, pointing at that package's actual subfolder (e.g.packages/rrweb,packages/plugins/rrweb-plugin-console-record).packages/web-extensionis skipped since it's"private": trueand never published.Test plan
package.jsonfiles still parse as valid JSONdirectoryfield was added, nothing else changedrepository.directoryinstead of the repo rootFixes #1738