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

Link to modules repo in the search results. #10

Closed
jamestalmage opened this issue Jun 6, 2016 · 19 comments
Closed

Link to modules repo in the search results. #10

jamestalmage opened this issue Jun 6, 2016 · 19 comments

Comments

@jamestalmage
Copy link

Personally, if it's available, I would just a soon have the GitHub repo be the default link.

Failing that, it would be nice to have a link to the repo (just add a clickable GH icon?)

@satazor
Copy link
Member

satazor commented Jun 6, 2016

We do have a GH link in the top right corner but points to the org. Do you think that pointing to this repo would be better?

@jamestalmage
Copy link
Author

jamestalmage commented Jun 6, 2016

No. I meant extract from the repo field in package.json. Links for every search result.

Sorry, I could have been a lot clearer.

@jamestalmage jamestalmage changed the title Link to the repo. Link to modules repo in the search results. Jun 6, 2016
@satazor
Copy link
Member

satazor commented Jun 6, 2016

Ah sorry, now I understand. Hmm, I'm not sure about making GH the default link, but adding a gh icon next to the package name would be reasonable. @sindresorhus @atduarte what are your thoughts?

@sindresorhus
Copy link

I would make GitHub the default. The npm site is pretty useless except for download stats, which you could show in the search result instead.

@satazor
Copy link
Member

satazor commented Jun 6, 2016

I originally planned a module page, similar to https://libraries.io/npm/react but I didn't have the time. That page would contain all relevant links, including stats, etc.m
Making the GH will have some downsides, such as modules that live in the same repo, e.g.: lodash's modules, react's addons, etc.

@jamestalmage Are you able to do a PR with the change? Note that the repository link can be a github link, a bitbucket link, etc. Ideally we would support these kind of links.. we could do that using https://www.npmjs.com/package/hosted-git-info and fallback to npm link. Note that the .fromUrl function throws in some edge cases, see https://github.com/npms-io/npms-analyzer/blob/master/lib/analyze/util/hostedGitInfo.js#L16

@sindresorhus
Copy link

Make sure to link to the SHA corresponding to the latest release if available, so the user get the correct readme. Should be the gitHead field in the package entry in the registry.

@satazor
Copy link
Member

satazor commented Jun 6, 2016

Yes we can append #<gitHead> to the URL passed to hosted-git-info and then use .browse() to get the URL. Note that gitHead might not be available. @jamestalmage I would wrap all of this logic into a RepoLink component or something.

@jamestalmage
Copy link
Author

jamestalmage commented Jun 7, 2016

@jamestalmage Are you able to do a PR with the change?

I'm willing to tackle creating a module for fetching the link data. You don't want me touching HTML / CSS.

@satazor
Copy link
Member

satazor commented Jun 7, 2016

I don't think that creating a module is necessary, it would be a tiny wrapper around hostedGitInfo.fromUrl(metadata.repository + '#' + metadata.gitHead).browse() || npmLink. Actually you don't need to touch any css, just React and some minor HTML. It would be a good exercise :P Though, if you're not comfortable I will do it tomorrow.

@jamestalmage
Copy link
Author

jamestalmage commented Jun 7, 2016

Soo.
I'm guessing this requires some rework in the npms-api and maybe npms-analyzer. The required data currently isn't being passed transferred to the browser. I hunted around and found this, but it looks pretty involved.

I'm thinking I'm going to pass for now. It's not a matter of comfort, just a lack of time.

@satazor
Copy link
Member

satazor commented Jun 7, 2016

@jamestalmage you are right. I will give it a try today.

@satazor
Copy link
Member

satazor commented Jun 7, 2016

Question: should we give priority to the package.json website?

@sindresorhus
Copy link

@satazor No, I want the GitHub repo. I usually inspect the code of modules before using them.

@atduarte
Copy link
Member

I think that just replacing the link from npmjs to GitHub is not the best solution, since there's additional information in the npmjs' page and we can't easily go from GitHub to npmjs, but the other way around we can.

Maybe we could change the list design and add the ability to add multiple links (GitHub, Webpage, future npms package page, #25, etc). With this change we would be also adressing some of the concerns of #20.

express
(Numbers would have a tooltip)

@satazor
Copy link
Member

satazor commented Jun 16, 2016

I have everything setup in the analyzer and api.. we just need to agree how this goes into the interface now

I like @atduarte approach, and we can always revisit this once a designer starts working with us.

@sindresorhus
Copy link

I still think GitHub should be the default when you click the title. Makes sense to have an icon to go to the npm page though.

since there's additional information in the npmjs' page

What do you need from it? The only thing I can think of are download numbers and dependencies/dependents and that could easily embedded in npms at some point.

@atduarte
Copy link
Member

atduarte commented Jun 16, 2016

Yeah, I was referring to download numbers. The npms page would obviously be the best choice, but we will have to wait.

About changing the default link, I don't know what people in general prefer. Maybe you are right. We could A/B test, make some kind of voting or just change it and check GA for data and Twitter for complains. 😄
What do you think, @satazor?

Maybe I will implement that design and then when we decide we can easily change the default.

@satazor
Copy link
Member

satazor commented Jun 16, 2016

ahaha we still have a lot of work to do before devoting time to A/B testing. Lets trust @sindresorhus judgement and go for the GH as default and npm icon below.

Note that the actual repository link might not be ONLY from GH, but from bitbucket & gitlab too.

@satazor
Copy link
Member

satazor commented Jun 17, 2016

All done guys!

@satazor satazor closed this as completed Jun 17, 2016
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 a pull request may close this issue.

4 participants