qnm icon indicating copy to clipboard operation
qnm copied to clipboard

--github option should open the github project in the browser

Open ranyitz opened this issue 7 years ago • 4 comments

qnm lodash --github

should open https://github.com/lodash/lodash

ranyitz avatar May 29 '18 23:05 ranyitz

A few questions:

  1. Are --github and --homepage mutually exclusive the same way open and homepage are?
  2. I am assuming this should rely on the "repository" field. What about cases in which it is not github? Maybe use "repo" instead?
  3. What about non-http repository fields? Or maybe we should only rely on packageJson?.repository?.url for safety? - it will limit the amount of repos that will actually be able to make use of it, though. Alternatively, we can run a url validity check. Would it be cool if I install an external dependency for that?

ealush avatar Apr 04 '21 18:04 ealush

  1. You are correct, currently --homepage does this functionality, and uses npm own words so I think that it's clear enough.

open will open the package.json of a chosen package in your editor, so it's different.

  1. We could use the repository field if it starts with https since GitHub knows to redirect.

  2. Good point, yeah sure, we can add another dependency (we're using ncc to bundle everything so it will run fast when using npx)


To say the truth I haven't used the --homepage flag myself, since for the most part, I just need to know the local versions, so I wouldn't invest a lot in supporting edge cases of this feature. Unless there are people who will ask for it.

ranyitz avatar Apr 04 '21 19:04 ranyitz

Regarding 1. I meant that when using open, the function returns, so the homepage option is ignored. My question is when using homepage along with repo, should it also immediately return as well, or should it open both the homepage and the repo project in the browser?

ealush avatar Apr 04 '21 19:04 ealush

I don't mind, feel free to choose what you think is best

ranyitz avatar Apr 04 '21 19:04 ranyitz