Skip to content

add homepage, repository, and documentation links to the pub result #155

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

Merged
merged 7 commits into from
Jun 6, 2025

Conversation

jakemac53
Copy link
Contributor

Closes #154

This won't automatically include examples, as that would be a fair bit more involved, but it will include the documentation link if provided by the package.

@jakemac53
Copy link
Contributor Author

cc @csells

Copy link

github-actions bot commented Jun 5, 2025

PR Health

Changelog Entry ✔️
Package Changed Files

Changes to files need to be accounted for in their respective changelogs.

@jakemac53
Copy link
Contributor Author

One open question, should we default the documentation link to https://pub.dev/documentation/<package>/latest/?

Also, should we link to the actual pub page? That would show the readme content at least

@gspencergoog
Copy link
Contributor

One open question, should we default the documentation link to https://pub.dev/documentation/<package>/latest/?

I think yes. The latest one is most likely the one most in use (especially for the majority of packages which haven't released in a while).

Also, should we link to the actual pub page? That would show the readme content at least

Maybe linking to the README itself might be more helpful? It'll be in Markdown, which the LLM would grok better anyhow, and because it's called "README" might be more attractive to the LLM to actually fetch and read.

@jakemac53
Copy link
Contributor Author

Maybe linking to the README itself might be more helpful? It'll be in Markdown, which the LLM would grok better anyhow, and because it's called "README" might be more attractive to the LLM to actually fetch and read.

I am not sure we can reliably link to the README is the issue. We could potentially do that if the repo/homepage are GitHub links, as we know the rough structure of GitHub.

@jakemac53
Copy link
Contributor Author

I think yes. The latest one is most likely the one most in use (especially for the majority of packages which haven't released in a while).

Separate but related question, should we just always include this, separate from the documentation link? I have noticed that if packages include a documentation link, it tends to be a custom page.

@github-actions github-actions bot added the type-infra A repository infrastructure change or enhancement label Jun 5, 2025
@gspencergoog
Copy link
Contributor

I am not sure we can reliably link to the README is the issue. We could potentially do that if the repo/homepage are GitHub links, as we know the rough structure of GitHub.

In that case, I think the pub page is probably the next best thing.

@gspencergoog
Copy link
Contributor

gspencergoog commented Jun 5, 2025

Separate but related question, should we just always include this, separate from the documentation link? I have noticed that if packages include a documentation link, it tends to be a custom page.

Would https://pub.dev/documentation/<package>/latest/<package>/ make sense (e.g. this one for Riverpod), since it's the "top" of the documentation tree for the API, and would list many more symbols?

@jakemac53
Copy link
Contributor Author

Would https://pub.dev/documentation/<package>/latest/<package>/ make sense (e.g. this one for Riverpod), since it's the "top" of the documentation tree for the API, and would list many more symbols?

That won't always work for all packages because it assumes they have a file at lib/<package-name>.dart. Yes, most packages do have that, but not all.

@jakemac53
Copy link
Contributor Author

Although, we actually do have the information to know all the public libraries, so we could link to each of their documentation pages.

@github-actions github-actions bot removed the type-infra A repository infrastructure change or enhancement label Jun 5, 2025
@jakemac53
Copy link
Contributor Author

Ok @gspencergoog I added docs links for all the libraries now :)

@jakemac53
Copy link
Contributor Author

Another idea here is the keys in the libraries map could be package uris instead of just the library name?

@jakemac53
Copy link
Contributor Author

jakemac53 commented Jun 5, 2025

cc @sigurdm do you know if the library names correspond to import paths (can we do package:<package-name>/<library-name>.dart always)? Or is there another way to get the import uri?

Update: Looks like it won't work out of the box today, https://pub.dev/documentation/test/latest/bootstrap_browser/ is an example, we just get the name browser for the library, it looks like this in the JSON:

{
    "name": "browser",
    "qualifiedName": "browser",
    "href": "bootstrap_browser/",
    "kind": 9,
    "packageRank": 0,
    "desc": ""
  },

We also can't get away with mangling the href (replace underscores with /) because that would break for libraries that actually have underscores in the name.

@gspencergoog
Copy link
Contributor

Ok @gspencergoog I added docs links for all the libraries now :)

Nice!

@gspencergoog
Copy link
Contributor

Update: Looks like it won't work out of the box today, pub.dev/documentation/test/latest/bootstrap_browser is an example, we just get the name browser for the library...

The pub.dev site must have a way to figure out all of the library links: it displays them. Can we ask them to add that info to the API?

@jakemac53
Copy link
Contributor Author

The pub.dev site must have a way to figure out all of the library links: it displays them. Can we ask them to add that info to the API?

That is why I have cc'd @sigurdm on here :). It might be harder than you would think, those pages are dartdoc output which afaik you cannot get in a structured form. Clearly pub is already doing something here though to extract all the symbols in a package so hopefully it is possible to also provide the library imports.

@jakemac53
Copy link
Contributor Author

I am going to go ahead and merge this as is but @sigurdm if you have thoughts please comment and I can follow up

@jakemac53
Copy link
Contributor Author

Oh actually, I need approval from @gspencergoog first :)

@jakemac53 jakemac53 merged commit 52adf08 into main Jun 6, 2025
18 of 19 checks passed
@jakemac53 jakemac53 deleted the add-homepage branch June 6, 2025 21:08
copybara-service bot pushed a commit to dart-lang/sdk that referenced this pull request Jun 9, 2025
Revisions updated by `dart tools/rev_sdk_deps.dart`.

ai (https://github.com/dart-lang/ai/compare/1d9d60c..f2b48c6):
  f2b48c6  2025-06-09  Nate Bosch  Retain compatibility with 3.7 SDKs (dart-lang/ai#163)
  52adf08  2025-06-06  Jacob MacDonald  add homepage, repository, and documentation links to the pub result (dart-lang/ai#155)
  fa1c2be  2025-06-06  Nate Bosch  Always use the failures-only reporter for testing (dart-lang/ai#160)
  66a152f  2025-06-06  Nate Bosch  Instruct clients to prefer MCP (dart-lang/ai#161)
  55ad850  2025-06-05  Jacob MacDonald  Add a retroactive changelog (dart-lang/ai#157)
  b08a610  2025-06-05  Jacob MacDonald  Update instructions, add cursor install link (dart-lang/ai#159)

web (https://github.com/dart-lang/web/compare/f1becf0..de6b3e4):
  de6b3e4  2025-06-06  Srujan Gaddam  Add missing copyrights and delete empty files (dart-lang/web#371)
  74a33ba  2025-06-06  Kevin Moore  Add in a missing library directive, missing new line (dart-lang/web#370)
  4d24eb5  2025-06-06  nikeokoronkwo  [web_generator] Setting up `web_generator` for Dart JS Interop Gen (dart-lang/web#368)

webdev (https://github.com/dart-lang/webdev/compare/55941b0..661dafd):
  661dafd4  2025-06-08  Srujan Gaddam  Defer execution of main until resume for hot restart with DDC library bundle format (dart-lang/webdev#2623)
  01a3b9d7  2025-06-06  Nicholas Shahan  Remove skip from chrome proxy service test

Change-Id: If3d4326d0bacf47a4d95520dbd0aac5fb58de439
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/433363
Commit-Queue: Devon Carew <devoncarew@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Copy link
Contributor

@sigurdm sigurdm left a comment

Choose a reason for hiding this comment

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

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[feat] provide the link to the docs and the repo from the pub.dev search tool
3 participants