OctoLinker / OctoLinker

OctoLinker — Links together, what belongs together

Home Page:https://octolinker.vercel.app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Link to subfolder on multi-package JS repos

silverwind opened this issue · comments

Describe the feature
Repos that contain multiple packages link to the root repository but it would be nicer if they's link to the packages/$package subdirectory.

Demo
https://github.com/silverwind/updates/blob/cdf48118cfbe1ee4595ac41854b50f345661fe5a/rollup.config.js#L33

links to

https://github.com/rollup/plugins

but should link to

https://github.com/rollup/plugins/tree/master/packages/node-resolve

Additional information

The homepage property of the package links to the right place, maybe it can be used if it points to GitHub. Otherwise, packages/$package could be used if it exists.

We support that already, but the package author needs to tell us the location. For example jest-circus contains the following config

  "repository": {
    "type": "git",
    "url": "https://github.com/facebook/jest.git",
    "directory": "packages/jest-circus"
  },

https://github.com/facebook/jest/blob/master/packages/jest-circus/package.json#L7

Let me know if you have further questions or suggestions

Regarding the homepage field, the OctoLinker contains a config that the defines the priorities order of each field https://github.com/OctoLinker/api/blob/master/src/registries/config.json#L29-L40

I would prefer if packages that don't specify directory could be detected by a heuristic maybe. The relevant field in that package.json are:

"repository": "rollup/plugins",
"homepage": "https://github.com/rollup/plugins/tree/master/packages/node-resolve/#readme",

Is it too weak of an indication that homepage goes to a subdirectory to be able to overrule repository or do you think such a mechanism would be acceptable?

Dependabot needs the directory setting too in order to show release notes correctly. I've been hoping that as more people use it packages without a directory start getting updated. Would be super helpful here if they did.

I'm open to putting a check in for this, but I think it'd be best if we could see what packages failed the checks so we could try to open PRs for them. Or at the very least be able to see a list of them along with their popularity so others could do it too.

Yeah it seems directory is somewhat of a standard (npm docs do mention it), so I guess it's better to be strict about this as the homepage parsing would just be a hack prone to failure.

I really like the idea of us fixing the world 😉

How do we define that a request failed? Imagine a package that lives inside a mono repo but all it exposes is a repository url that point to the root GitHub project. How do we know that this needs to be linked to a subfolder?