Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Work-around for relative README links #133

Merged
merged 3 commits into from
Sep 14, 2022

Conversation

rschristian
Copy link
Member

@rschristian rschristian commented Sep 13, 2022

Issue

Relative links to the repo root work great for our subpackages while browsing on GitHub, but this causes issues when published to NPM.

NPM's combination of the link with the repo URL unfortunately allows users to escape platform-specific path parameters. See the following:

Source Link: `../../README.md`

Correct Link:  `<repo>/tree/HEAD/README.md`
NPM's Link:    `<repo>/README.md`

Might be a bit too hopeful on my part for how intelligently NPM would handle this, but a disappointment nonetheless.

Summary

The fix here (to which all credit goes to @kidonng) is just to specify the directory of the package in our package.json for each subproject.

NPM can figure out the links from there.

@changeset-bot
Copy link

changeset-bot bot commented Sep 13, 2022

⚠️ No Changeset found

Latest commit: 8f6a3d5

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

@netlify
Copy link

netlify bot commented Sep 13, 2022

Deploy Preview for preact-signals-demo ready!

Name Link
🔨 Latest commit 8f6a3d5
🔍 Latest deploy log https://app.netlify.com/sites/preact-signals-demo/deploys/63216d4c1da2670009fb63b3
😎 Deploy Preview https://deploy-preview-133--preact-signals-demo.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@github-actions
Copy link
Contributor

github-actions bot commented Sep 13, 2022

Size Change: 0 B

Total Size: 65 kB

ℹ️ View Unchanged
Filename Size
docs/dist/assets/client.********.js 45.7 kB
docs/dist/assets/index.********.js 1.06 kB
docs/dist/assets/signals-core.module.********.js 932 B
docs/dist/assets/signals.module.********.js 5.67 kB
docs/dist/assets/style.********.js 21 B
docs/dist/assets/style.*********.js 21 B
docs/dist/assets/style.********.css 994 B
docs/dist/basic-********.js 224 B
docs/dist/demos-********.js 3.44 kB
docs/dist/nesting-********.js 1.11 kB
docs/dist/react-********.js 238 B
packages/core/dist/signals-core.js 985 B
packages/core/dist/signals-core.mjs 804 B
packages/preact/dist/signals.js 1.13 kB
packages/preact/dist/signals.mjs 1.11 kB
packages/react/dist/signals.js 792 B
packages/react/dist/signals.mjs 749 B

compressed-size-action

@rschristian rschristian marked this pull request as draft September 13, 2022 06:21
@rschristian rschristian changed the title fix: Hacky work-around for relative README links fix: Work-around for relative README links Sep 13, 2022
@rschristian rschristian marked this pull request as ready for review September 14, 2022 05:16
@kidonng
Copy link
Contributor

kidonng commented Sep 14, 2022

@rschristian I just realized this is for sub directories, while I was looking at the root README all the time 😅

This should do the trick:

"repository": {
   "type": "git",
   "url": "https://github.com/preactjs/signals",
   "directory": "packages/preact"
}

I published a demo package to npm, you can see the contents here.

@rschristian
Copy link
Member Author

Ah shoot, yep that seems to work.

Someone from NPM once told me that was just metadata and not used for anything on their end. Didn't even think to check that.

@rschristian rschristian marked this pull request as draft September 14, 2022 05:52
@rschristian rschristian marked this pull request as ready for review September 14, 2022 05:58
Copy link
Member

@marvinhagemeister marvinhagemeister left a comment

Choose a reason for hiding this comment

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

Nice 🎉

@marvinhagemeister marvinhagemeister merged commit 8462c59 into main Sep 14, 2022
@marvinhagemeister marvinhagemeister deleted the fix/readme-npm-links branch September 14, 2022 07:10
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.

3 participants