--github option should open the github project in the browser
qnm lodash --github
should open https://github.com/lodash/lodash
A few questions:
- Are
--githuband--homepagemutually exclusive the same wayopenandhomepageare? - I am assuming this should rely on the "repository" field. What about cases in which it is not github? Maybe use "repo" instead?
- What about non-http repository fields? Or maybe we should only rely on
packageJson?.repository?.urlfor 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?
- You are correct, currently
--homepagedoes 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.
-
We could use the repository field if it starts with
httpssince GitHub knows to redirect. -
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.
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?
I don't mind, feel free to choose what you think is best