Open Andarist opened 2 years ago
We don't actually look at the branch from parse-github-url, you can set the branch used for the rule in the root package.json:
"manypkg": {
"defaultBranch": "main"
}
Hah, right! I've just checked that in here we get incorrect~ (in my situation) branch and I've assumed that it's the culprit.
Since most of the stuff is really convention-based and not configuration-based. Why this option does exist? Why it was not chosen to validate and fix the rootRepositoryField
so it would contain a branch name explicitly and for that to be the source of this "option"? In addition to that - without rootRepositoryField
the per-package packag.json#repository
is not validated at all so each package could end up with highly different/broken URLs there
What would the root repository field look like with the branch name included? afaik, there isn't a form that would include it?
If we visit https://github.com/Thinkmill/manypkg and press Y on the keyboard we are being redirected to an URL containing the hash (eg. https://github.com/Thinkmill/manypkg/tree/5f6cdedf6843d60144c1ea65b5a8ef0c4b7f0bd5) - the URL isn't really bound to a hash though, it can take any git revision. So we can just replace this with a branch name and end up with a valid URL such as: https://github.com/Thinkmill/manypkg/tree/master
I did not know that was a thing! Supporting that would be great
Can't say it's anywhere on my todo list but it's great to keep this as an issue "for the better times" 😉
TIL that repository.directory
is supported:
"repository": {
"type" : "git",
"url" : "https://github.com/facebook/react.git",
"directory": "packages/react-dom"
}
https://docs.npmjs.com/cli/v6/configuring-npm/package-json#repository
Yeah though I'm not sure I've seen anything that actually uses it, e.g. the repository link for https://www.npmjs.com/package/react goes to the root of the repo which is quite annoying but the link on https://www.npmjs.com/package/@emotion/react goes to the package directory
For this:
we get this back from
parse-github-url
:As we might notice the
branch
has defaulted tomaster
which in turn makes per-packagerepository
field like https://github.com/Thinkmill/manypkg/tree/main/packages/cli incorrect and results in the error:The quickest fix for me was to just remove the root
"repository"
field but I think that the situation here should be improved so nobody would face that in the future.