npms-io / npms-www

The https://npms.io website
MIT License
245 stars 35 forks source link

Link to modules repo in the search results. #10

Closed jamestalmage closed 8 years ago

jamestalmage commented 8 years ago

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 commented 8 years ago

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 commented 8 years ago

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

Sorry, I could have been a lot clearer.

satazor commented 8 years ago

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 commented 8 years ago

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 commented 8 years ago

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 commented 8 years ago

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 commented 8 years ago

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 commented 8 years ago

@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 commented 8 years ago

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 commented 8 years ago

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 commented 8 years ago

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

satazor commented 8 years ago

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

sindresorhus commented 8 years ago

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

atduarte commented 8 years ago

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 commented 8 years ago

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 commented 8 years ago

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 commented 8 years ago

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. :smile: What do you think, @satazor?

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

satazor commented 8 years ago

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 commented 8 years ago

All done guys!